Skip to content

Comments

fix(ci): add error handling for GitHub API in upgrade-test.yml. #12876

Open
Priyanshu-u07 wants to merge 1 commit intokubeflow:masterfrom
Priyanshu-u07:upgrade-test-error
Open

fix(ci): add error handling for GitHub API in upgrade-test.yml. #12876
Priyanshu-u07 wants to merge 1 commit intokubeflow:masterfrom
Priyanshu-u07:upgrade-test-error

Conversation

@Priyanshu-u07
Copy link
Contributor

@Priyanshu-u07 Priyanshu-u07 commented Feb 22, 2026

Description of your changes:

The "Get last release tag" step in [upgrade-test.yml] calls the GitHub API with no error handling. If the API fails (rate limiting, timeout, or outage), lastRelease becomes empty or "null", causing the deploy step to fail with a confusing Kubernetes error.

This PR adds:

  • Retry logic (3 attempts with 5s delay)
  • Validation for empty and "null" responses
  • Clear ::error:: annotation and exit 1 on failure

Fixes #12875
Checklist:

Copilot AI review requested due to automatic review settings February 22, 2026 19:50
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hbelmiro for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
Copy link

Hi @Priyanshu-u07. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Priyanshu-u07 Priyanshu-u07 changed the title test: add error handling for GitHub API in upgrade-test.yml. Fixes #12875 test: add error handling for GitHub API in upgrade-test.yml. Feb 22, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds explicit failure handling to the “Get last release tag” step in the upgrade test GitHub Actions workflow so the pipeline fails early with a clear error when the GitHub Releases API cannot provide a valid tag.

Changes:

  • Wrap GitHub Releases API fetch in a 3-attempt retry loop with delay.
  • Validate tag_name is non-empty and not "null", otherwise emit ::error:: and exit non-zero.

Copy link
Contributor

@jeffspahr jeffspahr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: Error handling for GitHub API in upgrade-test.yml

Overview

Adds retry logic (3 attempts, 5s delay), response validation, and auth to the "Get last release tag" step in the upgrade test workflow. Previously, a failed API call would silently produce an empty/null tag, causing a confusing downstream kubectl failure.

Assessment: Looks good overall

This is a sensible, low-risk improvement. A few minor notes:

Minor Issues

  1. -L (follow redirects) was dropped. The original curl flags were -sSL; the new version uses -sS. While the GitHub releases API endpoint is unlikely to redirect, the -L flag was there for a reason and removing it is an unnecessary behavioral change. Add it back:

    curl -sSL --fail-with-body --connect-timeout 10 --max-time 60 \
    
  2. Pipeline exit code masking. The construct:

    lastRelease=$(curl ... | jq -r .tag_name 2>/dev/null || echo "")

    If curl succeeds but returns an error JSON body (e.g. rate limit response {"message":"API rate limit exceeded"...}), jq -r .tag_name will output null (since there's no tag_name field), which is caught by the validation. So this works correctly — just noting it's not immediately obvious.

  3. Auth token is a good addition. Using ${{ github.token }} raises the rate limit from 60/hr (unauthenticated) to 1,000/hr, which addresses the most likely failure mode. This is the most impactful part of the PR.

Nits

  • The PR title says test: but the conventional commit format in this repo typically uses chore: or fix(ci): for workflow changes. Looking at the repo's commit history, fix or chore would be more consistent for CI fixes.

Verdict

Clean, focused improvement. Add back the -L flag and this is good to go.

Signed-off-by: Priyanshu-u07 <connect.priyanshu8271@gmail.com>
@google-oss-prow
Copy link

New changes are detected. LGTM label has been removed.

@Priyanshu-u07 Priyanshu-u07 changed the title test: add error handling for GitHub API in upgrade-test.yml. fix(ci): add error handling for GitHub API in upgrade-test.yml. Feb 23, 2026
@Priyanshu-u07
Copy link
Contributor Author

@jeffspahr I have addressed the feedback and updated the PR title.
Could you please re-LGTM when convenient?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] upgrade-test.yml has no error handling when GitHub API fails

2 participants