Skip to content

Commit d5ee20c

Browse files
authored
introduce an automation for GHA runner version update (#3034)
[static] Signed-off-by: Mateusz Błażejewski <mateusz.blazejewski@digitalasset.com>
1 parent 051c7b3 commit d5ee20c

File tree

5 files changed

+96
-5
lines changed

5 files changed

+96
-5
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Bump GHA runner version (WIP)
2+
on:
3+
# schedule:
4+
# - cron: '30 6 1,15 * *' # Monthly on the 1st and 15th at 06:30
5+
workflow_dispatch:
6+
7+
jobs:
8+
bump_gha_runner_version:
9+
runs-on: ubuntu-24.04
10+
name: Bump GHA runner version
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
15+
- name: Check for the latest version and create a PR to splice
16+
uses: ./.github/actions/nix/run_bash_command_in_nix
17+
with:
18+
cmd: |
19+
git config user.email "splice-maintainers@digitalasset.com"
20+
git config user.name "DA Automation"
21+
./scripts/bump_gha_runner_version.sh
22+
additional_nix_args: "--keep GH_TOKEN"
23+
env:
24+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Report Failures on Slack & Github
27+
if: failure() && (github.event_name == 'push' || github.event_name == 'schedule')
28+
uses: ./.github/actions/tests/failure_notifications
29+
with:
30+
workload_identity_provider: '${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}'
31+
service_account: '${{ secrets.FAILURE_NOTIFICATIONS_INVOKER_SA }}'
32+
notifications_url: '${{ secrets.FAILURE_NOTIFICATIONS_INVOKER_URL }}'
33+
slack_channel: '${{ secrets.FAILURE_NOTIFICATIONS_SLACK_CHANNEL }}'

cluster/images/splice-test-docker-runner/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
ARG RUNNER_VERSION=2.330.0
2+
ARG RUNNER_DIGEST=sha256:ee54ad8776606f29434f159196529b7b9c83c0cb9195c1ff5a7817e7e570dcfe
3+
14
# Note that we don't currently support arm64 runners, so we build this only for amd64
2-
FROM --platform=$BUILDPLATFORM ghcr.io/actions/actions-runner:2.330.0@sha256:ee54ad8776606f29434f159196529b7b9c83c0cb9195c1ff5a7817e7e570dcfe
5+
FROM --platform=$BUILDPLATFORM ghcr.io/actions/actions-runner:${RUNNER_VERSION}@${RUNNER_DIGEST}
36

4-
LABEL org.opencontainers.image.base.name="ghcr.io/actions/actions-runner:2.330.0"
7+
LABEL org.opencontainers.image.base.name="ghcr.io/actions/actions-runner:${RUNNER_VERSION}"
58
#Ideally, we'd reduce duplication between this and splice-test-ci, but we're not tackling that right now
69

710
RUN sudo apt-get update && \
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
ARG RUNNER_VERSION=2.330.0
2+
ARG RUNNER_DIGEST=sha256:ee54ad8776606f29434f159196529b7b9c83c0cb9195c1ff5a7817e7e570dcfe
3+
14
# Note that we don't currently support arm64 runners, so we build this only for amd64
2-
FROM --platform=$BUILDPLATFORM ghcr.io/actions/actions-runner:2.330.0@sha256:ee54ad8776606f29434f159196529b7b9c83c0cb9195c1ff5a7817e7e570dcfe
5+
FROM --platform=$BUILDPLATFORM ghcr.io/actions/actions-runner:${RUNNER_VERSION}@${RUNNER_DIGEST}
36

4-
LABEL org.opencontainers.image.base.name="ghcr.io/actions/actions-runner:2.230.0"
7+
LABEL org.opencontainers.image.base.name="ghcr.io/actions/actions-runner:${RUNNER_VERSION}"
58

69
COPY target/index.js /home/runner/k8s/index.js
710
COPY target/LICENSE .

cluster/pulumi/gha/src/runners.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function installDockerRunnerScaleSet(
186186
containers: [
187187
{
188188
name: 'runner',
189-
image: `${DOCKER_REPO}/splice-test-docker-runner:${ghaConfig.runnerHookVersion}`,
189+
image: `${DOCKER_REPO}/splice-test-docker-runner:${ghaConfig.runnerVersion}`,
190190
command: ['/home/runner/run.sh'],
191191
env: [
192192
{

scripts/bump-gha-runner-version.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2024 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -euo pipefail
7+
8+
runner_version=$(
9+
gh release view \
10+
--repo actions/runner \
11+
--json tagName \
12+
| jq -r '.tagName' \
13+
| sed 's/^v//' # remove the 'v' prefix
14+
)
15+
16+
# gets the multiplatform image digest
17+
runner_digest=$(
18+
docker buildx imagetools inspect "ghcr.io/actions/actions-runner:${runner_version}" \
19+
| yq '.Digest'
20+
)
21+
22+
docker_runner_file="${SPLICE_ROOT}/cluster/images/splice-test-docker-runner/Dockerfile"
23+
runner_hook_file="${SPLICE_ROOT}/cluster/images/splice-test-runner-hook/Dockerfile"
24+
25+
sed \
26+
--in-place \
27+
--expression "s/^\(ARG RUNNER_VERSION=\).*/\1${runner_version}/" \
28+
--expression "s/^\(ARG RUNNER_DIGEST=\).*/\1${runner_digest}/" \
29+
"${docker_runner_file}" \
30+
"${runner_hook_file}"
31+
32+
if git diff --exit-code --quiet "${docker_runner_file}" "${runner_hook_file}"; then
33+
echo "GHA runner version is up to date."
34+
exit 0
35+
fi
36+
37+
make --directory "${SPLICE_ROOT}" --jobs \
38+
cluster/images/splice-test-docker-runner/docker-build \
39+
cluster/images/splice-test-runner-hook/docker-build
40+
41+
git add --all
42+
updated_branch="gha-runner-version-bump-$(date +%Y-%m-%d)"
43+
git switch -c "${updated_branch}"
44+
git commit -m "[static] bump GHA runner version to the latest (auto-generated)" -s
45+
git push origin "${updated_branch}"
46+
47+
gh pr create \
48+
--base "main" \
49+
--head "$updated_branch" \
50+
--title "Bump GHA runner version to the latest (auto-generated)" \
51+
--body "" \
52+
--reviewer isegall-da,martinflorian-da,ray-roestenburg-da,mblaze-da

0 commit comments

Comments
 (0)