From 429d5584e18312b1f544d4e12f522b71c63e8acb Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Tue, 28 Jan 2025 17:16:51 +0000 Subject: [PATCH] feat: actions: add LXC backend example (#520) Without such an example, there is no test that would verify a modification of the ACT LXC backend is working when running a cascading pull request. Trace of the run at: https://code.forgejo.org/forgejo/end-to-end/actions/runs/2433/jobs/2#jobstep-4-28 Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/520 Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- actions/actions.sh | 2 +- .../example-lxc/.forgejo/workflows/test.yml | 7 +++++ actions/example-lxc/runner-config.yaml | 31 +++++++++++++++++++ actions/example-lxc/setup.sh | 1 + actions/example-lxc/teardown.sh | 1 + 5 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 actions/example-lxc/.forgejo/workflows/test.yml create mode 100644 actions/example-lxc/runner-config.yaml create mode 100755 actions/example-lxc/setup.sh create mode 100755 actions/example-lxc/teardown.sh diff --git a/actions/actions.sh b/actions/actions.sh index e62debf4..0b505080 100755 --- a/actions/actions.sh +++ b/actions/actions.sh @@ -143,7 +143,7 @@ function test_actions() { done fi - for example in echo config-options cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do + for example in echo lxc config-options cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context; do run actions_verify_example $example done diff --git a/actions/example-lxc/.forgejo/workflows/test.yml b/actions/example-lxc/.forgejo/workflows/test.yml new file mode 100644 index 00000000..da81c6ea --- /dev/null +++ b/actions/example-lxc/.forgejo/workflows/test.yml @@ -0,0 +1,7 @@ +on: [push] + +jobs: + build: + runs-on: lxc + steps: + - run: systemctl --no-pager list-units diff --git a/actions/example-lxc/runner-config.yaml b/actions/example-lxc/runner-config.yaml new file mode 100644 index 00000000..6698ed20 --- /dev/null +++ b/actions/example-lxc/runner-config.yaml @@ -0,0 +1,31 @@ + +log: + level: debug + job_level: debug + +runner: + file: .runner + capacity: 1 + env_file: .env + timeout: 3h + insecure: false + fetch_timeout: 5s + fetch_interval: 2s + labels: ["lxc:lxc://debian:bookworm:docker"] + +cache: + enabled: false + dir: "" + host: "" + port: 0 + +container: + network: "bridge" + privileged: false + options: + workdir_parent: + valid_volumes: ["/srv/example"] + docker_host: "" + +host: + workdir_parent: diff --git a/actions/example-lxc/setup.sh b/actions/example-lxc/setup.sh new file mode 100755 index 00000000..9c1f5adf --- /dev/null +++ b/actions/example-lxc/setup.sh @@ -0,0 +1 @@ +FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload diff --git a/actions/example-lxc/teardown.sh b/actions/example-lxc/teardown.sh new file mode 100755 index 00000000..b410c513 --- /dev/null +++ b/actions/example-lxc/teardown.sh @@ -0,0 +1 @@ +forgejo-runner.sh reload