From c69304a30826743c2db73077d7a4d17294237042 Mon Sep 17 00:00:00 2001 From: Marcus Young Date: Mon, 9 Sep 2024 11:33:47 -0500 Subject: [PATCH 1/2] Add runner dir test output to goss --- README.md | 8 ++++++-- goss_full.yaml | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a23e2cb..6403b58e 100644 --- a/README.md +++ b/README.md @@ -87,16 +87,20 @@ The test file expects the image to test as an environment variable `GH_RUNNER_IM To test: ``` +$ # need to set minimum vars for the goss test interpolation +$ echo "os: ubuntu" >goss_vars.yaml +$ echo "oscodename: focal >>goss_vars.yaml +$ echo "arch: x86_64" >>goss_vars.yaml $ docker build -t my-base-test -f Dockerfile.base . $ # Run the base test from Dockerfile.base on the current git HEAD -$ GH_RUNNER_IMAGE="my-base-test" GOSS_FILE=goss_base.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true \ +$ GH_RUNNER_IMAGE="my-base-test" GOSS_VARS=goss_vars.yaml GOSS_FILE=goss_base.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true \ ${GH_RUNNER_IMAGE} \ 10 $ # Use the base image in your final $ sed -i.bak 's/^FROM.*/FROM my-base-test/g' Dockerfile $ docker build -t my-full-test -f Dockerfile . $ # Run the full test from Dockerfile.base on the current git HEAD -$ GH_RUNNER_IMAGE="my-full-test" GOSS_FILE=goss_full.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \ +$ GH_RUNNER_IMAGE="my-full-test" GOSS_VARS=goss_vars.yaml GOSS_FILE=goss_full.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \ -e DEBUG_ONLY=true \ -e RUNNER_NAME=huzzah \ -e REPO_URL=https://github.com/myoung34/docker-github-actions-runner \ diff --git a/goss_full.yaml b/goss_full.yaml index ade6f0fe..bea2f4df 100644 --- a/goss_full.yaml +++ b/goss_full.yaml @@ -6,6 +6,7 @@ command: - "" - "Disable automatic registration: true" - "Random runner suffix: true" + - "Runner workdir: /tmp/a" - "Runner name: huzzah" - "Labels: blue,green" - "Runner Group: wat" From 583d89963039a11701c98ddffa351ece66f7d3db Mon Sep 17 00:00:00 2001 From: Mark Young Date: Mon, 9 Sep 2024 13:33:24 -0500 Subject: [PATCH 2/2] Fix temp dir location for tests --- .github/workflows/deploy.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0a5358db..44feb9e5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -86,7 +86,7 @@ jobs: -e ENTERPRISE_NAME=emyoung34 \ -e LABELS=blue,green \ -e RUNNER_TOKEN=3456 \ - -e RUNNER_WORKDIR=tmp/a \ + -e RUNNER_WORKDIR=/tmp/a \ -e RUNNER_GROUP=wat \ -e GITHUB_HOST=github.example.com \ -e DISABLE_AUTOMATIC_DEREGISTRATION=true \ @@ -165,7 +165,7 @@ jobs: -e ENTERPRISE_NAME=emyoung34 \ -e LABELS=blue,green \ -e RUNNER_TOKEN=3456 \ - -e RUNNER_WORKDIR=tmp/a \ + -e RUNNER_WORKDIR=/tmp/a \ -e RUNNER_GROUP=wat \ -e GITHUB_HOST=github.example.com \ -e DISABLE_AUTOMATIC_DEREGISTRATION=true \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c86bd402..cd70af70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,7 +89,7 @@ jobs: -e ENTERPRISE_NAME=emyoung34 \ -e LABELS=blue,green \ -e RUNNER_TOKEN=3456 \ - -e RUNNER_WORKDIR=tmp/a \ + -e RUNNER_WORKDIR=/tmp/a \ -e RUNNER_GROUP=wat \ -e GITHUB_HOST=github.example.com \ -e DISABLE_AUTOMATIC_DEREGISTRATION=true \ @@ -172,7 +172,7 @@ jobs: -e ENTERPRISE_NAME=emyoung34 \ -e LABELS=blue,green \ -e RUNNER_TOKEN=3456 \ - -e RUNNER_WORKDIR=tmp/a \ + -e RUNNER_WORKDIR=/tmp/a \ -e RUNNER_GROUP=wat \ -e GITHUB_HOST=github.example.com \ -e DISABLE_AUTOMATIC_DEREGISTRATION=true \