From dbaf9c498bc9333fa12cad661f0eb8954d954e2f Mon Sep 17 00:00:00 2001 From: jbtrystram Date: Sun, 3 Nov 2024 18:45:15 +0100 Subject: [PATCH] build-kola-containers: delete local manifests if FORCE If a previous run failed while pushing the manifest, subsequent runs will fail because a manifest referencing the same image already exist in the local storage. This will clear any existing manifests if FORCE is true, allowing re-runs. The error is: ``` [2024-11-03T17:27:57.249Z] + cosa push-container-manifest --v2s2 --auth=**** --tag latest --repo quay.io/coreos-assembler/nfs --image=docker://quay.io/coreos-assembler/staging:nfs-aarch64-4e45505 --image=docker://quay.io/coreos-assembler/staging:nfs-x86_64-4e45505 --image=docker://quay.io/coreos-assembler/staging:nfs-s390x-4e45505 --image=docker://quay.io/coreos-assembler/staging:nfs-ppc64le-4e45505 [2024-11-03T17:27:57.249Z] 2024-11-03 17:27:57,220 INFO - Running command: ['podman', 'manifest', 'create', 'quay.io/coreos-assembler/nfs:latest'] [2024-11-03T17:27:57.503Z] Error: creating manifest: image name "quay.io/coreos-assembler/nfs:latest" is already associated with image "88541596f5bb4fb033eb24ac82d8325096d9490463019033ed42e5bbdcb86a2c": that name is already in use ``` --- jobs/build-kola-containers.Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jobs/build-kola-containers.Jenkinsfile b/jobs/build-kola-containers.Jenkinsfile index d28f1d03f..291803737 100644 --- a/jobs/build-kola-containers.Jenkinsfile +++ b/jobs/build-kola-containers.Jenkinsfile @@ -190,6 +190,13 @@ lock(resource: "build-kola-containers") { // locally because podman wants user namespacing (yes, even just // to push a manifest...) pipeutils.withPodmanRemoteArchBuilder(arch: "x86_64") { + + // delete previously existing manifests + if ( params.FORCE ) { + shwrap(""" + podman manifest rm ${params.CONTAINER_REGISTRY_ORG}/${imageName} + """) + } shwrap(""" cosa push-container-manifest --v2s2 \ --auth=\$REGISTRY_SECRET --tag latest \