mirror of https://code.forgejo.org/forgejo/runner
Merge pull request 'examples/docker-compose: network: host is required' (#90) from earl-warren/runner:wip-upgrade-example into main
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/90 Reviewed-by: dachary <dachary@noreply.code.forgejo.org>pull/91/head
commit
513a5eb80e
|
@ -42,11 +42,13 @@ jobs:
|
||||||
#
|
#
|
||||||
$cli ps --help
|
$cli ps --help
|
||||||
success='DEMO WORKFLOW SUCCESS'
|
success='DEMO WORKFLOW SUCCESS'
|
||||||
|
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 -n 10 demo-workflow > /tmp/out
|
||||||
grep --quiet "$success" /tmp/out && break
|
grep --quiet "$success" /tmp/out && break
|
||||||
|
grep --quiet "$failure" /tmp/out && break
|
||||||
$cli ps --all
|
$cli ps --all
|
||||||
cat /tmp/out
|
tail /tmp/out
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
if ! grep --quiet "$success" /tmp/out ; then
|
if ! grep --quiet "$success" /tmp/out ; then
|
||||||
|
|
|
@ -13,13 +13,13 @@ services:
|
||||||
runner-register:
|
runner-register:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
command: >-
|
command: >-
|
||||||
sh -xc '
|
sh -ec '
|
||||||
apk add --quiet git curl jq ;
|
apk add --quiet git curl jq ;
|
||||||
mkdir -p /srv/demo ;
|
mkdir -p /srv/demo ;
|
||||||
cd /srv/demo ;
|
cd /srv/demo ;
|
||||||
git init --initial-branch=main ;
|
git init --initial-branch=main ;
|
||||||
mkdir -p .forgejo/workflows ;
|
mkdir -p .forgejo/workflows ;
|
||||||
echo "{ on: [push], jobs: { test: { runs-on: docker, steps: [ { run: echo All Good } ] } } }" > .forgejo/workflows/demo.yml ;
|
echo "{ on: [push], jobs: { test: { runs-on: docker, steps: [ {uses: actions/checkout@v4}, { run: echo All Good } ] } } }" > .forgejo/workflows/demo.yml ;
|
||||||
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 ;
|
||||||
|
@ -29,10 +29,10 @@ services:
|
||||||
sleep 5 ;
|
sleep 5 ;
|
||||||
done ;
|
done ;
|
||||||
sha=`git rev-parse HEAD` ;
|
sha=`git rev-parse HEAD` ;
|
||||||
while : ; do
|
for delay in 1 1 1 1 2 5 5 10 10 10 15 ; 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 ;
|
||||||
grep success status && break ;
|
if grep success status ; then echo DEMO WORKFLOW SUCCESS && break ; fi ;
|
||||||
sleep 5 ;
|
if grep failure status ; then echo DEMO WORKFLOW FAILURE && break ; fi ;
|
||||||
done ;
|
sleep $$delay ;
|
||||||
echo DEMO WORKFLOW SUCCESS
|
done
|
||||||
'
|
'
|
||||||
|
|
|
@ -46,7 +46,7 @@ services:
|
||||||
- 8080:3000
|
- 8080:3000
|
||||||
|
|
||||||
runner-register:
|
runner-register:
|
||||||
image: code.forgejo.org/forgejo/runner:3.0.0
|
image: code.forgejo.org/forgejo/runner:3.0.1
|
||||||
links:
|
links:
|
||||||
- docker-in-docker
|
- docker-in-docker
|
||||||
- forgejo
|
- forgejo
|
||||||
|
@ -56,18 +56,19 @@ services:
|
||||||
- /srv/runner-data:/data
|
- /srv/runner-data:/data
|
||||||
user: 0:0
|
user: 0:0
|
||||||
command: >-
|
command: >-
|
||||||
bash -c '
|
bash -ec '
|
||||||
while : ; do
|
while : ; do
|
||||||
forgejo-runner create-runner-file --instance http://forgejo:3000 --name runner --secret {SHARED_SECRET} && break ;
|
forgejo-runner create-runner-file --instance http://forgejo:3000 --name runner --secret {SHARED_SECRET} && break ;
|
||||||
sleep 1 ;
|
sleep 1 ;
|
||||||
done ;
|
done ;
|
||||||
forgejo-runner generate-config > config.yml ;
|
forgejo-runner generate-config > config.yml ;
|
||||||
|
sed -i -e "s|network: .*|network: host|" config.yml ;
|
||||||
sed -i -e "s|labels: \[\]|labels: \[\"docker:docker://alpine:3.18\"\]|" config.yml ;
|
sed -i -e "s|labels: \[\]|labels: \[\"docker:docker://alpine:3.18\"\]|" config.yml ;
|
||||||
chown -R 1000:1000 /data
|
chown -R 1000:1000 /data
|
||||||
'
|
'
|
||||||
|
|
||||||
runner-daemon:
|
runner-daemon:
|
||||||
image: code.forgejo.org/forgejo/runner:3.0.0
|
image: code.forgejo.org/forgejo/runner:3.0.1
|
||||||
links:
|
links:
|
||||||
- docker-in-docker
|
- docker-in-docker
|
||||||
- forgejo
|
- forgejo
|
||||||
|
|
Loading…
Reference in New Issue