Skip to content

Commit 55fd797

Browse files
authored
[GHA] ST execution actions wait only for artifacts and not for java + playwright (#2406)
Signed-off-by: jkalinic <jkalinic@redhat.com>
1 parent 291c8a7 commit 55fd797

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

.github/actions/systemtests/verify-workflow-run-succeeded.sh

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,36 @@ source $SCRIPT_DIR/common.sh
88

99
WORKFLOW_FILE=${1:-integration.yml}
1010

11-
echo "Check workflow run succeeded"
11+
echo "Check build-images job succeeded"
1212

1313
# Get branch from PR
1414
BRANCH=$(gh pr view "$PR_NUMBER" --repo "$REPO" --json headRefName -q '.headRefName')
1515
echo "Fetching latest Build workflow run for branch $BRANCH..."
1616

17-
# Fetch latest workflow run conclusion
18-
BUILD_RUN=$(gh api "repos/$REPO/actions/workflows/$WORKFLOW_FILE/runs?branch=$BRANCH&per_page=1" \
19-
--jq '.workflow_runs[0].conclusion')
17+
# Get the latest run ID for the workflow
18+
RUN_ID=$(gh api "repos/$REPO/actions/workflows/$WORKFLOW_FILE/runs?branch=$BRANCH&per_page=1" \
19+
--jq '.workflow_runs[0].id')
2020

21-
echo "Build workflow latest run conclusion: $BUILD_RUN"
22-
if [[ "$BUILD_RUN" != "success" ]]; then
23-
# Comment workflow status
21+
echo "Latest workflow run ID: $RUN_ID"
22+
23+
if [[ -z "$RUN_ID" || "$RUN_ID" == "null" ]]; then
24+
deleteLastStatusComment
25+
gh pr comment $PR_NUMBER --repo $REPO --body "❌ No workflow run found for branch $BRANCH. Cannot trigger systemtests"
26+
exit 1
27+
fi
28+
29+
# Check specifically the build-images job conclusion within that run
30+
BUILD_IMAGES_STATUS=$(gh api "repos/$REPO/actions/runs/$RUN_ID/jobs" \
31+
--jq '.jobs[] | select(.name=="build-images") | .conclusion')
32+
33+
echo "build-images job conclusion: $BUILD_IMAGES_STATUS"
34+
35+
if [[ "$BUILD_IMAGES_STATUS" != "success" ]]; then
2436
deleteLastStatusComment
25-
gh pr comment $PR_NUMBER --repo $REPO --body "Build did not succeed. Cannot trigger systemtests"
37+
gh pr comment $PR_NUMBER --repo $REPO --body "build-images job did not succeed (status: $BUILD_IMAGES_STATUS). Cannot trigger systemtests"
2638
exit 1
2739
fi
40+
41+
# Export run ID so systemtests workflow can download artifacts from it directly
42+
echo "ARTIFACTS_RUN_ID=$RUN_ID" >> $GITHUB_ENV
43+
echo "Build images succeeded, artifacts available from run $RUN_ID"

.github/workflows/pre-systemtest.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
if: ${{ contains(github.event.comment.body, '--help') }}
3131
run: ./.github/actions/systemtests/pr-help.sh
3232

33-
- name: Check if Build workflow succeeded
33+
- name: Check if build-images job succeeded
3434
run: ./.github/actions/systemtests/verify-workflow-run-succeeded.sh
3535

3636
- name: Parse parameters from comment
@@ -40,14 +40,15 @@ jobs:
4040
- name: Comment start of the build
4141
run: ./.github/actions/systemtests/update-pr-systemtests-started.sh
4242

43-
- name: Invoke workflow in another repo with inputs
43+
- name: Invoke workflow with inputs
4444
uses: benc-uk/workflow-dispatch@7a027648b88c2413826b6ddd6c76114894dc5ec4
4545
with:
4646
token: ${{ secrets.BOT_ORG_SCOPED_TOKEN }}
4747
workflow: systemtests.yml
4848
inputs: >
4949
{
5050
"commit_sha": "${{ env.COMMIT_SHA }}",
51+
"artifacts_run_id": "${{ env.ARTIFACTS_RUN_ID }}",
5152
"testcase": "${{ env.TESTCASE }}",
5253
"profile": "${{ env.PROFILE }}",
5354
"install_type": "${{ env.INSTALL_TYPE }}",

.github/workflows/systemtests.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
commit_sha:
77
description: 'Commit sha'
88
required: true
9+
artifacts_run_id:
10+
description: 'Run ID of the integration workflow to download artifacts from'
11+
required: true
912
testcase:
1013
description: 'Test case to run'
1114
required: false
@@ -65,6 +68,7 @@ jobs:
6568
TEST_CASE: ${{ matrix.testcase }}
6669
PROFILE: ${{ matrix.profile }}
6770
COMMIT_SHA: ${{ github.event.inputs.commit_sha }}
71+
ARTIFACTS_RUN_ID: ${{ github.event.inputs.artifacts_run_id }}
6872
GH_TOKEN: ${{ secrets.BOT_ORG_SCOPED_TOKEN }}
6973
REPO: ${{ github.repository }}
7074
INSTALL_TYPE: ${{ github.event.inputs.install_type }}
@@ -80,11 +84,6 @@ jobs:
8084
with:
8185
ref: ${{ env.COMMIT_SHA }}
8286

83-
- name: Get previously built artifacts
84-
run: |
85-
ARTIFACTS_RUN_ID=$(gh run list --repo $REPO --commit $COMMIT_SHA --workflow integration.yml --status success --json databaseId --jq '.[0].databaseId')
86-
echo "ARTIFACTS_RUN_ID=$ARTIFACTS_RUN_ID" >> $GITHUB_ENV
87-
8887
- name: Download Image Artifacts
8988
uses: actions/download-artifact@v8
9089
with:
@@ -113,17 +112,14 @@ jobs:
113112
echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
114113
echo "CONSOLE_CLUSTER_DOMAIN=$(minikube ip).nip.io" >> $GITHUB_ENV
115114
116-
# YAML INSTALL PATH
117115
- name: Prepare YAML install
118116
if: ${{ env.INSTALL_TYPE == 'yaml' }}
119117
run: |
120118
set -x
121119
echo "Preparing YAML-based installation..."
122120
123-
# Download k8s-resources artifact (same run as images)
124-
gh run download ${{ env.ARTIFACTS_RUN_ID }} --repo ${{ env.REPO }} -n k8s-resources --dir ./k8s-resources
121+
gh run download ${{ env.ARTIFACTS_RUN_ID }} --repo ${{ env.REPO }} -n k8s-resources --dir ./k8s-resources
125122
126-
# Merge YAML files
127123
mkdir -p ./k8s-resources/merged
128124
cat ./k8s-resources/kubernetes/consoles.console.streamshub.github.com-v1.yml \
129125
./k8s-resources/kubernetes/kubernetes.yml \

0 commit comments

Comments
 (0)