Move cleanup to separate provisioner, remove cleanup_image var #1036
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
Performing the cleanup steps within
install-worker.sh
is problematic, because they can only be skipped -- they can't be invoked separately from the rest ofinstall-worker.sh
. This is a pain for our GPU AMI template, for example.The
cleanup_image
var was added to the packer template in #522. The value is passed toinstall-worker.sh
as an environment variable,CLEANUP_IMAGE
, which toggles the removal of various bits from the resulting AMI.However, this variable doesn't actually work with our packer template; if you set its value to
false
, the build will fail. This is becausevalidate.sh
requires the cleanup steps to be run. This toggle would only make sense if you were usinginstall-worker.sh
in a custom packer template (which I assume is what folks are doing). However, I don't think it makes sense to allow cleanup to be disabled in the packer template that we publish, becausevalidate.sh
should never be optional in this template.Removing the variable from our template won't break users who are using
install-worker.sh
in a custom template and settingCLEANUP_IMAGE=false
. These users wouldn't include the newcleanup.sh
provisioner; so there is no functional change.This could break users who are directly modifying our packer template at build-time, such as setting
cleanup_image
tofalse
and then deleting thevalidate.sh
provisioner. This type of usage is inherently fragile and we can't always avoid breaking it. It shouldn't be difficult to resolve.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Testing Done
Before this change, this will fail:
After this change, this succeeds: