From dd31a59c1ebade99c1f12de42a9947c41bcbe1a6 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Wed, 2 Jul 2025 10:53:36 +0000 Subject: [PATCH] actions: config-options: test for envs and env-file (#722) Refs: forgejo/runner#287 Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/722 Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- .../example-config-options/.forgejo/workflows/test.yml | 8 ++++++++ actions/example-config-options/env_file | 1 + actions/example-config-options/runner-config.yaml | 4 +++- actions/example-config-options/setup.sh | 5 ++++- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 actions/example-config-options/env_file diff --git a/actions/example-config-options/.forgejo/workflows/test.yml b/actions/example-config-options/.forgejo/workflows/test.yml index d9c03241..63bbc212 100644 --- a/actions/example-config-options/.forgejo/workflows/test.yml +++ b/actions/example-config-options/.forgejo/workflows/test.yml @@ -11,6 +11,14 @@ jobs: - run: | ! test -f /srv/example-config-options-volume-invalid - run: | + set -x test "$FROB" = "NITZ" - run: | + set -x + test "$VAR_FROM_ENV_FILE" = "VALUE_FROM_ENV_FILE" + - run: | + set -x + test "$VAR_FROM_ENV_IN_CONFIG" = "VALUE_FROM_ENV_IN_CONFIG" + - run: | + set -x test "$(cat /etc/hostname)" = customname diff --git a/actions/example-config-options/env_file b/actions/example-config-options/env_file new file mode 100644 index 00000000..c5b811ba --- /dev/null +++ b/actions/example-config-options/env_file @@ -0,0 +1 @@ +VAR_FROM_ENV_FILE=VALUE_FROM_ENV_FILE diff --git a/actions/example-config-options/runner-config.yaml b/actions/example-config-options/runner-config.yaml index 0daf906f..ec5d1c5d 100644 --- a/actions/example-config-options/runner-config.yaml +++ b/actions/example-config-options/runner-config.yaml @@ -6,7 +6,9 @@ log: runner: file: .runner capacity: 1 - env_file: .env + envs: + VAR_FROM_ENV_IN_CONFIG: VALUE_FROM_ENV_IN_CONFIG + env_file: env_file timeout: 3h insecure: true fetch_timeout: 5s diff --git a/actions/example-config-options/setup.sh b/actions/example-config-options/setup.sh index d9f6ea9c..1e62e683 100755 --- a/actions/example-config-options/setup.sh +++ b/actions/example-config-options/setup.sh @@ -1,3 +1,6 @@ >/srv/example-config-options-volume-valid >/srv/example-config-options-volume-invalid -FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload +TMPDIR=$(mktemp -d) +cp $EXAMPLE_DIR/runner-config.yaml $EXAMPLE_DIR/env_file $TMPDIR +sed -i -e "s|env_file:.*|env_file: $TMPDIR/env_file|" $TMPDIR/runner-config.yaml +FORGEJO_RUNNER_CONFIG=$TMPDIR/runner-config.yaml forgejo-runner.sh reload