From 9519fafd102017e54f4d543f25ca4398f1ec67b8 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 14 Feb 2024 09:22:39 -0800 Subject: [PATCH] Override DOCKER_MIN_API_VERSION for skopeo when installing docker Skopeo hardcoded the docker api version for image manipulation to version 1.22 of the api until very recently. Docker 25 sets 1.24 as a minimum version by default introducing an incompatibility between the tools. It isn't straightforward to install an updated skopeo everywhere we need it (due to golang requirements). As a workaround we override the min version to 1.22 when installing the docker daemon. This should work until Docker 26 is released and removed the override option. Note we also pin microk8s from latest/stable (which is currently 1.29/stable) to 1.28/stable to workaround https://github.com/canonical/microk8s/issues/4361. This is necessary to get the CI jobs for docker/registry/k8s testing working in order to land this fixup. Change-Id: I377ac84d532749eba578c4b32eb2ed6a5ce7a0c9 --- roles/ensure-docker/handlers/main.yaml | 5 ++++ roles/ensure-docker/tasks/docker-setup.yaml | 26 +++++++++++++++++++++ roles/ensure-kubernetes/defaults/main.yaml | 4 +++- zuul-tests.d/container-roles-jobs.yaml | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/roles/ensure-docker/handlers/main.yaml b/roles/ensure-docker/handlers/main.yaml index e866fbcc6..f51cd6c6d 100644 --- a/roles/ensure-docker/handlers/main.yaml +++ b/roles/ensure-docker/handlers/main.yaml @@ -1,4 +1,9 @@ --- +- name: Reload systemd + become: true + systemd_service: + daemon_reload: true + - name: Stop docker.socket to avoid any conflict become: true service: diff --git a/roles/ensure-docker/tasks/docker-setup.yaml b/roles/ensure-docker/tasks/docker-setup.yaml index f31b623d0..96cb08b76 100644 --- a/roles/ensure-docker/tasks/docker-setup.yaml +++ b/roles/ensure-docker/tasks/docker-setup.yaml @@ -48,6 +48,32 @@ become: true register: _docker_status +- name: Dir for docker systemd overrides + file: + path: /etc/systemd/system/docker.service.d/ + state: directory + owner: root + group: root + mode: '0755' + become: true + +# Skopeo hardcoded protocol version 1.22 until ~February 2024. +# Docker supports the MIN version override until Docker 26 releases. +# https://github.com/docker/cli/blob/master/docs/deprecated.md#deprecate-legacy-api-versions +- name: Override the docker daemon image protocol min version + copy: + dest: /etc/systemd/system/docker.service.d/image_protocol_env.conf + owner: root + group: root + mode: '0644' + content: | + [Service] + Environment="DOCKER_MIN_API_VERSION=1.22" + become: true + notify: + - Reload systemd + - Restart docker + - name: Restart docker when: >- (docker_userland_proxy is defined) or diff --git a/roles/ensure-kubernetes/defaults/main.yaml b/roles/ensure-kubernetes/defaults/main.yaml index 63283d5a2..08a98bfc1 100644 --- a/roles/ensure-kubernetes/defaults/main.yaml +++ b/roles/ensure-kubernetes/defaults/main.yaml @@ -1,5 +1,7 @@ ensure_kubernetes_type: minikube -ensure_kubernetes_microk8s_channel: 'latest/stable' +# Pin to 1.28 until https://github.com/canonical/microk8s/issues/4361 +# is fixed. +ensure_kubernetes_microk8s_channel: '1.28/stable' # NOTE(ianw) : 2022-12-13 # - "storage" is deprecated and has become "hostpath-storage" in # >1.24, but we still need to support 1.23. If it really goes away diff --git a/zuul-tests.d/container-roles-jobs.yaml b/zuul-tests.d/container-roles-jobs.yaml index 4f3263090..cf2916c19 100644 --- a/zuul-tests.d/container-roles-jobs.yaml +++ b/zuul-tests.d/container-roles-jobs.yaml @@ -352,6 +352,7 @@ - roles/run-buildset-registry/.* - roles/use-buildset-registry/.* - test-playbooks/registry/.* + - zuul-tests.d/container-roles-jobs.yaml pre-run: test-playbooks/registry/buildset-registry-pre.yaml run: test-playbooks/registry/buildset-registry.yaml post-run: test-playbooks/registry/test-registry-post.yaml