Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/includes/wait-for-check-start.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# Copyright Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Wait for Check Creation
on:
workflow_call:
inputs:
check-name:
required: true
type: string
repository:
required: true
type: string
ref:
required: true
type: string
wait-timeout:
default: "600"
type: string
wait-interval:
default: "10"
type: string
secrets:
repo-token:
required: true

jobs:
waitForCheck:
runs-on: ubuntu-latest
steps:
- name: Wait for ${{ inputs.check-name }} check to exist
env:
GH_TOKEN: ${{ inputs.repo-token }}
WAIT_TIMEOUT: ${{ inputs.wait-timeout }}
WAIT_INTERVAL: ${{ inputs.wait-interval }}
REPO: ${{ inputs.repository }}
REF: ${{ inputs.ref }}
run: |
echo "Waiting for check '${{ inputs.check-name }}' to be created..."

elapsed=0
while ! gh api "repos/$REPO/commits/$REF/check-runs" --jq '.check_runs[].name' | grep -q "${{ inputs.check-name }}"; do
if [ $elapsed -ge $WAIT_TIMEOUT ]; then
echo "Timed out waiting for check '${{ inputs.check-name }}' to be created."
exit 1
fi
echo "Check not found yet. Waiting $WAIT_INTERVAL seconds..."
sleep $WAIT_INTERVAL
elapsed=$((elapsed + WAIT_INTERVAL))
done

echo "'${{ inputs.check-name }}' check found!"
43 changes: 38 additions & 5 deletions .github/workflows/pushimage-next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
repository_dispatch:
types: [build]

env:
INDEX_BASE_KONFLUX_BUILD_CHECK: Red Hat Konflux / devfile-registry-base-main-on-push
INDEX_BASE_KONFLUX_EC_CHECK: Red Hat Konflux / devfile-registry-main-enterprise-contract / devfile-registry-base-main

jobs:
indexServerBuild:
runs-on: ubuntu-latest
Expand All @@ -46,19 +50,48 @@ jobs:
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.12.4
bash ./build-multi-arch.sh

konflux-wait:
waitForKonfluxBuildStart:
needs: indexServerBuild
uses: ./.github/workflows/includes/wait-for-check-start.yaml
with:
check-name: ${{ env.INDEX_BASE_KONFLUX_BUILD_CHECK }}
repository: ${{ github.repository }}
ref: ${{ github.ref }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

konfluxBuildWait:
needs: waitForKonfluxBuildStart
runs-on: ubuntu-latest
steps:
- name: Wait for ${{ env.INDEX_BASE_KONFLUX_BUILD_CHECK }} tasks to finish
uses: lewagon/wait-on-check-action@74049309dfeff245fe8009a0137eacf28136cb3c # v1.5.0
with:
ref: ${{ github.ref }}
check-name: ${{ env.INDEX_BASE_KONFLUX_BUILD_CHECK }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

waitForKonfluxECStart:
needs: konfluxBuildWait
uses: ./.github/workflows/includes/wait-for-check-start.yaml
with:
check-name: ${{ env.INDEX_BASE_KONFLUX_EC_CHECK }}
repository: ${{ github.repository }}
ref: ${{ github.ref }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

konfluxECWait:
needs: waitForKonfluxECStart
runs-on: ubuntu-latest
steps:
- name: Wait for Konflux tasks to finish
- name: Wait for ${{ env.INDEX_BASE_KONFLUX_EC_CHECK }} checks to finish
uses: lewagon/wait-on-check-action@74049309dfeff245fe8009a0137eacf28136cb3c # v1.5.0
with:
ref: ${{ github.ref }}
check-name: "Red Hat Konflux / devfile-registry-main-enterprise-contract / devfile-registry-base-main"
check-name: ${{ env.INDEX_BASE_KONFLUX_EC_CHECK }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

dispatch-community:
needs: konflux-wait
dispatchCommunity:
needs: konfluxECWait
runs-on: ubuntu-latest
name: Dispatch Community Devfile Registry
steps:
Expand Down
Loading