summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-04-03 17:40:08 +0200
committerGitHub <noreply@github.com>2026-04-03 17:40:08 +0200
commit0792a6b2b7ab32006ff45832a35de4536547cbd3 (patch)
tree21d19ec20117b697be3d20abbdf385099fdbc247 /.github
parentb476308dc3f64cb1b250b101568f49ab870b6bd1 (diff)
parentc5d27843772d9e4a3fd0e4b76e0fcfeb8cf6b7e6 (diff)
downloadvyos-1x-0792a6b2b7ab32006ff45832a35de4536547cbd3.tar.gz
vyos-1x-0792a6b2b7ab32006ff45832a35de4536547cbd3.zip
Merge pull request #5105 from kumvijaya/current
T8453: smoke test workflow updated to check branch match with vyos-build for checkout
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/package-smoketest.yml56
1 files changed, 48 insertions, 8 deletions
diff --git a/.github/workflows/package-smoketest.yml b/.github/workflows/package-smoketest.yml
index 6c933f93f..2a45b7e27 100644
--- a/.github/workflows/package-smoketest.yml
+++ b/.github/workflows/package-smoketest.yml
@@ -48,6 +48,7 @@ jobs:
test_vpp_runner: ${{ steps.config.outputs.test_vpp_runner }}
install_build_deps: ${{ steps.config.outputs.install_build_deps }}
mirror_enabled: ${{ steps.config.outputs.mirror_enabled }}
+ vyos_build_ref: ${{ steps.determine-ref.outputs.vyos_build_ref }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -82,6 +83,45 @@ jobs:
echo "install_build_deps=$(echo $CONFIG | jq -r .install_build_deps)" >> $GITHUB_OUTPUT
echo "mirror_enabled=$(echo $CONFIG | jq -r .mirror_enabled)" >> $GITHUB_OUTPUT
+ - name: Determine vyos-build ref
+ id: determine-ref
+ env:
+ GH_TOKEN: ${{ steps.config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
+ run: |
+ BRANCH="${{ steps.config.outputs.branch }}"
+ VYOS_BUILD_REPO="${{ steps.config.outputs.vyos_build_repo }}"
+
+ if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
+ PR_HEAD_REF="${{ github.event.pull_request.head.ref }}"
+
+ # VYOS_BUILD_REPO is in owner/repo format from config
+ REPO_PATH="$VYOS_BUILD_REPO"
+
+ # Get creation date from 90 days ago
+ CREATED_AFTER=$(date -u -d "90 days ago" +"%Y-%m-%dT%H:%M:%SZ")
+
+ echo "Looking for PR in $REPO_PATH with branch '$PR_HEAD_REF' created after $CREATED_AFTER"
+
+ # Query GitHub API for matching PR with merge commit SHA
+ MATCHING_PR_MERGE_SHA=$(gh api repos/$REPO_PATH/pulls \
+ --jq ".[] | select(.created_at > \"$CREATED_AFTER\" and .head.ref == \"$PR_HEAD_REF\") | .merge_commit_sha" 2>&1 | grep -v '^{' | head -1)
+
+ echo "Merge commit SHA: $MATCHING_PR_MERGE_SHA"
+
+ # Check if response is a valid SHA (40-char hex) or an error
+ if [[ $MATCHING_PR_MERGE_SHA =~ ^[a-f0-9]{40}$ ]]; then
+ # Use the merge commit SHA - this is what the code would look like if merged
+ echo "vyos_build_ref=$MATCHING_PR_MERGE_SHA" >> $GITHUB_OUTPUT
+ echo "Found matching open PR in vyos-build with branch '$PR_HEAD_REF', using merge commit: $MATCHING_PR_MERGE_SHA"
+ else
+ echo "vyos_build_ref=$BRANCH" >> $GITHUB_OUTPUT
+ echo "No matching open PR found in vyos-build for branch '$PR_HEAD_REF', falling back to '$BRANCH'"
+ fi
+ else
+ echo "vyos_build_ref=$BRANCH" >> $GITHUB_OUTPUT
+ echo "Using configured branch '$BRANCH'"
+ fi
+
build_iso:
needs: set_config
runs-on: ${{ fromJson(needs.set_config.outputs.build_runner) }}
@@ -98,7 +138,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- name: Clone vyos-1x source code
uses: actions/checkout@v4
@@ -164,7 +204,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- uses: actions/download-artifact@v4
with:
@@ -198,7 +238,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- uses: actions/download-artifact@v4
with:
@@ -231,7 +271,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- uses: actions/download-artifact@v4
with:
@@ -264,7 +304,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- uses: actions/download-artifact@v4
with:
@@ -298,7 +338,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- uses: actions/download-artifact@v4
with:
@@ -331,7 +371,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- uses: actions/download-artifact@v4
with:
@@ -365,7 +405,7 @@ jobs:
with:
repository: ${{ needs.set_config.outputs.vyos_build_repo }}
token: ${{ needs.set_config.outputs.use_pat == 'true' && secrets.PAT || secrets.GITHUB_TOKEN }}
- ref: ${{ needs.set_config.outputs.branch }}
+ ref: ${{ needs.set_config.outputs.vyos_build_ref }}
- uses: actions/download-artifact@v4
with: