Skip to content

Commit

Permalink
Move container build workflow check to separate job
Browse files Browse the repository at this point in the history
  • Loading branch information
ppawlowski committed Dec 26, 2024
1 parent 72ef8f0 commit a259b39
Showing 1 changed file with 13 additions and 40 deletions.
53 changes: 13 additions & 40 deletions .github/workflows/test-docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:


jobs:
default-stack:
name: Test default stack
wait-for-containers-build:
name: Wait for container images build
runs-on: ubuntu-latest
if: |
!startsWith(github.head_ref, 'release-')
Expand All @@ -24,6 +24,11 @@ jobs:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_APP_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

- name: Wait for container images build
run: |
while :; do
Expand All @@ -49,10 +54,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

default-stack:
name: Test default stack
needs: wait-for-containers-build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

- name: Create .env file for default settings
run: |
Expand Down Expand Up @@ -126,46 +134,11 @@ jobs:

quick-start-stack:
name: Test quick-start stack
needs: wait-for-containers-build
runs-on: ubuntu-latest
if: |
!startsWith(github.head_ref, 'release-')
steps:
- name: Generate a token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_APP_KEY }}

- name: Wait for container images build
run: |
while :; do
result=$(gh api repos/:owner/:repo/actions/workflows | jq -r '.workflows[] | select(.name=="Build and push containers") | .id' | xargs -I {} gh api repos/:owner/:repo/actions/workflows/{}/runs --jq '.workflow_runs | max_by(.run_number)')
status=$(echo "$result" | jq -r '.status')
conclusion=$(echo "$result" | jq -r '.conclusion')
if [[ "$status" == "completed" ]]; then
if [[ "$conclusion" == "success" ]]; then
echo "Build and push containers workflow completed successfully"
break
else
echo "Build and push containers workflow failed"
exit 1
fi
elif [[ "$status" == "in_progress" ]]; then
echo "Build and push containers workflow is still running"
sleep 60
else
echo "Build and push containers workflow returned unexpected status: $status"
exit 1
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

- name: Create .env file for default settings
run: |
Expand Down

0 comments on commit a259b39

Please sign in to comment.