-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add service to preload docker images on runner startup
- Loading branch information
1 parent
de5f8bc
commit 9e5909d
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
build_tools/github_actions/runner/config/systemd/scripts/preload_docker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2023 The IREE Authors | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
# Pre-fetches docker images so we don't have to wait for docker to fetch them as | ||
# part of `docker run` in the CI jobs. This isn't comprehensive but pre-fetches | ||
# things we think are pretty likely to be useful to pre-fetch. It runs in the | ||
# background so shouldn't have a significant impact on other startup tasks. It | ||
# also won't block fetches being done by the job itself. It could compete for | ||
# network bandwidth though, so we don't want to just always try to fetch | ||
# everything. | ||
|
||
set -euo pipefail | ||
|
||
source /runner-root/config/functions.sh | ||
|
||
nice_curl https://raw.githubusercontent.com/openxla/iree/main/build_tools/docker/prod_digests.txt \ | ||
--output /tmp/prod_digests.txt | ||
|
||
# Basically everything uses a derivative of one of these | ||
grep 'gcr.io/iree-oss/base@' /tmp/prod_digests.txt | xargs docker pull | ||
grep 'gcr.io/iree-oss/base-bleeding-edge@' /tmp/prod_digests.txt | xargs docker pull | ||
|
||
RUNNER_TYPE="$(get_attribute github-runner-type)" | ||
|
||
if [[ "${RUNNER_TYPE}" == gpu || "${RUNNER_TYPE}" == a100 ]]; then | ||
grep 'gcr.io/iree-oss/nvidia@' /tmp/prod_digests.txt | xargs docker pull | ||
fi | ||
|
||
if [[ "${RUNNER_TYPE}" == a100 ]]; then | ||
grep 'gcr.io/iree-oss/nvidia-bleeding-edge@' /tmp/prod_digests.txt | xargs docker pull | ||
fi |
15 changes: 15 additions & 0 deletions
15
build_tools/github_actions/runner/config/systemd/system/preload-docker.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=GitHub Actions Runner | ||
After=docker.target | ||
|
||
[Service] | ||
User=runner | ||
Group=runner | ||
Type=oneshot | ||
EnvironmentFile=/etc/environment | ||
ExecStart=/runner-root/config/systemd/scripts/preload_docker.sh | ||
Restart=no | ||
RemainAfterExit=yes | ||
|
||
[Install] | ||
WantedBy=runner-setup.target |