Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Wait for containers to build before testing docker compose #184

Merged
merged 2 commits into from
Jan 2, 2025
Merged
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
53 changes: 49 additions & 4 deletions .github/workflows/test-docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,62 @@ on:
push:
branches:
- main
- '!release-**'
- '!release-*'
pull_request:
branches:
- main
- '!release-**'


jobs:
wait-for-containers-build:
name: Wait for container images 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: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

- 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 }}

default-stack:
name: Test default stack
needs: wait-for-containers-build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v4

- name: Create .env file for default settings
Expand Down Expand Up @@ -90,9 +134,10 @@ jobs:

quick-start-stack:
name: Test quick-start stack
needs: wait-for-containers-build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v4

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