Repository navigation
fix(aws-pcs): keep needrestart guard in lock-step across CNG templates #1168
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -64,7 +64,28 @@ for prm in $params; do | |||||
| grep -q "\`$prm\`" docs/PARAMETERS.md || report "deploy-all parameter '$prm' is not documented in docs/PARAMETERS.md" | ||||||
| done | ||||||
|
|
||||||
| # 4. Same-file Markdown anchor links in README.md resolve to a real heading. | ||||||
| # 4. The needrestart/slurmd guard block must be byte-identical across the four | ||||||
| # CNG templates. It is hand-duplicated (no shared include), so an edit that | ||||||
| # lands in only some of the copies is exactly the drift this catches. | ||||||
| guard_extract() { # print the guard block: comment header through the log line | ||||||
| awk '/--- Protect running jobs from unattended-upgrades \/ needrestart ---/{p=1} | ||||||
| p{print} | ||||||
| p&&/pcs-needrestart-guard\.log/{exit}' "$1" | sed -E 's/^[[:space:]]+//' | ||||||
| } | ||||||
| ref=$(guard_extract assets/add-cng.yaml) | ||||||
| if [ -z "$ref" ]; then | ||||||
| report "needrestart guard block not found in assets/add-cng.yaml" | ||||||
| else | ||||||
| for t in add-cng-p5 add-cng-p6-b200 add-cng-p6-b300; do | ||||||
| other=$(guard_extract "assets/$t.yaml") | ||||||
| if [ "$other" != "$ref" ]; then | ||||||
| report "needrestart guard block in assets/$t.yaml differs from assets/add-cng.yaml (keep the four copies byte-identical):" | ||||||
| diff <(echo "$ref") <(echo "$other") | sed 's/^/ /' | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
| diff <(echo "$ref") <(echo "$other") | sed 's/^/ /' | |
| diff <(printf '%s\n' "$ref") <(printf '%s\n' "$other") | sed 's/^/ /' |
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.
The guard comparison strips all leading whitespace — worth noting it can't see relative intra-block indentation drift
guard_extractnormalizes each block withsed -E 's/^[[:space:]]+//'before comparing, which is the right call for the base indentation: the four templates legitimately nest the block at different depths, so a raw byte compare would false-positive. One side effect worth a comment — stripping all leading whitespace also blinds the check to relative indentation inside the block. If a future edit indented theNRCONFterminator, or switched<<'NRCONF'to the tab-stripping<<-'NRCONF'in only one template, the deployed heredoc would behave differently while this check still reported the blocks as identical. Nothing's wrong today (the block has no intentionally-indented content lines) — just worth naming the boundary so a later reader doesn't over-trust "byte-identical".