fix: import runner image archives during prepull
Deploy Cluster / Terraform (push) Successful in 32s
Deploy Cluster / Ansible (push) Failing after 46m46s

This commit is contained in:
2026-04-30 09:08:44 +00:00
parent 353a408dac
commit 6d6e3e8371
3 changed files with 89 additions and 8 deletions
+9
View File
@@ -228,11 +228,20 @@ jobs:
ghcr.io/fluxcd/kustomize-controller:v1.8.1 \ ghcr.io/fluxcd/kustomize-controller:v1.8.1 \
ghcr.io/fluxcd/helm-controller:v1.5.1 \ ghcr.io/fluxcd/helm-controller:v1.5.1 \
ghcr.io/fluxcd/notification-controller:v1.8.1 \ ghcr.io/fluxcd/notification-controller:v1.8.1 \
docker.io/rancher/mirrored-coredns-coredns:1.14.2 \
docker.io/rancher/mirrored-metrics-server:v0.8.1 \
docker.io/rancher/local-path-provisioner:v0.0.35 \
docker.io/rancher/mirrored-library-traefik:3.6.10 \
docker.io/rancher/klipper-helm:v0.9.14-build20260309 \
oci.external-secrets.io/external-secrets/external-secrets:v2.1.0 \ oci.external-secrets.io/external-secrets/external-secrets:v2.1.0 \
ghcr.io/tailscale/k8s-operator:v1.96.5 \ ghcr.io/tailscale/k8s-operator:v1.96.5 \
ghcr.io/tailscale/tailscale:v1.96.5 \ ghcr.io/tailscale/tailscale:v1.96.5 \
registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 \ registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2 \
docker.io/rancher/mirrored-pause:3.6 \ docker.io/rancher/mirrored-pause:3.6 \
docker.io/rancher/rancher:v2.13.3 \
docker.io/rancher/rancher-webhook:v0.9.3 \
docker.io/rancher/system-upgrade-controller:v0.17.0 \
docker.io/rancher/shell:v0.6.2 \
quay.io/jetstack/cert-manager-controller:v1.17.2 \ quay.io/jetstack/cert-manager-controller:v1.17.2 \
quay.io/jetstack/cert-manager-cainjector:v1.17.2 \ quay.io/jetstack/cert-manager-cainjector:v1.17.2 \
quay.io/jetstack/cert-manager-webhook:v1.17.2 \ quay.io/jetstack/cert-manager-webhook:v1.17.2 \
@@ -1,13 +1,49 @@
--- ---
- name: Pre-pull bootstrap images into containerd - name: Check for runner-provided bootstrap image archives
stat:
path: "{{ playbook_dir }}/../outputs/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
delegate_to: localhost
become: false
register: bootstrap_image_archive_stats
loop: "{{ bootstrap_prepull_images }}"
- name: Ensure remote bootstrap image archive directory exists
file:
path: /tmp/bootstrap-image-archives
state: directory
mode: "0755"
- name: Copy runner-provided bootstrap image archives
copy:
src: "{{ item.stat.path }}"
dest: "/tmp/bootstrap-image-archives/{{ item.item | regex_replace('[/:]', '_') }}.tar"
mode: "0644"
loop: "{{ bootstrap_image_archive_stats.results }}"
loop_control:
label: "{{ item.item }}"
when: item.stat.exists
- name: Import or pull bootstrap images into containerd
shell: | shell: |
if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
echo "already present" echo "already present"
exit 0 exit 0
fi fi
archive="/tmp/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
if [ -s "${archive}" ]; then
for attempt in 1 2 3; do for attempt in 1 2 3; do
if timeout 120s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then if /usr/local/bin/ctr -n k8s.io images import "${archive}" && /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
echo "imported image"
exit 0
fi
sleep 10
done
fi
for attempt in 1 2 3 4 5; do
if timeout 180s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then
echo "pulled image" echo "pulled image"
exit 0 exit 0
fi fi
@@ -20,4 +56,4 @@
executable: /bin/bash executable: /bin/bash
register: bootstrap_image_pull register: bootstrap_image_pull
loop: "{{ bootstrap_prepull_images }}" loop: "{{ bootstrap_prepull_images }}"
changed_when: "'pulled image' in bootstrap_image_pull.stdout" changed_when: "'imported image' in bootstrap_image_pull.stdout or 'pulled image' in bootstrap_image_pull.stdout"
@@ -1,13 +1,49 @@
--- ---
- name: Pre-pull Rancher images into containerd - name: Check for runner-provided Rancher image archives
stat:
path: "{{ playbook_dir }}/../outputs/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
delegate_to: localhost
become: false
register: rancher_image_archive_stats
loop: "{{ rancher_images_to_prepull }}"
- name: Ensure remote Rancher image archive directory exists
file:
path: /tmp/bootstrap-image-archives
state: directory
mode: "0755"
- name: Copy runner-provided Rancher image archives
copy:
src: "{{ item.stat.path }}"
dest: "/tmp/bootstrap-image-archives/{{ item.item | regex_replace('[/:]', '_') }}.tar"
mode: "0644"
loop: "{{ rancher_image_archive_stats.results }}"
loop_control:
label: "{{ item.item }}"
when: item.stat.exists
- name: Import or pull Rancher images into containerd
shell: | shell: |
if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
echo "already present" echo "already present"
exit 0 exit 0
fi fi
archive="/tmp/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
if [ -s "${archive}" ]; then
for attempt in 1 2 3; do for attempt in 1 2 3; do
if timeout 120s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then if /usr/local/bin/ctr -n k8s.io images import "${archive}" && /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
echo "imported image"
exit 0
fi
sleep 10
done
fi
for attempt in 1 2 3 4 5; do
if timeout 180s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then
echo "pulled image" echo "pulled image"
exit 0 exit 0
fi fi
@@ -20,4 +56,4 @@
executable: /bin/bash executable: /bin/bash
register: rancher_image_pull register: rancher_image_pull
loop: "{{ rancher_images_to_prepull }}" loop: "{{ rancher_images_to_prepull }}"
changed_when: "'pulled image' in rancher_image_pull.stdout" changed_when: "'imported image' in rancher_image_pull.stdout or 'pulled image' in rancher_image_pull.stdout"