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

Kit changes for Bootstrap Commands #62

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

piyush-jena
Copy link
Contributor

@piyush-jena piyush-jena commented Aug 1, 2024

Issue number:

Closes #

Description of changes:
This PR contains core-kit changes to add bootstrap-commands. The relevant settings-sdk changes are in PR 46

Testing done:
Test case 1: 2 bootstrap commands

[settings.bootstrap-commands."002-test-bootstrap-commands"]
commands = [["apiclient", "set", "motd=helloworld2"], ["apiclient", "set", "motd=helloworld3"]]
mode = "once"
essential = true

[settings.bootstrap-commands."001-test-bootstrap-commands"]
commands = [["apiclient", "set", "motd=helloworld1"]]
mode = "always"
essential = true

first boot sets motd to helloworld3
second boot sets motd to helloworld1

Test case 2: No bootstrap commands
No boot issues.

Note:
3 files have been modified to build successfully. "sources/api/Cargo.toml", "sources/deny.toml", "sources/Cargo.lock". These are dependent on the settings-sdk changes in PR 46. They will be reverted back at the end of code review.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

packages/os/bootstrap-commands.service Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/Cargo.toml Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/README.md Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
packages/os/bootstrap-commands-toml Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/api/schnauzer/src/helpers.rs Outdated Show resolved Hide resolved
packages/os/bootstrap-commands-toml Outdated Show resolved Hide resolved
packages/os/bootstrap-commands-toml Outdated Show resolved Hide resolved
@cbgbt
Copy link
Contributor

cbgbt commented Aug 20, 2024

It seems to work on the handlebars playground, other than the unusual URL encoding. Also seems to parse properly per this site.

I figured out the encoding bit. Apparently handlebars HTML-encodes data by default with the "double-stache". If you "triple-stache", it embeds it directly.

@piyush-jena piyush-jena force-pushed the develop branch 2 times, most recently from 905f136 to 6fc04f4 Compare August 23, 2024 22:51
@piyush-jena piyush-jena force-pushed the develop branch 9 times, most recently from 8d28192 to 32b7b73 Compare August 31, 2024 06:03
@piyush-jena piyush-jena marked this pull request as ready for review August 31, 2024 07:33
packages/os/os.spec Outdated Show resolved Hide resolved
packages/os/os.spec Outdated Show resolved Hide resolved
packages/systemd/systemd.spec Outdated Show resolved Hide resolved
packages/systemd/systemd-logind.conf Outdated Show resolved Hide resolved
sources/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/bootstrap-commands/src/main.rs Show resolved Hide resolved
sources/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
sources/bootstrap-commands/src/main.rs Outdated Show resolved Hide resolved
@piyush-jena
Copy link
Contributor Author

Forced push addresses the following:

  1. Changes to sources/bootstrap-commands/README.md
  2. nit comments in sources/bootstrap-commands/main.rs
  3. Removes unnecessary Before=preconfigured.target in packages/os/bootstrap-commands.service

@piyush-jena
Copy link
Contributor Author

Forced push addresses the following:

  1. Split the commits to separate out schnauzer and bootstrap-commands changes.
  2. Moved drop-in config for logind from systemd.spec to release.spec

Copy link
Contributor

@cbgbt cbgbt left a comment

Choose a reason for hiding this comment

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

Nice work! It's probably worth documenting how reboots are handled -- that might be best on the website.

Comment on lines +64 to +67
fn iter(self) -> impl Iterator<Item = (Identifier, BootstrapCommand)> {
self.bootstrap_commands.into_iter()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine, but as a Rust tip, there's the IntoIter in std that you can implement for this behavior, which can make calling other APIs that expect IntoIter ergonomic.

@piyush-jena
Copy link
Contributor Author

forced push removes the hack commit to use the official settings-sdk

Copy link
Contributor

@arnaldo2792 arnaldo2792 left a comment

Choose a reason for hiding this comment

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

Nice job! 🎉

@piyush-jena piyush-jena merged commit 01c8295 into bottlerocket-os:develop Sep 4, 2024
2 checks passed
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