-
Notifications
You must be signed in to change notification settings - Fork 522
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
bootstrap-containers: prevent bootstrap containers from restarting #1508
bootstrap-containers: prevent bootstrap containers from restarting #1508
Conversation
Aren't some bootstrap containers intended to run on every boot? Would this prevent that behavior? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👢
|
||
[Service] | ||
Type=oneshot | ||
EnvironmentFile=/etc/bootstrap-containers/%i.env | ||
# Create a sentinel file to mark that we've ran | ||
ExecStart=/usr/bin/mkdir -p /run/bootstrap-containers/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I have a slight preference to do this mkdir
via bootstrap-containers-tmpfiles.conf
so we don't repeat the work for N bootstrap containers.
@@ -7,10 +7,17 @@ Wants=host-containers.service | |||
# started by systemd | |||
RefuseManualStart=true | |||
RefuseManualStop=true | |||
# If a sentinel file exists for this bootstrap container, it means we should skip | |||
# since we've ran this bootstrap container already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wording
# since we've ran this bootstrap container already. | |
# since we've run this bootstrap container already. |
The tracking file is in |
Nit: In your commit message:
Should be "create". |
fd9b40b
to
6075474
Compare
Push above addresses comments by @arnaldo2792 and @bcressey Tested things and they still work as expected. |
bootstrap-containers@ units create a sentinel file when they first run. If the sentinel file exists, the unit will be skipped over. This will prevent non-essential bootstrap-containers from being restarted by systemd when multi-user.target is reached.
6075474
to
2f1530a
Compare
Push above fixes another grammar error. English is hard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛵
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤶
Issue number:
Fixes #1488
Description of changes:
Testing done:
I launched an instance with the following in my userdata:
The instance comes up find. The host reaches
multi-user.target
successfully.All target units are active at the end. The bootstrap container unit statuses are as expected.
bootstrap-containers@bear:
bootstrap-containers@test:
The invalid bootstrap container is only started once then skipped over when
activate-multi-user.service
runs.journal:
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.