From a0e37082027518ace235862512acb9326e04f4ca Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Thu, 30 Nov 2023 08:52:03 +0100 Subject: [PATCH] feat(forgejo): add amd64 runners --- forgejo/config/runners/config-amd64.yaml | 94 +++++++++++++++++++ .../{config.yaml => config-arm64.yaml} | 6 +- forgejo/config/values.forgejo.yaml | 1 + forgejo/kustomization.yaml | 15 +-- .../resources/runners/act-runner-amd64.yaml | 88 +++++++++++++++++ ...{act-runner.yaml => act-runner-arm64.yaml} | 4 +- .../runners/runner-registrations.enc.yaml | 9 +- .../resources/runners/runner-token.enc.yaml | 36 ------- vaultwarden/config/api-env.enc.yaml | 13 ++- vaultwarden/resources/ingress.yaml | 6 ++ 10 files changed, 220 insertions(+), 52 deletions(-) create mode 100644 forgejo/config/runners/config-amd64.yaml rename forgejo/config/runners/{config.yaml => config-arm64.yaml} (94%) create mode 100644 forgejo/resources/runners/act-runner-amd64.yaml rename forgejo/resources/runners/{act-runner.yaml => act-runner-arm64.yaml} (95%) delete mode 100644 forgejo/resources/runners/runner-token.enc.yaml diff --git a/forgejo/config/runners/config-amd64.yaml b/forgejo/config/runners/config-amd64.yaml new file mode 100644 index 0000000..2ed615b --- /dev/null +++ b/forgejo/config/runners/config-amd64.yaml @@ -0,0 +1,94 @@ +# Example configuration file, it's safe to copy this as the default config file without any modification. + +# You don't have to copy this file to your instance, +# just run `./act_runner generate-config > config.yaml` to generate a config file. + +log: + # The level of logging, can be trace, debug, info, warn, error, fatal + level: info + +runner: + # Where to store the registration result. + file: .runner + # Execute how many tasks concurrently at the same time. + capacity: 1 + # Extra environment variables to run jobs. + envs: + DOCKER_HOST: tcp://localhost:2376 + DOCKER_TLS_VERIFY: "1" + DOCKER_CERT_PATH : /certs/client + # Extra environment variables to run jobs from a file. + # It will be ignored if it's empty or the file doesn't exist. + env_file: .env + # The timeout for a job to be finished. + # Please note that the Gitea instance also has a timeout (3h by default) for the job. + # So the job could be stopped by the Gitea instance if it's timeout is shorter than this. + timeout: 10m + # Whether skip verifying the TLS certificate of the Gitea instance. + insecure: false + # The timeout for fetching the job from the Gitea instance. + fetch_timeout: 5s + # The interval for fetching the job from the Gitea instance. + fetch_interval: 2s + # The labels of a runner are used to determine which jobs the runner can run, and how to run them. + # Like: ["macos-arm64:host", "ubuntu-latest:docker://node:16-bullseye", "ubuntu-22.04:docker://node:16-bullseye"] + # If it's empty when registering, it will ask for inputting labels. + # If it's empty when execute `deamon`, will use labels in `.runner` file. + labels: + - "ubuntu-latest-amd64:docker://code.icb4dc0.de/infrastructure/images/act_runtime:amd64" + - "ubuntu-22.04-amd64:docker://code.icb4dc0.de/infrastructure/images/act_runtime:amd64" + - "ubuntu-20.04-amd64:docker://code.icb4dc0.de/infrastructure/images/act_runtime:20.04-amd64" + +cache: + # Enable cache server to use actions/cache. + enabled: true + # The directory to store the cache data. + # If it's empty, the cache data will be stored in $HOME/.cache/actcache. + dir: "" + # The host of the cache server. + # It's not for the address to listen, but the address to connect from job containers. + # So 0.0.0.0 is a bad choice, leave it empty to detect automatically. + host: "" + # The port of the cache server. + # 0 means to use a random available port. + port: 0 + # The external cache server URL. Valid only when enable is true. + # If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself. + # The URL should generally end with "/". + external_server: "http://act-runner-cache.forgejo.svc:8080/" + +container: + # Specifies the network to which the container will connect. + # Could be host, bridge or the name of a custom network. + # If it's empty, act_runner will create a network automatically. + network: "host" + # Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker). + privileged: true + # And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway). + options: "--volume=/certs/client/:/certs/client/:ro" + # The parent directory of a job's working directory. + # If it's empty, /workspace will be used. + workdir_parent: + # Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob + # You can specify multiple volumes. If the sequence is empty, no volumes can be mounted. + # For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to: + # valid_volumes: + # - data + # - /src/*.json + # If you want to allow any volume, please use the following configuration: + # valid_volumes: + # - '**' + valid_volumes: + - /certs/client/ + # overrides the docker client host with the specified one. + # If it's empty, act_runner will find an available docker host automatically. + # If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers. + # If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work. + docker_host: "" + # Pull docker image(s) even if already present + force_pull: true + +host: + # The parent directory of a job's working directory. + # If it's empty, $HOME/.cache/act/ will be used. + workdir_parent: \ No newline at end of file diff --git a/forgejo/config/runners/config.yaml b/forgejo/config/runners/config-arm64.yaml similarity index 94% rename from forgejo/config/runners/config.yaml rename to forgejo/config/runners/config-arm64.yaml index 26f7a02..2c2478d 100644 --- a/forgejo/config/runners/config.yaml +++ b/forgejo/config/runners/config-arm64.yaml @@ -35,9 +35,9 @@ runner: # If it's empty when registering, it will ask for inputting labels. # If it's empty when execute `deamon`, will use labels in `.runner` file. labels: - - "ubuntu-latest:docker://code.icb4dc0.de/infrastructure/images/act_runtime:latest" - - "ubuntu-22.04:docker://code.icb4dc0.de/infrastructure/images/act_runtime:latest" - - "ubuntu-20.04:docker://code.icb4dc0.de/infrastructure/images/act_runtime:latest" + - "ubuntu-latest:docker://code.icb4dc0.de/infrastructure/images/act_runtime:arm64" + - "ubuntu-22.04:docker://code.icb4dc0.de/infrastructure/images/act_runtime:arm64" + - "ubuntu-20.04:docker://code.icb4dc0.de/infrastructure/images/act_runtime:20.04-arm64" cache: # Enable cache server to use actions/cache. diff --git a/forgejo/config/values.forgejo.yaml b/forgejo/config/values.forgejo.yaml index b79b876..41f7a06 100644 --- a/forgejo/config/values.forgejo.yaml +++ b/forgejo/config/values.forgejo.yaml @@ -1,5 +1,6 @@ image: rootless: true + tag: "1.21.1-0" service: ssh: diff --git a/forgejo/kustomization.yaml b/forgejo/kustomization.yaml index 8ddec18..a6420e4 100644 --- a/forgejo/kustomization.yaml +++ b/forgejo/kustomization.yaml @@ -4,31 +4,34 @@ kind: Kustomization namespace: forgejo commonLabels: - app.kubernetes.io/instance: icb4dc0de app.kubernetes.io/managed-by: kustomize images: - name: act_runner newName: docker.io/gitea/act_runner - newTag: nightly + newTag: "nightly" resources: - - resources/runners/act-runner.yaml + - resources/runners/act-runner-arm64.yaml + - resources/runners/act-runner-amd64.yaml - resources/runners/cache-pvc.yaml - resources/runners/act-cache.yaml - resources/runners/act-cache-svc.yaml configMapGenerator: -- name: act-runner-config +- name: act-runner-config-arm64 files: - - config/runners/config.yaml + - config.yaml=config/runners/config-arm64.yaml +- name: act-runner-config-amd64 + files: + - config.yaml=config/runners/config-amd64.yaml helmCharts: - name: forgejo repo: oci://codeberg.org/forgejo-contrib releaseName: forgejo namespace: forgejo - version: "0.13.0" + version: "0.15.0" valuesFile: config/values.forgejo.yaml skipTests: true apiVersions: diff --git a/forgejo/resources/runners/act-runner-amd64.yaml b/forgejo/resources/runners/act-runner-amd64.yaml new file mode 100644 index 0000000..c182296 --- /dev/null +++ b/forgejo/resources/runners/act-runner-amd64.yaml @@ -0,0 +1,88 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: act-runner-amd64 +spec: + selector: + matchLabels: + app.kubernetes.io/name: act-runner + app.kubernetes.io/instance: amd64 + serviceName: act-runner + replicas: 1 + template: + metadata: + labels: + app.kubernetes.io/name: act-runner + app.kubernetes.io/instance: amd64 + spec: + restartPolicy: Always + initContainers: + - name: runner-registration + image: docker.io/alpine:3.18 + command: + - /bin/ash + - -c + - "cp /etc/act/`hostname` /data/.runner" + volumeMounts: + - name: runner-data + mountPath: /data + - name: runner-registrations + mountPath: /etc/act + containers: + - name: runner + image: act_runner + imagePullPolicy: Always + command: ["sh", "-c", "while ! nc -z localhost 2376