diff options
author | Earl Warren <contact@earl-warren.org> | 2023-08-24 12:28:17 +0200 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2023-08-26 11:52:19 +0200 |
commit | deefb19f21f544504d4b4af9d22165c80d81ec74 (patch) | |
tree | 3bc26dca54ce61768de6eda88972a55dc35cbb38 /.forgejo | |
parent | the binaries are published in the runner repository (diff) | |
download | forgejo-runner-deefb19f21f544504d4b4af9d22165c80d81ec74.tar.xz forgejo-runner-deefb19f21f544504d4b4af9d22165c80d81ec74.zip |
example docker compose file and test
Diffstat (limited to '.forgejo')
-rw-r--r-- | .forgejo/workflows/example-docker-compose.yml | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/.forgejo/workflows/example-docker-compose.yml b/.forgejo/workflows/example-docker-compose.yml new file mode 100644 index 0000000..465e80b --- /dev/null +++ b/.forgejo/workflows/example-docker-compose.yml @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: MIT +on: [push] + +jobs: + example-docker-compose: + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + + - name: Install docker + run: | + apt-get update -qq + export DEBIAN_FRONTEND=noninteractive + apt-get install -qq -y ca-certificates curl gnupg + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update -qq + apt-get install -qq -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin=2.20.2-1~debian.11~bullseye + docker version + # + # docker compose is prone to non backward compatible changes, pin it + # + apt-get install -qq -y docker-compose-plugin=2.20.2-1~debian.11~bullseye + docker compose version + + - name: run the example + run: | + set -x + cd examples/docker-compose + cli="docker compose -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml" + # + # Launch + # + $cli up -d + # + # Wait for the demo workflow to complete + # + $cli ps --help + success='DEMO WORKFLOW SUCCESS' + for delay in $(seq 60) ; do + $cli logs -n 10 demo-workflow > /tmp/out + grep --quiet "$success" /tmp/out && break + $cli ps --all + cat /tmp/out + sleep 10 + done + if ! grep --quiet "$success" /tmp/out ; then + echo ========================================== + $cli logs + exit 1 + fi |