From 0b2cb2782b0aef76626b3dd8bccaee1172aabbb8 Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 22 Oct 2024 13:26:47 +0100 Subject: [PATCH] enable runner --- Gitea-webserver.kube.yaml | 49 ++++++++++++++++++ gitea-runner-configfile.configmap.yaml | 72 ++++++++++++++++++++++++++ pvc.claim.yaml | 17 ++++++ 3 files changed, 138 insertions(+) create mode 100644 gitea-runner-configfile.configmap.yaml diff --git a/Gitea-webserver.kube.yaml b/Gitea-webserver.kube.yaml index 1672d57..c7e918e 100644 --- a/Gitea-webserver.kube.yaml +++ b/Gitea-webserver.kube.yaml @@ -73,6 +73,55 @@ spec: persistentVolumeClaim: claimName: gitea-data +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gitea-runner + namespace: gitea +spec: + replicas: 1 + selector: + matchLabels: + app: gitea-runner + template: + metadata: + labels: + app: gitea-runner + spec: + containers: + - name: gitea-runner + image: gitea/act_runner:nightly + imagePullPolicy: IfNotPresent + env: + - name: CONFIG_FILE + value: /config/config.yaml + - name: GITEA_INSTANCE_URL + value: "https://gitea.tryton.geeraert.eu/" + - name: GITEA_RUNNER_REGISTRATION_TOKEN + value: "2lLHg3Zt4mqjz04cBVIi6UI11cDOwIrwvNY6FMTH" + - name: GITEA_RUNNER_NAME + value: "runner" + - name: GITEA_RUNNER_LABELS + value: "label" + volumeMounts: + - name: gitea-runner-data + mountPath: /data/ + - name: gitea-var-docker-sock + mountPath: /var/run/docker.sock + - name: gitea-runner-configfile + mountPath: /config + volumes: + - name: gitea-var-docker-sock + hostPath: + path: /var/run/docker.sock + - name: gitea-runner-data + persistentVolumeClaim: + claimName: gitea-runner-data + - name: gitea-runner-configfile + configMap: + name: gitea-runner-configfile + defaultMode: 0555 --- apiVersion: v1 diff --git a/gitea-runner-configfile.configmap.yaml b/gitea-runner-configfile.configmap.yaml new file mode 100644 index 0000000..d674efe --- /dev/null +++ b/gitea-runner-configfile.configmap.yaml @@ -0,0 +1,72 @@ +#generated using this command : +# docker run --entrypoint="" --rm -it gitea/act_runner:latest act_runner generate-config > config.yaml +apiVersion: v1 +data: + config.yaml: "# Example configuration file, it's safe to copy this as the default + config file without any modification.\r\n\r\n# You don't have to copy this file + to your instance,\r\n# just run `./act_runner generate-config > config.yaml` to + generate a config file.\r\n\r\nlog:\r\n # The level of logging, can be trace, + debug, info, warn, error, fatal\r\n level: info\r\n\r\nrunner:\r\n # Where to + store the registration result.\r\n file: .runner\r\n # Execute how many tasks + concurrently at the same time.\r\n capacity: 1\r\n # Extra environment variables + to run jobs.\r\n envs:\r\n A_TEST_ENV_NAME_1: a_test_env_value_1\r\n A_TEST_ENV_NAME_2: + a_test_env_value_2\r\n # Extra environment variables to run jobs from a file.\r\n + \ # It will be ignored if it's empty or the file doesn't exist.\r\n env_file: + .env\r\n # The timeout for a job to be finished.\r\n # Please note that the + Gitea instance also has a timeout (3h by default) for the job.\r\n # So the job + could be stopped by the Gitea instance if it's timeout is shorter than this.\r\n + \ timeout: 3h\r\n # The timeout for the runner to wait for running jobs to finish + when shutting down.\r\n # Any running jobs that haven't finished after this timeout + will be cancelled.\r\n shutdown_timeout: 0s\r\n # Whether skip verifying the + TLS certificate of the Gitea instance.\r\n insecure: false\r\n # The timeout + for fetching the job from the Gitea instance.\r\n fetch_timeout: 5s\r\n # The + interval for fetching the job from the Gitea instance.\r\n fetch_interval: 2s\r\n + \ # The labels of a runner are used to determine which jobs the runner can run, + and how to run them.\r\n # Like: \"macos-arm64:host\" or \"ubuntu-latest:docker://gitea/runner-images:ubuntu-latest\"\r\n + \ # Find more images provided by Gitea at https://gitea.com/gitea/runner-images + .\r\n # If it's empty when registering, it will ask for inputting labels.\r\n + \ # If it's empty when execute `daemon`, will use labels in `.runner` file.\r\n + \ labels:\r\n - \"ubuntu-latest:docker://gitea/runner-images:ubuntu-latest\"\r\n + \ - \"ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04\"\r\n - \"ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04\"\r\n\r\ncache:\r\n + \ # Enable cache server to use actions/cache.\r\n enabled: true\r\n # The directory + to store the cache data.\r\n # If it's empty, the cache data will be stored in + $HOME/.cache/actcache.\r\n dir: \"\"\r\n # The host of the cache server.\r\n + \ # It's not for the address to listen, but the address to connect from job containers.\r\n + \ # So 0.0.0.0 is a bad choice, leave it empty to detect automatically.\r\n host: + \"\"\r\n # The port of the cache server.\r\n # 0 means to use a random available + port.\r\n port: 0\r\n # The external cache server URL. Valid only when enable + is true.\r\n # If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL + rather than start a server by itself.\r\n # The URL should generally end with + \"/\".\r\n external_server: \"\"\r\n\r\ncontainer:\r\n # Specifies the network + to which the container will connect.\r\n # Could be host, bridge or the name + of a custom network.\r\n # If it's empty, act_runner will create a network automatically.\r\n + \ network: \"\"\r\n # Whether to use privileged mode or not when launching task + containers (privileged mode is required for Docker-in-Docker).\r\n privileged: + false\r\n # And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).\r\n + \ options:\r\n # The parent directory of a job's working directory.\r\n # NOTE: + There is no need to add the first '/' of the path as act_runner will add it automatically. + \r\n # If the path starts with '/', the '/' will be trimmed.\r\n # For example, + if the parent directory is /path/to/my/dir, workdir_parent should be path/to/my/dir\r\n + \ # If it's empty, /workspace will be used.\r\n workdir_parent:\r\n # Volumes + (including bind mounts) can be mounted to containers. Glob syntax is supported, + see https://github.com/gobwas/glob\r\n # You can specify multiple volumes. If + the sequence is empty, no volumes can be mounted.\r\n # 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:\r\n # valid_volumes:\r\n # - data\r\n # + \ - /src/*.json\r\n # If you want to allow any volume, please use the following + configuration:\r\n # valid_volumes:\r\n # - '**'\r\n valid_volumes: []\r\n + \ # overrides the docker client host with the specified one.\r\n # If it's empty, + act_runner will find an available docker host automatically.\r\n # 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.\r\n # If it's + not empty or \"-\", the specified docker host will be used. An error will be returned + if it doesn't work.\r\n docker_host: \"\"\r\n # Pull docker image(s) even if + already present\r\n force_pull: true\r\n # Rebuild docker image(s) even if already + present\r\n force_rebuild: false\r\n\r\nhost:\r\n # The parent directory of + a job's working directory.\r\n # If it's empty, $HOME/.cache/act/ will be used.\r\n + \ workdir_parent:\r\n" +kind: ConfigMap +metadata: + creationTimestamp: null + name: gitea-runner-configfile + namespace: gitea diff --git a/pvc.claim.yaml b/pvc.claim.yaml index 6f84789..9a693f1 100644 --- a/pvc.claim.yaml +++ b/pvc.claim.yaml @@ -2,6 +2,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: gitea-data + namespace: gitea spec: storageClassName: nfs-storage-intelligent accessModes: @@ -14,6 +15,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: gitea-db-data + namespace: gitea spec: storageClassName: nfs-storage-intelligent accessModes: @@ -23,10 +25,25 @@ spec: storage: 1Gi --- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: gitea-runner-data + namespace: gitea +spec: + storageClassName: nfs-storage-intelligent + accessModes: + - ReadWriteMany + resources: + requests: + storage: 100Mi +--- + kind: PersistentVolumeClaim apiVersion: v1 metadata: name: gitea-redis-data + namespace: gitea spec: storageClassName: nfs-storage-intelligent accessModes: