Skip to content

Commit 9249e44

Browse files
authored
Ensure runner installer by adding a second task. (#5)
1 parent 40f9a7c commit 9249e44

4 files changed

Lines changed: 28 additions & 22 deletions

File tree

.github/workflows/tests.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ jobs:
2626

2727
strategy:
2828
matrix:
29-
runner: [1,2,3,4,5]
29+
runner: [1,2,3]
3030
steps:
3131
- uses: actions/checkout@v4
3232

3333
- name: Debug
3434
run: |
35-
echo "Who am I: $(whoami)"
36-
echo "Hostname: $(hostname -f)"
37-
echo "Environment:"
38-
env
35+
echo "Who am I: $(whoami)@$(hostname -f)"
36+
echo "Where am I: $(pwd)"
37+
echo "Env:"
38+
env | grep GITHUB
3939
4040
- name: Help
4141
run: |
@@ -49,12 +49,19 @@ jobs:
4949
--name=${RUNNER_CONFIG_NAME} \
5050
--config-sh-options=--ephemeral
5151
52+
- name: Run again
53+
run: |
54+
./github-runner-installer \
55+
--run \
56+
--name=${RUNNER_CONFIG_NAME} \
57+
--config-sh-options=--ephemeral
58+
5259
run:
5360
name: Run Tasks
5461
runs-on: "jonpugh@github-runner.${{ github.run_id }}"
5562
strategy:
5663
matrix:
57-
runner: [1,2,3,4,5]
64+
runner: [1,2,3,4,5,6]
5865
steps:
5966
- uses: actions/checkout@v4
6067

@@ -64,3 +71,7 @@ jobs:
6471
echo "Hostname: $(hostname -f)"
6572
echo "Environment:"
6673
env
74+
75+
- name: A second task
76+
run: |
77+
echo "Confirmed."

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ RUN chown runner:runner . -R
1717
# GitHub Runner code.
1818
# Install runner to a path that won't ever be in a volume.
1919
ENV RUNNER_PATH /usr/share/github-runner
20-
# We are installing as root then switching back because we need to use the install-dependencies script.
21-
RUN ./github-runner-installer --no-run --no-config --runner-path=${RUNNER_PATH}
22-
RUN ${RUNNER_PATH}/bin/installdependencies.sh
23-
RUN chown runner:runner ${RUNNER_PATH} -R
2420

21+
# Install Dependencies
22+
RUN curl https://raw.githubusercontent.com/actions/runner/refs/tags/v2.326.0/src/Misc/layoutbin/installdependencies.sh -o install-dependencies \
23+
&& bash install-dependencies
24+
25+
# Run github-runner-installer script.
26+
#RUN ./github-runner-installer --no-run --no-config --runner-path=${RUNNER_PATH}
27+
28+
# Change runner ownership & Switch user.
29+
# RUN chown runner:runner ${RUNNER_PATH} -R
2530
USER runner

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
- ./:/github-runner-installer
1111
environment:
1212
GITHUB_TOKEN: ${GITHUB_TOKEN}
13-
GITHUB_REPOSITORY: jonpugh/github-runner
13+
GITHUB_REPOSITORY: operations-project/github-runner-installer
1414
RUNNER_CONFIG_LABELS: ${RUNNER_CONFIG_LABELS:-runner@localhost}
1515
entrypoint: ./docker-entrypoint
1616
command: ./github-runner-installer

github-runner-installer

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ verify() {
9393
# Defaults. If ENV vars exist, use them. If not, use these values.
9494
RUNNER_PATH=${RUNNER_PATH:-"runner"}
9595
RUNNER_CONFIG_NAME=${RUNNER_CONFIG_NAME:-$(whoami)@$(hostname -f)}
96-
RUNNER_CONFIG_LABELS=${RUNNER_CONFIG_LABELS:-"jonpugh/github-runner-installer"}
96+
RUNNER_CONFIG_LABELS=${RUNNER_CONFIG_LABELS:-"operations-project/github-runner-installer"}
9797
RUNNER_CONFIG_OPTIONS=${RUNNER_CONFIG_OPTIONS:-""}
9898

9999
# Whether to run the runner
@@ -278,17 +278,7 @@ download() {
278278
configure() {
279279
line
280280
say Configuring GitHub runner...
281-
say Removing existing runner...
282-
283-
# Remove
284-
# @TODO: If runner has a job, wait for it to complete.
285281
cd $RUNNER_FOLDER
286-
echo ./config.sh remove --token ${RUNNER_CONFIG_TOKEN}
287-
./config.sh remove --token ${RUNNER_CONFIG_TOKEN} || say "config remove didn't work."
288-
289-
rm -rf .credentials .runner
290-
line
291-
say Configuring new runner...
292282

293283
# Configure
294284
CMD="./config.sh \

0 commit comments

Comments
 (0)