Skip to content

Commit 651dbe1

Browse files
authored
Merge pull request #427 from myoung34/fix_deregistration_on_reusable
Force DISABLE_AUTOMATIC_DEREGISTRATION to be true on reusable runners, add tests
2 parents b9c038d + 9ed37bc commit 651dbe1

File tree

6 files changed

+98
-2
lines changed

6 files changed

+98
-2
lines changed

.github/workflows/base.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ jobs:
7272
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
7373
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
7474
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.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
75+
if [ $? -ne 0 ]; then
76+
exit 1
77+
fi
7578
7679
debian_base_tests:
7780
runs-on: ubuntu-latest
@@ -133,6 +136,9 @@ jobs:
133136
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
134137
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
135138
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.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
139+
if [ $? -ne 0 ]; then
140+
exit 1
141+
fi
136142
137143
138144
ubuntu_base_latest_deploy:

.github/workflows/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,31 @@ jobs:
7575
echo "os: ubuntu" >goss_vars_${GH_RUNNER_IMAGE}.yaml
7676
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
7777
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
78+
# test the edge case from deregistration on reusable runners
79+
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_reusage_fail.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
80+
-e DEBUG_ONLY=true \
81+
-e ACCESS_TOKEN=notreal \
82+
-e LABELS=linux,x64 \
83+
-e REPO_URL=https://github.com/octokode/test1 \
84+
-e RUNNER_NAME=sustainjane-runner-1 \
85+
-e RUNNER_SCOPE=repo \
86+
-e RUNNER_WORKDIR=/tmp/runner/work \
87+
-e DISABLE_AUTOMATIC_DEREGISTRATION=false \
88+
-e CONFIGURED_ACTIONS_RUNNER_FILES_DIR=/runner/data \
89+
${GH_RUNNER_IMAGE} 10
90+
if [ $? -ne 0 ]; then
91+
exit 1
92+
fi
7893
# test the base
7994
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.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
95+
if [ $? -ne 0 ]; then
96+
exit 1
97+
fi
8098
# test the final image but with all defaults
8199
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_full_defaults.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true ${GH_RUNNER_IMAGE} 10
100+
if [ $? -ne 0 ]; then
101+
exit 1
102+
fi
82103
# test the final image but with non-default values
83104
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_full.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
84105
-e DEBUG_ONLY=true \
@@ -102,6 +123,9 @@ jobs:
102123
-e EPHEMERAL=true \
103124
-e DISABLE_AUTO_UPDATE=true \
104125
${GH_RUNNER_IMAGE} 10
126+
if [ $? -ne 0 ]; then
127+
exit 1
128+
fi
105129
106130
debian_tests:
107131
runs-on: ubuntu-latest
@@ -163,6 +187,21 @@ jobs:
163187
echo "os: debian" >goss_vars_${GH_RUNNER_IMAGE}.yaml
164188
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
165189
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
190+
# test the edge case from deregistration on reusable runners
191+
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_reusage_fail.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
192+
-e DEBUG_ONLY=true \
193+
-e ACCESS_TOKEN=notreal \
194+
-e LABELS=linux,x64 \
195+
-e REPO_URL=https://github.com/octokode/test1 \
196+
-e RUNNER_NAME=sustainjane-runner-1 \
197+
-e RUNNER_SCOPE=repo \
198+
-e RUNNER_WORKDIR=/tmp/runner/work \
199+
-e DISABLE_AUTOMATIC_DEREGISTRATION=false \
200+
-e CONFIGURED_ACTIONS_RUNNER_FILES_DIR=/runner/data \
201+
${GH_RUNNER_IMAGE} 10
202+
if [ $? -ne 0 ]; then
203+
exit 1
204+
fi
166205
# test the base
167206
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.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
168207
# test the final image but with all defaults

