Skip to content

Commit

Permalink
Run konflux builds and tests on all PRs (#1841)
Browse files Browse the repository at this point in the history
  • Loading branch information
Molter73 authored Sep 13, 2024
1 parent c1ed9b3 commit 1ccaee1
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 100 deletions.
89 changes: 0 additions & 89 deletions .github/workflows/konflux-tests.yml

This file was deleted.

89 changes: 81 additions & 8 deletions .github/workflows/konflux.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Run konflux workflows
name: Test Konflux builds

on:
schedule:
- cron: 0 6 * * *
push:
branches:
- master
Expand All @@ -20,10 +18,85 @@ concurrency:
cancel-in-progress: true

jobs:
run-tests:
uses: ./.github/workflows/konflux-tests.yml
if: github.event_name != 'pull_request' ||
contains(github.head_ref, 'konflux') ||
contains(github.head_ref, 'rhtap')
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
with:
ref: ${{ github.head_ref || github.ref_name }}
submodules: true
fetch-depth: 0

- 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)-fast" >> "$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-qa-tag=${COLLECTOR_QA_TAG}" >> "$GITHUB_OUTPUT"
wait-for-images:
runs-on: ubuntu-latest
needs:
- init
steps:
- uses: stackrox/actions/release/wait-for-image@v1
with:
token: ${{ secrets.QUAY_RHACS_ENG_BEARER_TOKEN }}
image: rhacs-eng/collector:${{ needs.init.outputs.collector-tag }}
limit: 9000 # 2h30m

integration-tests-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
- integration-tests-containers
with:
collector-tag: ${{ needs.init.outputs.collector-tag }}
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
collector-tests-tag: ${{ needs.integration-tests-containers.outputs.collector-tests-tag }}
is-konflux: true
job-tag: konf
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
secrets: inherit

k8s-integration-tests:
uses: ./.github/workflows/k8s-integration-tests.yml
with:
collector-tag: ${{ needs.init.outputs.collector-tag }}
collector-qa-tag: ${{ needs.init.outputs.collector-qa-tag }}
collector-tests-tag: ${{ needs.integration-tests-containers.outputs.collector-tests-tag }}
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-integration-tests') }}
needs:
- init
- wait-for-images
- integration-tests-containers
secrets: inherit
4 changes: 1 addition & 3 deletions .tekton/collector-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ metadata:
build.appstudio.redhat.com/pull_request_number: '{{pull_request_number}}'
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
pipelinesascode.tekton.dev/max-keep-runs: "500"
# TODO(ROX-21073): re-enable for all PR branches
pipelinesascode.tekton.dev/on-cel-expression: |
(event == "push" && target_branch.matches("^(master|release-.*)$")) ||
(event == "pull_request" && (source_branch.matches("(konflux|appstudio|rhtap)") || body.pull_request.labels.exists(l, l.name == "konflux-build")))
(event == "push" && target_branch.matches("^(master|release-.*)$")) || event == "pull_request"
labels:
appstudio.openshift.io/application: acs
appstudio.openshift.io/component: collector
Expand Down

0 comments on commit 1ccaee1

Please sign in to comment.