-
Notifications
You must be signed in to change notification settings - Fork 355
Fix: Permit running make propagate-manifests from any directory
#1256
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| #!/bin/bash | ||
| #!/usr/bin/env bash | ||
| set -eEu | ||
| trap 's=$?; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR | ||
|
|
||
| set -e | ||
| DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" | ||
| cd "$DIR/.." | ||
|
|
||
| FROM_BRANCH="master" | ||
| SKIP_MAKE=false | ||
|
|
@@ -41,18 +44,17 @@ mkdir -p /tmp/argocd-operator-hack | |
|
|
||
| git clone --depth 1 --branch "$FROM_BRANCH" --single-branch --no-tags https://github.com/argoproj-labs/argocd-operator.git /tmp/argocd-operator-hack/ | ||
|
|
||
| changedFiles=$(diff -qr /tmp/argocd-operator-hack/config/crd/bases/ ../config/crd/bases/ | grep -v argoproj.io_argocdexports.yaml | grep differ | awk -F ' ' '{print $2}') | ||
| changedFiles=$(diff -qr /tmp/argocd-operator-hack/config/crd/bases/ ./config/crd/bases/ | grep -v argoproj.io_argocdexports.yaml | grep differ | awk -F ' ' '{print $2}') | ||
|
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. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
bash -n hack/propagate.sh
rg -n 'changedFiles|cp ' hack/propagate.sh
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
mkdir "$tmp/out"
touch "$tmp/source one.yaml" "$tmp/source-two.yaml"
files=("$tmp/source one.yaml" "$tmp/source-two.yaml")
cp -- "${files[@]}" "$tmp/out/"
test -f "$tmp/out/source one.yaml"Repository: redhat-developer/gitops-operator Length of output: 444 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- hack/propagate.sh ---'
sed -n '1,90p' hack/propagate.sh
printf '%s\n' '--- kustomization references ---'
rg -n -C 3 'config/crd/bases|argocdexports|propagate' config/crd/kustomization.yaml Makefile hack || true
printf '%s\n' '--- current CRD filenames ---'
find config/crd/bases -maxdepth 1 -type f -printf '%f\n' | sortRepository: redhat-developer/gitops-operator Length of output: 4693 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
mkdir -p "$tmp/src" "$tmp/dst"
printf x > "$tmp/src/source one.yaml"
printf x > "$tmp/src/source-two.yaml"
printf x > "$tmp/dst/source one.yaml"
printf x > "$tmp/dst/source-two.yaml"
printf '%s\n' '--- diff output for whitespace-containing paths ---'
diff -qr "$tmp/src/" "$tmp/dst/" || true
printf '%s\n' '--- behavior of the exact extraction pipeline ---'
changedFiles=$(diff -qr "$tmp/src/" "$tmp/dst/" | grep -v argoproj.io_argocdexports.yaml | grep differ | awk -F ' ' '{print $2}' || true)
printf 'changedFiles=<%q>\n' "$changedFiles"
printf '%s\n' '--- behavior with a changed whitespace-containing path ---'
printf y > "$tmp/dst/source one.yaml"
diff_output=$(diff -qr "$tmp/src/" "$tmp/dst/" || true)
printf '%s\n' "$diff_output"
changedFiles=$(printf '%s\n' "$diff_output" | grep -v argoproj.io_argocdexports.yaml | grep differ | awk -F ' ' '{print $2}')
printf 'changedFiles=<%q>\n' "$changedFiles"Repository: redhat-developer/gitops-operator Length of output: 492 Preserve changed CRD paths as separate arguments. Line 47 truncates whitespace-containing paths, and line 56 performs word splitting and pathname expansion. Store paths in a Bash array, then run 🤖 Prompt for AI AgentsSources: Path instructions, Linters/SAST tools
Collaborator
Author
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. I am fully aware, I prefer 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.
You are interacting with an AI system. |
||
|
|
||
| echo "Changed Files" | ||
| echo $changedFiles | ||
| echo "$changedFiles" | ||
|
|
||
| if [ -z "$changedFiles" ] | ||
| then | ||
| echo "No difference found" | ||
| else | ||
| cp ${changedFiles} ../config/crd/bases/ | ||
| cp ${changedFiles} ./config/crd/bases/ | ||
| if [ "$SKIP_MAKE" = false ]; then | ||
| cd .. | ||
| make bundle | ||
| else | ||
| echo "Skipping 'make bundle' (--skip-make specified)" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: redhat-developer/gitops-operator
Length of output: 188
🏁 Script executed:
Repository: redhat-developer/gitops-operator
Length of output: 4625
🏁 Script executed (no clone):
Length of output: 656
Propagate failures from the
diffpipeline.set -eEudoes not enablepipefail. The pipeline at line 47 can return success afterdiffreturns an error becauseawkis the final command. The script can then report no difference and leaveconfig/crd/basesstale.Enable
pipefail, but handlediffstatus 1 as the expected “files differ” result. Treat statuses greater than 1 as errors.🤖 Prompt for AI Agents
Source: Path instructions
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.
I am fully aware, I prefer
pipefailwhere I could. But this would require larger rewrite.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.
@olivergondza, understood. The current change stays focused on execution-directory handling. Thepipefailanddiffstatus handling can be addressed separately if you choose to expand the script error-handling scope.🐇
You are interacting with an AI system.