-
Notifications
You must be signed in to change notification settings - Fork 315
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
Allow images tagged latest to update on each run #468
Allow images tagged latest to update on each run #468
Conversation
Restore the code to update images tagged with 'latest' on each run, moving this to be guarded by a refreshonly meta-parameter that is triggered by a notify resource that is disabled for 'noop'. Because the original code to update images was run via 'onlyif' to indicate if the image was in sync by performing a pull and testing the new digest against the old, this meant that simply applying 'noop' to this exec resource would not work. 'noop' does not affect running the components of a resource to validate if it is in-sync, which is the purpose of the 'onlyif' & 'unless' settings for an exec. To support 'noop' mode, previously the code to update the image on each run was dropped to prevent it accidentally refreshing the local image and then skipping an image restart because there was no update event on a subsequent real run. To resolve, it is necessary to have a prior resource that is used as a proxy, and only when it notifies the image update resource, will the 'onlyif' action be tested to determine if in sync. This prior resource can be disabled from a noop run, and subsequently although puppet records that it would send a refresh event in 'noop' mode, none are actually sent during a 'noop' run thus preventing the image from being updated by a side effect of checking if the notified exec was in-sync. Fixes puppetlabs#316
What I'm not sure about for this change, is whether it's possible to spec test the noop mode to make sure the behaviour is not broken in the future. Testing locally - initial state
Build and published an updated image to my local registry (192.168.32.1 refers to my host machine used by my test vagrant-libvirt VMs)
The message about Confirm that it's not actually been updated
Perform the same puppet agent run without
Confirm it is now updated
|
@davejrt is this PR a reasonable approach to fixing the issue referenced in #316 ? Any suggestions on whether there is a good acceptance test possible for this? I'm thinking the only way would involve the following steps:
Not sure how to run the registry without conflicting with a user running another local instance in a consistent manner. Maybe run it in the acceptance VM and push the image to it that way? Or is this over-doing trying to test this? |
Hi @electrofelix this looks good to me, and regarding your test that may be considered overkill, however logical it may be. I'm no longer a core maintainer on the module so I'll tag in @carabasdaniel to have someone triage the PR for you so that group of people are aware of any PR's. Thanks for your contribution |
👍 LGTM |
Restore the code to update images tagged with 'latest' on each run,
moving this to be guarded by a refreshonly meta-parameter that is
triggered by a notify resource that is disabled for 'noop'.
Because the original code to update images was run via 'onlyif' to
indicate if the image was in sync by performing a pull and testing the
new digest against the old, this meant that simply applying 'noop' to
this exec resource would not work. 'noop' does not affect running the
components of a resource to validate if it is in-sync, which is the
purpose of the 'onlyif' & 'unless' settings for an exec.
To support 'noop' mode, previously the code to update the image on each
run was dropped to prevent it accidentally refreshing the local image
and then skipping an image restart because there was no update event on
a subsequent real run.
To resolve, it is necessary to have a prior resource that is used as a
proxy, and only when it notifies the image update resource, will the
'onlyif' action be tested to determine if in sync. This prior resource
can be disabled from a noop run, and subsequently although puppet
records that it would send a refresh event in 'noop' mode, none are
actually sent during a 'noop' run thus preventing the image from being
updated by a side effect of checking if the notified exec was in-sync.
Fixes #316