From 41c556d3bcc61a5fe13b44b709ac10ee30e83df3 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Sat, 22 Apr 2023 18:45:39 +0000 Subject: [PATCH] gitea_runner: Add config --- roles/gitea_runner/files/act_runner.service | 2 +- roles/gitea_runner/files/config.yml | 44 +++++++++++++++++++++ roles/gitea_runner/tasks/main.yml | 9 +++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 roles/gitea_runner/files/config.yml diff --git a/roles/gitea_runner/files/act_runner.service b/roles/gitea_runner/files/act_runner.service index f2495e8..1533c88 100644 --- a/roles/gitea_runner/files/act_runner.service +++ b/roles/gitea_runner/files/act_runner.service @@ -8,7 +8,7 @@ User=act_runner Group=act_runner WorkingDirectory=/var/lib/act_runner Environment=HOME=/var/lib/act_runner -ExecStart=/usr/local/bin/act_runner daemon +ExecStart=/usr/local/bin/act_runner daemon -c /var/lib/act_runner/config.yml [Install] WantedBy=multi-user.target diff --git a/roles/gitea_runner/files/config.yml b/roles/gitea_runner/files/config.yml new file mode 100644 index 0000000..3abe939 --- /dev/null +++ b/roles/gitea_runner/files/config.yml @@ -0,0 +1,44 @@ +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 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: 3h + # 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 + +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 + +container: + # Which network to use for the job containers. Could be bridge, host, none, or the name of a custom network. + network_mode: bridge + # Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker). + privileged: false + # And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway). + options: diff --git a/roles/gitea_runner/tasks/main.yml b/roles/gitea_runner/tasks/main.yml index e0a4664..740a914 100644 --- a/roles/gitea_runner/tasks/main.yml +++ b/roles/gitea_runner/tasks/main.yml @@ -52,6 +52,15 @@ group: act_runner notify: Restart act_runner +- name: Copy config file + ansible.builtin.copy: + dest: /var/lib/act_runner/config.yml + src: config.yml + mode: 0640 + owner: root + group: act_runner + notify: Restart act_runner + - name: Create cache directory ansible.builtin.file: path: /var/lib/act_runner/.cache