Skip to content

Commit ed5fdad

Browse files
adjusted cat script and service file
1 parent 3e3faad commit ed5fdad

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

.github/scripts/ppc64le/self-hosted-builder/[email protected]

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[Unit]
22
Description=Self-Hosted IBM power Github Actions Runner
3-
3+
After=network.target docker.service
4+
Requires=docker.service
45
StartLimitIntervalSec=0
56

67
[Service]
@@ -9,6 +10,10 @@ Restart=always
910
ExecStartPre=-/usr/bin/docker rm --force actions-runner.%i
1011
ExecStartPre=-/usr/local/bin/gh_token_generator.sh /etc/actions-runner/%i/appid.env /etc/actions-runner/%i/installid.env /etc/actions-runner/%i/key_private.pem /etc/actions-runner/%i/ghtoken.env
1112
ExecStartPre=-/usr/local/bin/gh_cat_token.sh /etc/actions-runner/%i/ghtoken.env /etc/actions-runner/%i/ghtoken.socket
13+
14+
# Add a short delay to ensure the token is written
15+
ExecStartPre=/bin/sleep 2
16+
1217
ExecStart=/usr/bin/docker run \
1318
--env-file=/etc/actions-runner/%i/env \
1419
--volume /etc/actions-runner/%i/ghtoken.socket:/run/runner_secret \
@@ -17,10 +22,15 @@ ExecStart=/usr/bin/docker run \
1722
--name=actions-runner.%i \
1823
--rm \
1924
--privileged \
25+
--log-driver=journald \
2026
iiilinuxibmcom/actions-runner.%i
2127
ExecStop=/bin/sh -c "docker exec actions-runner.%i kill -INT -- -1"
2228
ExecStop=/bin/sh -c "docker wait actions-runner.%i"
2329
ExecStop=/bin/sh -c "docker rm actions-runner.%i"
2430

31+
# Logging and Permissions
32+
StandardOutput=journal
33+
StandardError=journal
34+
2535
[Install]
2636
WantedBy=multi-user.target

.github/scripts/ppc64le/self-hosted-builder/helpers/gh_cat_token.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,22 @@
33
TOKEN_FILE=$1
44
TOKEN_PIPE=$2
55

6+
echo "Starting gh_cat_token.sh with TOKEN_FILE=${TOKEN_FILE}, TOKEN_PIPE=${TOKEN_PIPE}"
7+
8+
# Validate inputs
9+
if [[ ! -r "${TOKEN_FILE}" ]]; then
10+
echo "Error: Token file '${TOKEN_FILE}' does not exist or is not readable."
11+
exit 1
12+
fi
13+
14+
if [[ -e "${TOKEN_PIPE}" ]]; then
15+
echo "Removing existing pipe ${TOKEN_PIPE}"
16+
rm -f "${TOKEN_PIPE}"
17+
fi
18+
619
mkfifo "${TOKEN_PIPE}"
7-
cat "${TOKEN_FILE}" > "${TOKEN_PIPE}" &
20+
echo "Created FIFO ${TOKEN_PIPE}"
21+
22+
# Write token file contents to pipe
23+
cat "${TOKEN_FILE}" > "${TOKEN_PIPE}" &
24+
echo "Token written to pipe ${TOKEN_PIPE}"

0 commit comments

Comments
 (0)