Skip to content

Commit 1050cf0

Browse files
Docker hub mirror
1 parent ad99c3e commit 1050cf0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

spread.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ backends:
8686
# Manually pass specific environment variables
8787
environment:
8888
CI: '$(HOST: echo $CI)'
89+
DOCKERHUB_MIRROR: '$(HOST: echo $DOCKERHUB_MIRROR)'
8990
systems:
9091
- ubuntu-24.04:
9192
username: runner
@@ -123,6 +124,26 @@ prepare: |
123124
cd "$SPREAD_PATH"
124125
# Install via snap after https://github.com/canonical/concierge/pull/81 released
125126
go install github.com/canonical/concierge@latest
127+
128+
if [[ -n "$DOCKERHUB_MIRROR" ]]
129+
then
130+
# Running on IS-hosted runner; configure microk8s to use Docker Hub mirror
131+
# Run before concierge prepare because of https://github.com/canonical/concierge/issues/75
132+
133+
snap install microk8s --channel "$CONCIERGE_MICROK8S_CHANNEL"
134+
135+
# Wait for microk8s to populate iptables
136+
# https://chat.canonical.com/canonical/pl/jo5cg6wqjjrudqd5ybj6hhttee
137+
microk8s status --wait-ready
138+
139+
tee /var/snap/microk8s/current/args/certs.d/docker.io/hosts.toml << EOF
140+
server = "$DOCKERHUB_MIRROR"
141+
[host."${DOCKERHUB_MIRROR#'https://'}"]
142+
capabilities = ["pull", "resolve"]
143+
EOF
144+
microk8s stop
145+
microk8s start
146+
fi
126147
127148
# Install charmcraft & pipx on lxd-vm backend and install pipx on IS-hosted runners
128149
~/go/bin/concierge prepare --trace

0 commit comments

Comments
 (0)