Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

35coreos-ignition: add coreos-kargs #938

Merged
merged 1 commit into from
May 14, 2021

Conversation

arithx
Copy link
Contributor

@arithx arithx commented Apr 9, 2021

Marking as draft until an Ignition release & coreos-installer release have made it to testing-devel.

Based on content from these PRs:
coreos/ignition#1178
coreos/coreos-installer#498

jlebon
jlebon previously approved these changes Apr 23, 2021
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some bikesheddy nits, but LGTM overall!

@arithx
Copy link
Contributor Author

arithx commented May 13, 2021

Rebased on top of #1009

@arithx arithx marked this pull request as ready for review May 13, 2021 03:57
jlebon
jlebon previously approved these changes May 14, 2021
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🎉

@jlebon
Copy link
Member

jlebon commented May 14, 2021

Were you thinking of enhancing kola to allow setting kargs from external tests? Or just have internal tests in kola for now?

@arithx
Copy link
Contributor Author

arithx commented May 14, 2021

Were you thinking of enhancing kola to allow setting kargs from external tests? Or just have internal tests in kola for now?

Are you meaning kargs set via the harness (e.x. set via the qemu cmdline args) specifically for testing this feature? If so my plan was to just have it be an internal test, any other test that wants kargs can just add it to the Ignition config (as that's the user-facing happy path we are trying to enable here).

@jlebon
Copy link
Member

jlebon commented May 14, 2021

Are you meaning kargs set via the harness (e.x. set via the qemu cmdline args) specifically for testing this feature? If so my plan was to just have it be an internal test, any other test that wants kargs can just add it to the Ignition config (as that's the user-facing happy path we are trying to enable here).

Heh right sorry, I got mixed up. Obviously, since this is in the Ignition config now (that was the whole point!) it shouldn't need any more work in the kola harness for external tests. So adding a test for this here should be pretty trivial. Something like:

diff --git a/tests/kola/ignition/kargs/config.ign b/tests/kola/ignition/kargs/config.ign
new file mode 100644
index 0000000..3d6d859
--- /dev/null
+++ b/tests/kola/ignition/kargs/config.ign
@@ -0,0 +1,9 @@
+{
+  "ignition": {
+    "version": "3.3.0-experimental"
+  },
+  "kernelArguments": {
+    "shouldExist": "foobar",
+    "shouldNotExist": "mitigations=auto,nosmt"
+  }
+}
diff --git a/tests/kola/ignition/kargs/test.sh b/tests/kola/ignition/kargs/test.sh
new file mode 100755
index 0000000..a753525
--- /dev/null
+++ b/tests/kola/ignition/kargs/test.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -xeuo pipefail
+
+ok() {
+    echo "ok" "$@"
+}
+
+fatal() {
+    echo "$@" >&2
+    exit 1
+}
+
+if ! grep foobar /proc/cmdline; then
+    fatal "missing foobar in kernel cmdline"
+fi
+if grep mitigations /proc/cmdline; then
+    fatal "found mitigations in kernel cmdline"
+fi
+ok "Ignition kargs"

WDYT?

Cool with an internal test if you prefer, though we're trying to move towards external tests when possible. A nice advantage for example is that we can then test the code added here in CI before merging. But again, feel free to self-merge if you want to do this in kola proper or as a follow-up.

@arithx
Copy link
Contributor Author

arithx commented May 14, 2021

Cool with an internal test if you prefer, though we're trying to move towards external tests when possible. A nice advantage for example is that we can then test the code added here in CI before merging. But again, feel free to self-merge if you want to do this in kola proper or as a follow-up.

My thought on an internal test was so that we could also test the shouldNotExist by adding a karg from the harness side and removing it w/ Ignition but the nosmt one would work.

@arithx
Copy link
Contributor Author

arithx commented May 14, 2021

Went ahead and pushed with your patch (and added you as a co-author of the commit).

@jlebon
Copy link
Member

jlebon commented May 14, 2021

[2021-05-14T19:33:52.998Z] 2021-05-14T19:33:52Z platform/conf: invalid userdata: error at line 6 col 28: json: cannot unmarshal string into Go struct field KernelArguments.kernelArguments.shouldExist of type []types.KernelArgument
[2021-05-14T19:33:52.998Z] Error: Parsing config.ign: config is not valid
[2021-05-14T19:33:52.998Z] 2021-05-14T19:33:52Z cli: Parsing config.ign: config is not valid

Ahh right OK, this does still require teaching the new spec to kola like we did here. I think we'll need that anyway eventually, though OK to not block on that.

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
@arithx
Copy link
Contributor Author

arithx commented May 14, 2021

[2021-05-14T19:33:52.998Z] 2021-05-14T19:33:52Z platform/conf: invalid userdata: error at line 6 col 28: json: cannot unmarshal string into Go struct field KernelArguments.kernelArguments.shouldExist of type []types.KernelArgument
[2021-05-14T19:33:52.998Z] Error: Parsing config.ign: config is not valid
[2021-05-14T19:33:52.998Z] 2021-05-14T19:33:52Z cli: Parsing config.ign: config is not valid

Ahh right OK, this does still require teaching the new spec to kola like we did here. I think we'll need that anyway eventually, though OK to not block on that.

That was actually an error in the tests Ignition config (it was passing a string to shouldExist/shouldNotExist instead of a list of strings).

Ignition 2.10.1 was vendored into mantle in coreos/coreos-assembler#2165

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[2021-05-14T20:38:04.936Z] --- PASS: ext.config.ignition.kargs (37.22s)

Awesome! 🎉

@lucab
Copy link
Contributor

lucab commented Jun 28, 2021

I'm not exactly sure what's going on, but I'm now seeing the following in FCOS build logs:

dracut: *** Including module: coreos-ignition ***
mv: cannot remove '/usr/lib/dracut/modules.d/35coreos-ignition/coreos-kargs.sh': Read-only file system

jlebon added a commit to jlebon/fedora-coreos-config that referenced this pull request Jun 28, 2021
We can't `mv` out of the module directory since `/usr` is mounted
read-only in the dracut container when rpm-ostree runs it.

Follow up to coreos#938.

Reported-by: Luca BRUNO <luca.bruno@coreos.com>
@jlebon
Copy link
Member

jlebon commented Jun 28, 2021

Thanks, follow-up in #1076.

jlebon added a commit that referenced this pull request Jun 28, 2021
We can't `mv` out of the module directory since `/usr` is mounted
read-only in the dracut container when rpm-ostree runs it.

Follow up to #938.

Reported-by: Luca BRUNO <luca.bruno@coreos.com>
c4rt0 pushed a commit to c4rt0/fedora-coreos-config that referenced this pull request Mar 27, 2023
docs: Split misc notes into its own page
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
We can't `mv` out of the module directory since `/usr` is mounted
read-only in the dracut container when rpm-ostree runs it.

Follow up to coreos#938.

Reported-by: Luca BRUNO <luca.bruno@coreos.com>
HuijingHei pushed a commit to HuijingHei/fedora-coreos-config that referenced this pull request Oct 10, 2023
We can't `mv` out of the module directory since `/usr` is mounted
read-only in the dracut container when rpm-ostree runs it.

Follow up to coreos#938.

Reported-by: Luca BRUNO <luca.bruno@coreos.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants