CFE-4708: Added support for a path-augment to specify files to ship beyond the extension-matching - #3204
CFE-4708: Added support for a path-augment to specify files to ship beyond the extension-matching#3204SimonThalvorsen wants to merge 2 commits into
Conversation
|
Thank you for submitting a pull request! Maybe @nickanderson can review this? |
7145e8f to
0d255e6
Compare
nickanderson
left a comment
There was a problem hiding this comment.
No ticket in the commit subject, that's for the PR.
I am not sure about this.
I understand that you are adding a file path to the files distributed in update.
- This is a fully qualified file path? Can you give an example of what values a user would be expected to use here?
- You say these files would be updated each time, regardless of validated_updates_ready, so these files could update but the rest of the policy could be skipped?
I am not certain that the hashing in but that only worked for the initial copy, so if the project got rebuilt with the same files(but different content) only the .sh (and assumes .txt, .cf and other accepted extensions) would get marked as changed and the client got the new content, but keeping the old, unchanged version of the other files. The usage is intended for files added by cfbs input-type-file, where the supplied files may not match what is set inside |
I would remove git from the equation initially. Edit files in /var/cfengine/masterfiles on a hub and understand that basic flow first. |
0d255e6 to
6d1c917
Compare
… extension-matching Ticket: CFE-4708 Changelog: Added `input_paths_extra` to allow specified files to ship independent of what is specified in `input_name_patterns[_extra]` Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
6d1c917 to
9d146d0
Compare
| # reopens on new hub-side changes, so a brand-new entry | ||
| # introduced in the same run that opens the gate isn't loaded | ||
| # into memory yet (it lands in def.json partway through that | ||
| # run?) and will be stuck until a second, unrelated | ||
| # run reopens the gate again. |
There was a problem hiding this comment.
So this is still a work in progress, but the current issue is mainly this
Files that get added by the def.json only gets copied over on the 2nd run of update.cf, I assume this is the staleness as described in this comment, but not certain. If the file already exists, then update/update_policy fetches and copies without problems
There was a problem hiding this comment.
I don't think it should behave this way (copying the files each time).
If you move the class guard to if => directly on the promise, the promise will only be in the context of a validated policy update which also has these extra files enabled.
There are two separate flows ... one where masterfiles is from a git repo and when thats the case cf_promises_release_id is the git commit hash. When its not git backed that id is computed from a tree hash in core. That tree hash I think only coveres specific files but I think that is probably wrong and should probably consider all files, just like git would.
nickanderson
left a comment
There was a problem hiding this comment.
I will push a change to your pr here lmk how that works for you
| slist => filter( | ||
| "^.*\.\..*$", "update_def.input_paths_extra", "true", "true", 999 | ||
| ), | ||
| comment => "input_paths_extra with any entries containing a '..' |
There was a problem hiding this comment.
concat() line broken comment => values.
| # reopens on new hub-side changes, so a brand-new entry | ||
| # introduced in the same run that opens the gate isn't loaded | ||
| # into memory yet (it lands in def.json partway through that | ||
| # run?) and will be stuck until a second, unrelated | ||
| # run reopens the gate again. |
There was a problem hiding this comment.
I don't think it should behave this way (copying the files each time).
If you move the class guard to if => directly on the promise, the promise will only be in the context of a validated policy update which also has these extra files enabled.
There are two separate flows ... one where masterfiles is from a git repo and when thats the case cf_promises_release_id is the git commit hash. When its not git backed that id is computed from a tree hash in core. That tree hash I think only coveres specific files but I think that is probably wrong and should probably consider all files, just like git would.
Move the input_paths_extra copy promise under the existing am_policy_hub|validated_updates_ready class guard instead of running unconditionally. The validated_updates_ready gate opens whenever cf_promises_validated is updated, which happens any time the hub detects file changes in inputs (via IsNewerFileTree), regardless of whether those files are in the release hash. This preserves the atomic update model without requiring the bypass. Also use concat() for multi-line comment attributes per review.
Ticket: CFE-4708
Changelog: Added
input_paths_extrato allow specified files to ship independent of what is specified ininput_name_patterns[_extra]