From 0cf4c81ed3ffa603e456edd75d79cedd3b670ddd Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 29 Jul 2024 07:58:26 +0000 Subject: [PATCH] Update content/ci/actions.md (#423) Update version of runner from 3.3.0 to 3.4.0 Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/423 Reviewed-by: Patrick Schratz Co-authored-by: Eric Co-committed-by: Eric --- content/ci/actions.md | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/content/ci/actions.md b/content/ci/actions.md index c6cc84a..55620b0 100644 --- a/content/ci/actions.md +++ b/content/ci/actions.md @@ -47,10 +47,18 @@ You can add Runners to your account, organization, or repository. Choosing where Forgejo Runner is released in both binary and container image (OCI) forms: +- Get the last released version: + + ```bash + $ export RUNNER_VERSION=$(curl -X 'GET' https://code.forgejo.org/api/v1/repos/forgejo/runner/releases/latest | jq .name -r | cut -c 2-) + ``` + + You can also manually check directly on the [Forgejo Runner release page](https://code.forgejo.org/forgejo/runner/releases) + - Download the binary to run on your machine: ```bash - $ wget -O forgejo-runner https://code.forgejo.org/forgejo/runner/releases/download/v3.3.0/forgejo-runner-3.3.0-linux-amd64 + $ wget -O forgejo-runner https://code.forgejo.org/forgejo/runner/releases/download/v${RUNNER_VERSION}/forgejo-runner-${RUNNER_VERSION}-linux-amd64 $ chmod +x forgejo-runner ``` @@ -59,8 +67,8 @@ Forgejo Runner is released in both binary and container image (OCI) forms: - Or download the container image and run it using Docker: ```bash - $ docker run --rm code.forgejo.org/forgejo/runner:3.3.0 forgejo-runner --version - forgejo-runner version v3.3.0 + $ docker run --rm code.forgejo.org/forgejo/runner:${RUNNER_VERSION} forgejo-runner --version + forgejo-runner version ``` ## Preparing configuration files @@ -75,7 +83,7 @@ Make sure to replace `{TOKEN}` with the registration token you copied, and `{NAM ```bash $ ./forgejo-runner register --no-interactive --token {TOKEN} --name {NAME} --instance https://codeberg.org -INFO Registering runner, arch=amd64, os=linux, version=3.3.0. +INFO Registering runner, arch=amd64, os=linux, version=. DEBUG Successfully pinged the Forgejo instance server INFO Runner registered successfully. $ ./forgejo-runner generate-config > config.yml @@ -84,13 +92,13 @@ $ ./forgejo-runner generate-config > config.yml ### Docker ```bash -$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/data --rm code.forgejo.org/forgejo/runner:3.3.0 forgejo-runner register --no-interactive --token {TOKEN} --name {NAME} --instance https://codeberg.org -Status: Downloaded newer image for code.forgejo.org/forgejo/runner:3.3.0 -level=info msg="Registering runner, arch=arm64, os=linux, version=v3.3.0." +$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/data --rm code.forgejo.org/forgejo/runner:${RUNNER_VERSION} forgejo-runner register --no-interactive --token {TOKEN} --name {NAME} --instance https://codeberg.org +Status: Downloaded newer image for code.forgejo.org/forgejo/runner: +level=info msg="Registering runner, arch=arm64, os=linux, version=." level=warning msg="Runner in user-mode." level=debug msg="Successfully pinged the Forgejo instance server" level=info msg="Runner registered successfully." -$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/data --rm code.forgejo.org/forgejo/runner:3.3.0 forgejo-runner generate-config > config.yml +$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/data --rm code.forgejo.org/forgejo/runner:${RUNNER_VERSION} forgejo-runner generate-config > config.yml ``` --- @@ -131,7 +139,7 @@ $ 996(docker) Make sure to replace `996` with the Docker group GID of the host in the following command: ```bash -$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock --user 1000:996 -v $PWD:/data --rm code.forgejo.org/forgejo/runner:3.3.0 forgejo-runner --config config.yml daemon +$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock --user 1000:996 -v $PWD:/data --rm code.forgejo.org/forgejo/runner:${RUNNER_VERSION} forgejo-runner --config config.yml daemon 22eae46a021294a213e7f733203f7551250b67367c7507b53b5fd427f0f82d2e ``` @@ -141,7 +149,8 @@ Now your CI Runner should be running in a new container. Using Docker Compose, we can configure the Runner container to execute workflows inside another layer of containers (Docker-in-Docker). -Here is an example snippet of how it can be configured: +Here is an example snippet of how it can be configured. It will automatically use the latest version of the runner, feel +free to specify the version of the forgejo runner if you need: ```yaml version: '3' @@ -154,7 +163,7 @@ services: - certs:/certs runner: - image: code.forgejo.org/forgejo/runner:3.3.0 + image: code.forgejo.org/forgejo/runner environment: DOCKER_HOST: tcp://docker:2376 DOCKER_TLS_VERIFY: 1 @@ -181,7 +190,8 @@ Keep in mind that this is a potential security issue that can allow a malicious {% endadmonition %} -Here is an example snippet of how it can be configured: +Here is an example snippet of how it can be configured. It will automatically use the latest version of the runner, feel +free to specify the version of the forgejo runner if you need: ```yaml apiVersion: v1 @@ -217,7 +227,7 @@ spec: emptyDir: {} initContainers: - name: runner-config-generation - image: code.forgejo.org/forgejo/runner:3.3.0 + image: code.forgejo.org/forgejo/runner command: ['forgejo-runner create-runner-file --instance $FORGEJO_INSTANCE_URL --secret $RUNNER_SECRET --connect'] env: @@ -233,7 +243,7 @@ spec: mountPath: /data containers: - name: runner - image: code.forgejo.org/forgejo/runner:3.3.0 + image: code.forgejo.org/forgejo/runner command: [ 'sh',