Skip to content

chore: bump golang from 0afe9b5 to 6d4e5e7 #801

chore: bump golang from 0afe9b5 to 6d4e5e7

chore: bump golang from 0afe9b5 to 6d4e5e7 #801

on:
pull_request:
branches:
- "master"
- "v*.x"
jobs:
wait-for-ci:
if: startsWith(github.event.pull_request.title, 'cicd:') && github.actor == 'nvidia-ci-cd'
runs-on: ubuntu-24.04
timeout-minutes: 180
permissions:
pull-requests: read
checks: read
statuses: read
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Wait for CI checks
# We skip the checks for GA release PRs, as they refer to not yet available images and will fail the CI.
# All the functionality was tested with the previous release candidate, so these checks are not mandatory.
if: (!startsWith(github.head_ref, 'staging')) || contains(github.head_ref, 'beta') || contains(github.head_ref, 'rc')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
CURRENT_JOB_NAME: wait-for-ci
REQUIRED_CHECKS: |
nic_operator_helm CI
nic_operator_kind CI
image_scan CI
Copy Right Validation
WAIT_INTERVAL: 60
run: |
echo "Waiting $WAIT_INTERVAL seconds for checks to start..."
sleep $WAIT_INTERVAL
mapfile -t REQUIRED_CHECKS_ARRAY < <(echo "$REQUIRED_CHECKS" | grep -v '^\s*$')
while true; do
echo "Fetching checks for PR #$PR_NUMBER..."
CHECKS_OUTPUT=$(gh pr checks "$PR_NUMBER" --json name,state)
for CHECK in "${REQUIRED_CHECKS_ARRAY[@]}"; do
if ! echo "$CHECKS_OUTPUT" | jq -e ".[] | select(.name == \"$CHECK\")" >/dev/null; then
echo "Required check '$CHECK' not found. Waiting $WAIT_INTERVAL seconds..."
sleep $WAIT_INTERVAL
fi
done
# Exit immediately if any check fails
FAILED_CHECKS=$(echo "$CHECKS_OUTPUT" | jq -r '.[] | select(.state == "FAILURE") | .name')
if [[ -n "$FAILED_CHECKS" ]]; then
echo "The following checks have failed:"
echo "$FAILED_CHECKS"
exit 1
fi
# Verify all checks are either SUCCESS or SKIPPED
INCOMPLETE_CHECKS=$(echo "$CHECKS_OUTPUT" | jq -r '.[] | select(.name != env.CURRENT_JOB_NAME) | select(.state != "SUCCESS" and .state != "SKIPPED") | .name')
if [[ -z "$INCOMPLETE_CHECKS" ]]; then
echo "All checks have succeeded or are skipped."
break
else
echo "Waiting $WAIT_INTERVAL seconds for the following checks to complete successfully:"
echo "$INCOMPLETE_CHECKS"
sleep $WAIT_INTERVAL
fi
done
merge-release-pr:
needs:
- wait-for-ci
if: startsWith(github.event.pull_request.title, 'cicd:')
runs-on: ubuntu-24.04
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
PR_NUMBER: ${{ github.event.number }}
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: .
- run: |
# Check if PR is open before attempting to merge
PR_STATE=$(gh pr view $PR_NUMBER --json state -q .state)
if [ "$PR_STATE" = "OPEN" ]; then
# There are branch protection rules in place, to override them, we need to pass --admin option
gh pr merge $PR_NUMBER --merge --delete-branch --admin
else
echo "PR #$PR_NUMBER is not open (current state: $PR_STATE). Skipping merge."
exit 1
fi
SOURCE_BRANCH=$(gh pr view $PR_NUMBER --json headRefName -q .headRefName)
TARGET_BRANCH=$(gh pr view $PR_NUMBER --json baseRefName -q .baseRefName)
if [[ "$SOURCE_BRANCH" =~ ^staging- ]]; then
# Extract version from staging branch name (staging-v25.4.0-rc.1 -> v25.4.0-rc.1)
VERSION=${SOURCE_BRANCH#staging-}
echo "Creating release: $VERSION"
echo "Target branch (release source): $TARGET_BRANCH"
# Determine if this is a pre-release (has '-' after version numbers)
if echo $VERSION | grep '-'; then
PRERELEASE_FLAG="--prerelease"
echo "Detected pre-release version: $VERSION"
else
PRERELEASE_FLAG=""
echo "Detected GA version: $VERSION"
fi
# Create GitHub release with auto-generated notes
gh release create "$VERSION" \
--target "$TARGET_BRANCH" \
--title "Release $VERSION" \
--generate-notes \
$PRERELEASE_FLAG
echo "Successfully created GitHub release: $VERSION"
# Find and close related GitHub issue
echo "Searching for GitHub issue with version: $VERSION"
ISSUE_NUMBER=$(gh issue list --search "$VERSION in:title" --state open --json number --jq '.[0].number' || echo "")
if [ -n "$ISSUE_NUMBER" ] && [ "$ISSUE_NUMBER" != "null" ]; then
echo "Found issue #$ISSUE_NUMBER for version $VERSION. Closing it..."
gh issue close "$ISSUE_NUMBER" --comment "Closed automatically after releasing $VERSION"
echo "Successfully closed issue #$ISSUE_NUMBER"
else
echo "No open issue found for version $VERSION"
fi
else
echo "Not creating release - source branch is not staging-*"
fi