fix: handle repos with different release branch naming in crd-schema-checker#1897
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1897 +/- ##
==========================================
- Coverage 80.44% 80.29% -0.16%
==========================================
Files 51 51
Lines 2598 2598
==========================================
- Hits 2090 2086 -4
- Misses 385 387 +2
- Partials 123 125 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
264041e to
ef9a370
Compare
| previous_branch=$(git branch -r | grep -E 'origin/release-[0-9]+\.[0-9]+$' | | ||
| sed 's|.*origin/||' | sort -V | | ||
| awk -v target="$current_branch" '$0 == target { print prev; exit } { prev = $0 }') | ||
| elif [[ -n "${PREVIOUS_VERSION:-}" ]]; then |
There was a problem hiding this comment.
As PREVIOUS_VERSION is not used anymore anywhere in this script it probably does not make sense to pass this variable to this script in the Makefile.
| awk -v target="$current_branch" '$0 == target { print prev; exit } { prev = $0 }') | ||
| elif [[ -n "${PREVIOUS_VERSION:-}" ]]; then | ||
| previous_branch="release-$(echo "${PREVIOUS_VERSION}" | cut -f1,2 -d'.')" | ||
| elif [[ -n "${PREVIOUS_BRANCH:-}" ]]; then |
There was a problem hiding this comment.
PREVIOUS_BRANCH is not described anywhere, maybe a short help would be good for this script.
There was a problem hiding this comment.
Added a note about PREVIOUS_BRANCH use
Because the change was merged 3 weeks ago and we have been dealing with the sync error since then |
…checker When PREVIOUS_VERSION is set but the derived branch (e.g. release-1.29) doesn't exist in the cloned repo, fall back to the latest available release-* branch instead of failing. This supports downstream repos that use a different naming convention (e.g. release-3.x). Also add a PREVIOUS_BRANCH env var for callers that need to specify the exact previous branch name explicitly. Fixes the lint-crds failure in openshift-service-mesh/sail-operator sync PRs where the repo uses release-3.x naming. Signed-off-by: Francisco Herrera <fjglira@gmail.com>
ef9a370 to
4aa0787
Compare
|
/retest |
1 similar comment
|
/retest |
| sed 's|.*origin/||' | sort -V | tail -1) | ||
| if [[ -z "$previous_branch" ]]; then | ||
| echo "No release branches found. Skipping." | ||
| exit 0 |
There was a problem hiding this comment.
Maybe we should exit with error? If this should catch problems, we should not silently skip the test if the branch is not found
Adding exit error when No releases branches found Signed-off-by: Francisco Herrera <fjglira@gmail.com>
* upstream/main: (41 commits) fix: handle repos with different release branch naming in crd-schema-checker (istio-ecosystem#1897) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1899) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1896) Fix test docs test failure (istio-ecosystem#1890) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1892) Skip processing aliases referencing pre-released versions in EOL updater (istio-ecosystem#1883) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1886) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1884) Fixing two problems with our hack/update-istio.sh script (istio-ecosystem#1882) test: Modify await_operator to dinamically get deployment name from csv when OLM is true (istio-ecosystem#1874) Update update-deps flow with 1.30 and remove 1.27 branch (istio-ecosystem#1875) tests: Skip TLS profile change test when is executed on Hosted clusters (istio-ecosystem#1873) Add 1.30.0-alpha.2 charts (istio-ecosystem#1854) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1872) Using crane instead of skopeo which is not available in the build-tools (istio-ecosystem#1870) Sync min tls version from `TLSConfig` to `Istio` (istio-ecosystem#1859) Fix serves metrics securely test (istio-ecosystem#1860) refactor: vendor kubernetes manifests into the repo (istio-ecosystem#1853) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1856) Modify "download-charts" script for alpha/beta releases (istio-ecosystem#1852) ...
* upstream/main: (41 commits) fix: handle repos with different release branch naming in crd-schema-checker (istio-ecosystem#1897) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1899) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1896) Fix test docs test failure (istio-ecosystem#1890) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1892) Skip processing aliases referencing pre-released versions in EOL updater (istio-ecosystem#1883) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1886) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1884) Fixing two problems with our hack/update-istio.sh script (istio-ecosystem#1882) test: Modify await_operator to dinamically get deployment name from csv when OLM is true (istio-ecosystem#1874) Update update-deps flow with 1.30 and remove 1.27 branch (istio-ecosystem#1875) tests: Skip TLS profile change test when is executed on Hosted clusters (istio-ecosystem#1873) Add 1.30.0-alpha.2 charts (istio-ecosystem#1854) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1872) Using crane instead of skopeo which is not available in the build-tools (istio-ecosystem#1870) Sync min tls version from `TLSConfig` to `Istio` (istio-ecosystem#1859) Fix serves metrics securely test (istio-ecosystem#1860) refactor: vendor kubernetes manifests into the repo (istio-ecosystem#1853) Automator: Update dependencies in istio-ecosystem/sail-operator@main (istio-ecosystem#1856) Modify "download-charts" script for alpha/beta releases (istio-ecosystem#1852) ...
We are getting failures in a fork after the changes were made to the linter on this PR
Issue
When not on a release branch, the script previously derived the comparison branch from
PREVIOUS_VERSION(e.g.release-1.29). This broke in repos that use a different naming convention (e.g. forks of repos usingrelease-3.x), and also meant the pinned value could go stale as new releases were cut.This change aligns the non-release-branch case with the release-branch case, which already auto-detects the relevant branch via
sort -V. When not on a release branch, the script now always uses the latest availablerelease-*branch. APREVIOUS_BRANCHenv var is also added as an explicit override when needed.Behavior by scenario
release-1.30release-1.29✓mainrelease-1.29(pinned, potentially stale)release-1.30(latest) ✓mainrelease-1.29not foundrelease-3.3.2✓Assisted by @claude