Skip to content

Commit

Permalink
Finer control on when konflux tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
Molter73 committed May 29, 2024
1 parent 9cad93c commit 0217286
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 64 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/konflux-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Run konflux tests

on:
workflow_call:

jobs:
init:
runs-on: ubuntu-latest
outputs:
collector-tag: ${{ steps.generate-tag.outputs.collector-tag }}
collector-qa-tag: ${{ steps.generate-tag.outputs.collector-qa-tag }}
rebuild-qa-containers: ${{ steps.filter.outputs.container }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell

# Only trigger a rebuild when the QA tag has changed
filters: |
container:
- integration-tests/container/QA_TAG
- id: generate-tag
run: |
echo "collector-tag='$(make tag)'" >> "$GITHUB_OUTPUT"
COLLECTOR_QA_TAG="$(cat ${{ github.workspace }}/integration-tests/container/QA_TAG)"
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" && "${{ steps.filter.outputs.container }}" == "true" ]]; then
COLLECTOR_QA_TAG="${COLLECTOR_QA_TAG}-${COLLECTOR_TAG}"
fi
echo "collector-tag-qa=${COLLECTOR_QA_TAG}" >> "$GITHUB_OUTPUT"
wait-for-images:
runs-on: ubuntu-latest
needs:
- init
steps:
- uses: stackrox/actions/release/wait-for-images@v1
with:
token: ${{ secrets.QUAY_RHACS_ENG_BEARER_TOKEN }}
image: quay.io/rhacs-eng/collector:${{ needs.init.outputs.collector-tag }}-fast

build-test-containers:
uses: ./.github/workflows/integration-test-containers.yml
needs:
- init
with:
collector-tag: ${{ needs.init.outputs.collector-tag }}
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
rebuild-qa-containers: ${{ needs.init.outputs.rebuild-qa-containers == 'true' }}
secrets: inherit

run-konflux-tests:
uses: ./.github/workflows/integration-tests.yml
needs:
- init
- wait-for-images
with:
collector-tag: ${{ needs.init.outputs.collector-tag }}
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
secrets: inherit
68 changes: 4 additions & 64 deletions .github/workflows/konflux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run konflux tests
name: Run konflux workflows

on:
push:
Expand All @@ -8,74 +8,14 @@ on:
tags:
- 3.*.*
pull_request:
branches:
- '**/*konflux*'
- '**/*rhtap*'
- '*konflux*'
- '*rhtap*'

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
init:
runs-on: ubuntu-latest
outputs:
collector-tag: ${{ steps.generate-tag.outputs.collector-tag }}
collector-qa-tag: ${{ steps.generate-tag.outputs.collector-qa-tag }}
rebuild-qa-containers: ${{ steps.filter.outputs.container }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
list-files: shell

# Only trigger a rebuild when the QA tag has changed
filters: |
container:
- integration-tests/container/QA_TAG
- id: generate-tag
run: |
echo "collector-tag='$(make tag)'" >> "$GITHUB_OUTPUT"
COLLECTOR_QA_TAG="$(cat ${{ github.workspace }}/integration-tests/container/QA_TAG)"
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" && "${{ steps.filter.outputs.container }}" == "true" ]]; then
COLLECTOR_QA_TAG="${COLLECTOR_QA_TAG}-${COLLECTOR_TAG}"
fi
echo "collector-tag-qa=${COLLECTOR_QA_TAG}" >> "$GITHUB_OUTPUT"
wait-for-images:
runs-on: ubuntu-latest
needs:
- init
steps:
- uses: stackrox/actions/release/wait-for-images@v1
with:
token: ${{ secrets.QUAY_RHACS_ENG_BEARER_TOKEN }}
image: quay.io/rhacs-eng/collector:${{ needs.init.outputs.collector-tag }}-fast

build-test-containers:
uses: ./.github/workflows/integration-test-containers.yml
needs:
- init
with:
collector-tag: ${{ needs.init.outputs.collector-tag }}
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
rebuild-qa-containers: ${{ needs.init.outputs.rebuild-qa-containers == 'true' }}
run-tests:
uses: ./.github/workflows/konflux-tests.yml
if: contains(fromJSON('["konflux", "rhtap"]'), github.head_ref)
secrets: inherit

run-konflux-tests:
uses: ./.github/workflows/integration-tests.yml
needs:
- init
- wait-for-images
with:
collector-tag: ${{ needs.init.outputs.collector-tag }}
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
secrets: inherit

0 comments on commit 0217286

Please sign in to comment.