mirror of https://code.forgejo.org/forgejo/runner
parent
f0dc5e90a0
commit
6d77918ad1
|
@ -3,7 +3,7 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'main'
|
- 'main'
|
||||||
pull_request_target:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
example-docker-compose:
|
example-docker-compose:
|
||||||
|
@ -34,7 +34,7 @@ jobs:
|
||||||
cd examples/docker-compose
|
cd examples/docker-compose
|
||||||
secret=$(openssl rand -hex 20)
|
secret=$(openssl rand -hex 20)
|
||||||
sed -i -e "s/{SHARED_SECRET}/$secret/" compose-forgejo-and-runner.yml
|
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
|
# Launch
|
||||||
#
|
#
|
||||||
|
@ -42,19 +42,21 @@ jobs:
|
||||||
#
|
#
|
||||||
# Wait for the demo workflow to complete
|
# Wait for the demo workflow to complete
|
||||||
#
|
#
|
||||||
$cli ps --help
|
|
||||||
success='DEMO WORKFLOW SUCCESS'
|
success='DEMO WORKFLOW SUCCESS'
|
||||||
failure='DEMO WORKFLOW FAILURE'
|
failure='DEMO WORKFLOW FAILURE'
|
||||||
for delay in $(seq 60) ; do
|
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 "$success" /tmp/out && break
|
||||||
grep --quiet "$failure" /tmp/out && break
|
grep --quiet "$failure" /tmp/out && break
|
||||||
$cli ps --all
|
$cli ps --all
|
||||||
tail /tmp/out
|
tail /tmp/out
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
if ! grep --quiet "$success" /tmp/out ; then
|
tail /tmp/out
|
||||||
echo ==========================================
|
grep --quiet "$success" /tmp/out
|
||||||
$cli logs
|
|
||||||
exit 1
|
- name: docker compose logs
|
||||||
fi
|
if: always()
|
||||||
|
run: |
|
||||||
|
cd examples/docker-compose
|
||||||
|
docker compose -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml logs
|
||||||
|
|
|
@ -23,16 +23,17 @@ services:
|
||||||
git add . ;
|
git add . ;
|
||||||
git config user.email root@example.com ;
|
git config user.email root@example.com ;
|
||||||
git config user.name username ;
|
git config user.name username ;
|
||||||
git commit -m 'demo' ;
|
git commit -m demo ;
|
||||||
while : ; do
|
while : ; do
|
||||||
git push --set-upstream --force http://root:{ROOT_PASSWORD}@forgejo:3000/root/test main && break ;
|
git push --set-upstream --force http://root:{ROOT_PASSWORD}@forgejo:3000/root/test main && break ;
|
||||||
sleep 5 ;
|
sleep 5 ;
|
||||||
done ;
|
done ;
|
||||||
sha=`git rev-parse HEAD` ;
|
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 ;
|
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 success status ; then echo DEMO WORKFLOW SUCCESS && break ; fi ;
|
||||||
if grep failure status ; then echo DEMO WORKFLOW FAILURE && break ; fi ;
|
if grep failure status ; then echo DEMO WORKFLOW FAILURE && break ; fi ;
|
||||||
sleep $$delay ;
|
sleep $$delay ;
|
||||||
done
|
done ;
|
||||||
|
grep success status || echo DEMO WORKFLOW FAILURE
|
||||||
'
|
'
|
||||||
|
|
Loading…
Reference in New Issue