File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments