diff --git a/.forgejo/workflows/example-docker-compose.yml b/.forgejo/workflows/example-docker-compose.yml index ee71ca6..68d8052 100644 --- a/.forgejo/workflows/example-docker-compose.yml +++ b/.forgejo/workflows/example-docker-compose.yml @@ -3,7 +3,7 @@ on: push: branches: - 'main' - pull_request_target: + pull_request: jobs: example-docker-compose: @@ -34,7 +34,7 @@ jobs: cd examples/docker-compose secret=$(openssl rand -hex 20) sed -i -e "s/{SHARED_SECRET}/$secret/" compose-forgejo-and-runner.yml - cli="docker compose -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml" + cli="docker compose --progress quiet -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml" # # Launch # @@ -42,19 +42,21 @@ jobs: # # Wait for the demo workflow to complete # - $cli ps --help success='DEMO WORKFLOW SUCCESS' failure='DEMO WORKFLOW FAILURE' for delay in $(seq 60) ; do - $cli logs -n 10 demo-workflow > /tmp/out + $cli logs demo-workflow > /tmp/out grep --quiet "$success" /tmp/out && break grep --quiet "$failure" /tmp/out && break $cli ps --all tail /tmp/out sleep 10 done - if ! grep --quiet "$success" /tmp/out ; then - echo ========================================== - $cli logs - exit 1 - fi + tail /tmp/out + grep --quiet "$success" /tmp/out + + - name: docker compose logs + if: always() + run: | + cd examples/docker-compose + docker compose -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml logs diff --git a/examples/docker-compose/compose-demo-workflow.yml b/examples/docker-compose/compose-demo-workflow.yml index 0e44c59..4cc49bf 100644 --- a/examples/docker-compose/compose-demo-workflow.yml +++ b/examples/docker-compose/compose-demo-workflow.yml @@ -23,16 +23,17 @@ services: git add . ; git config user.email root@example.com ; git config user.name username ; - git commit -m 'demo' ; + git commit -m demo ; while : ; do git push --set-upstream --force http://root:{ROOT_PASSWORD}@forgejo:3000/root/test main && break ; sleep 5 ; done ; sha=`git rev-parse HEAD` ; - for delay in 1 1 1 1 2 5 5 10 10 10 15 ; do + for delay in 1 1 1 1 2 5 5 10 10 10 15 30 30 30 30 30 30 30 ; do curl -sS -f http://forgejo:3000/api/v1/repos/root/test/commits/$$sha/status | jq --raw-output .state | tee status ; if grep success status ; then echo DEMO WORKFLOW SUCCESS && break ; fi ; if grep failure status ; then echo DEMO WORKFLOW FAILURE && break ; fi ; sleep $$delay ; - done + done ; + grep success status || echo DEMO WORKFLOW FAILURE '