.github/workflows/test.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,31 @@ jobs:
7777
echo "os: ubuntu" >goss_vars_${GH_RUNNER_IMAGE}.yaml
7878
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
7979
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
80+
# test the edge case from deregistration on reusable runners
81+
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_reusage_fail.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
82+
-e DEBUG_ONLY=true \
83+
-e ACCESS_TOKEN=notreal \
84+
-e LABELS=linux,x64 \
85+
-e REPO_URL=https://github.com/octokode/test1 \
86+
-e RUNNER_NAME=sustainjane-runner-1 \
87+
-e RUNNER_SCOPE=repo \
88+
-e RUNNER_WORKDIR=/tmp/runner/work \
89+
-e DISABLE_AUTOMATIC_DEREGISTRATION=false \
90+
-e CONFIGURED_ACTIONS_RUNNER_FILES_DIR=/runner/data \
91+
${GH_RUNNER_IMAGE} 10
92+
if [ $? -ne 0 ]; then
93+
exit 1
94+
fi
8095
# test the base
8196
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.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
97+
if [ $? -ne 0 ]; then
98+
exit 1
99+
fi
82100
# test the final image but with all defaults
83101
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_full_defaults.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep -e RUNNER_NAME=test -e DEBUG_ONLY=true ${GH_RUNNER_IMAGE} 10
102+
if [ $? -ne 0 ]; then
103+
exit 1
104+
fi
84105
# test the final image but with non-default values
85106
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_full.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
86107
-e DEBUG_ONLY=true \
@@ -104,7 +125,9 @@ jobs:
104125
-e EPHEMERAL=true \
105126
-e DISABLE_AUTO_UPDATE=true \
106127
${GH_RUNNER_IMAGE} 10
107-
128+
if [ $? -ne 0 ]; then
129+
exit 1
130+
fi
108131
debian_tests:
109132
runs-on: ubuntu-latest
110133
strategy:
@@ -168,6 +191,21 @@ jobs:
168191
echo "os: debian" >goss_vars_${GH_RUNNER_IMAGE}.yaml
169192
echo "oscodename: ${{ matrix.release }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
170193
echo "arch: ${{ matrix.platform }}" >>goss_vars_${GH_RUNNER_IMAGE}.yaml
194+
# test the edge case from deregistration on reusable runners
195+
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.yaml GOSS_FILE=goss_reusage_fail.yaml GOSS_SLEEP=1 dgoss run --entrypoint /usr/bin/sleep \
196+
-e DEBUG_ONLY=true \
197+
-e ACCESS_TOKEN=notreal \
198+
-e LABELS=linux,x64 \
199+
-e REPO_URL=https://github.com/octokode/test1 \
200+
-e RUNNER_NAME=sustainjane-runner-1 \
201+
-e RUNNER_SCOPE=repo \
202+
-e RUNNER_WORKDIR=/tmp/runner/work \
203+
-e DISABLE_AUTOMATIC_DEREGISTRATION=false \
204+
-e CONFIGURED_ACTIONS_RUNNER_FILES_DIR=/runner/data \
205+
${GH_RUNNER_IMAGE} 10
206+
if [ $? -ne 0 ]; then
207+
exit 1
208+
fi
171209
# test the base
172210
GOSS_VARS=goss_vars_${GH_RUNNER_IMAGE}.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
173211
# test the final image but with all defaults

entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ fi
210210

211211
if [[ -n "${_CONFIGURED_ACTIONS_RUNNER_FILES_DIR}" ]]; then
212212
echo "Reusage is enabled. Storing data to ${_CONFIGURED_ACTIONS_RUNNER_FILES_DIR}"
213+
if [[ ${_DISABLE_AUTOMATIC_DEREGISTRATION} == "false" ]]; then
214+
echo "DISABLE_AUTOMATIC_DEREGISTRATION should be set to true to avoid issues with re-using a deregistered runner."
215+
exit 1
216+
fi
213217
# Quoting (even with double-quotes) the regexp brokes the copying
214218
cp -p -r "/actions-runner/_diag" "/actions-runner/svc.sh" /actions-runner/.[^.]* "${_CONFIGURED_ACTIONS_RUNNER_FILES_DIR}"
215219
fi

goss_reusage_fail.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
command:
2+
/entrypoint.sh something:
3+
exit-status: 1
4+
stdout:
5+
- "Runner reusage is enabled"
6+
- "Reusage is enabled. Storing data to /runner/data"
7+
- "DISABLE_AUTOMATIC_DEREGISTRATION should be set to true to avoid issues with re-using a deregistered runner."
8+
stderr: ""
9+
timeout: 2000

install_actions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ curl -L "https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSIO
1010
tar -zxf actions.tar.gz
1111
rm -f actions.tar.gz
1212
./bin/installdependencies.sh
13-
mkdir /_work
13+
mkdir -p /_work

0 commit comments

Comments
 (0)