fix: version mismatch issue handled by replacing devel with correct tags#21385
Conversation
Signed-off-by: Anitha Natarajan <anataraj@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: anithapriyanatarajan The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Updates the payload-fetch/bundle-generation helper script to replace upstream "devel" placeholders with an upstream release tag derived from downstream release configuration, aiming to avoid version-label mismatches in the generated OLM bundle.
Changes:
- Adds logic to fetch downstream release config and resolve the latest matching upstream
tektoncd/operatorrelease tag for the configured upstream release branch. - Rewrites
"devel"placeholders in bundle manifests and kodata YAMLs (viased+ targetedyqedits). - Broadens the CSV
VERSIONenv override to update all matching containers.
Comments suppressed due to low confidence (2)
hack/operator-fetch-payload.sh:53
- The GitHub releases API call uses the default page size (30). For older upstream minor versions, the desired tag may not be present in the first page, causing UPSTREAM_VERSION_TAG to become empty and the script to fall back to "devel" (reintroducing the mismatch this PR is trying to fix). Consider requesting more results (e.g.
?per_page=100) and/or paging until a matching tag is found, and filtering out draft/prerelease releases so you don’t accidentally pick an RC tag as “latest”.
UPSTREAM_MINOR_VERSION=$(echo "${UPSTREAM_RELEASE_BRANCH}" | sed -E 's/^release-v([0-9]+\.[0-9]+)\.x$/\1/')
# Look up the latest release tag for this minor version from tektoncd/operator GitHub releases.
UPSTREAM_VERSION_TAG=$(curl -fsSL "https://api.github.com/repos/tektoncd/operator/releases" \
| yq e '.[] | select(.tag_name | test("^v?'"${UPSTREAM_MINOR_VERSION}"'\\.")) | .tag_name' - \
| sort -V | tail -n1 || true)
if [[ -z "${UPSTREAM_VERSION_TAG}" ]]; then
hack/operator-fetch-payload.sh:52
- UPSTREAM_MINOR_VERSION is derived with a sed replace that only works for branches matching
release-vX.Y.x. If the value inbranches.operator.upstreamis something else (e.g.main), the sed command returns the original string, and the subsequent tag lookup regex will never match, forcing a fallback to "devel" after an unnecessary API call. Consider explicitly detecting non-release-v*branches and short-circuiting to a known behavior (e.g. set UPSTREAM_VERSION_TAG="devel"), or validating the parsed minor version before querying GitHub.
UPSTREAM_RELEASE_BRANCH=$(echo "${HACK_RELEASE_CONFIG}" | yq e '.branches.operator.upstream' -)
if [[ -z "${UPSTREAM_RELEASE_BRANCH}" || "${UPSTREAM_RELEASE_BRANCH}" == "null" ]]; then
echo "WARN: 'branches.operator.upstream' not found in ${HACK_RELEASE_CONFIG_URL}, falling back to 'devel'"
UPSTREAM_VERSION_TAG="devel"
else
UPSTREAM_MINOR_VERSION=$(echo "${UPSTREAM_RELEASE_BRANCH}" | sed -E 's/^release-v([0-9]+\.[0-9]+)\.x$/\1/')
# Look up the latest release tag for this minor version from tektoncd/operator GitHub releases.
UPSTREAM_VERSION_TAG=$(curl -fsSL "https://api.github.com/repos/tektoncd/operator/releases" \
| yq e '.[] | select(.tag_name | test("^v?'"${UPSTREAM_MINOR_VERSION}"'\\.")) | .tag_name' - \
| sort -V | tail -n1 || true)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "Fetching downstream release config from ${HACK_RELEASE_CONFIG_URL}..." | ||
| HACK_RELEASE_CONFIG=$(curl -fsSL "${HACK_RELEASE_CONFIG_URL}" || true) | ||
| if [[ -z "${HACK_RELEASE_CONFIG}" ]]; then | ||
| echo "WARN: Failed to fetch ${HACK_RELEASE_CONFIG_URL}, falling back to 'devel'" | ||
| UPSTREAM_VERSION_TAG="devel" | ||
| else | ||
| UPSTREAM_RELEASE_BRANCH=$(echo "${HACK_RELEASE_CONFIG}" | yq e '.branches.operator.upstream' -) | ||
| if [[ -z "${UPSTREAM_RELEASE_BRANCH}" || "${UPSTREAM_RELEASE_BRANCH}" == "null" ]]; then | ||
| echo "WARN: 'branches.operator.upstream' not found in ${HACK_RELEASE_CONFIG_URL}, falling back to 'devel'" | ||
| UPSTREAM_VERSION_TAG="devel" | ||
| else | ||
| UPSTREAM_MINOR_VERSION=$(echo "${UPSTREAM_RELEASE_BRANCH}" | sed -E 's/^release-v([0-9]+\.[0-9]+)\.x$/\1/') | ||
| # Look up the latest release tag for this minor version from tektoncd/operator GitHub releases. | ||
| UPSTREAM_VERSION_TAG=$(curl -fsSL "https://api.github.com/repos/tektoncd/operator/releases" \ | ||
| | yq e '.[] | select(.tag_name | test("^v?'"${UPSTREAM_MINOR_VERSION}"'\\.")) | .tag_name' - \ | ||
| | sort -V | tail -n1 || true) | ||
| if [[ -z "${UPSTREAM_VERSION_TAG}" ]]; then | ||
| echo "WARN: No upstream tag found for minor version ${UPSTREAM_MINOR_VERSION} in tektoncd/operator releases, falling back to 'devel'" | ||
| UPSTREAM_VERSION_TAG="devel" | ||
| fi |
No description provided.