From 81d6ff3ffb71474ac12b82e7c488587d4ef6ea8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beto=20Rodr=C3=ADguez?= <81265082+betoredhat@users.noreply.github.com> Date: Fri, 17 Nov 2023 15:58:36 -0600 Subject: [PATCH] Fail if mirror issues (#50) * Fail if mirror issues --------- Co-authored-by: Tony Garcia --- roles/mirror_catalog/README.md | 15 ++++++++------- roles/mirror_catalog/defaults/main.yml | 2 ++ roles/mirror_catalog/tasks/main.yml | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/roles/mirror_catalog/README.md b/roles/mirror_catalog/README.md index 34f529de1..668ec8fd4 100644 --- a/roles/mirror_catalog/README.md +++ b/roles/mirror_catalog/README.md @@ -4,13 +4,14 @@ Mirrors a catalog and its related images. Produces a file that can be used to se ## Role Variables -Name | Required | Default | Description -----------------|----------| --------|------------- -mc_oc_tool_path | Yes | | The path to the oc1 binary, e.g. '/path/to/oc' -mc_catalog | Yes | | The Fully Qualified Artifact Reference, e.g. 'example.com/namespace/web:v1.0' -mc_registry | Yes | "" | The registry where the catalog will be mirrored, e.g. 'registry.example.com' or 'reg.example.com:4443' -mc_pullsecret | No | | The credential file to pull and/or push the images, e.g. '/path/to/pullsecret.json' -mc_is_type | No | icsp | The type of image source to use, choose between icsp (imageContentsourcePolicy) (default) or idms (imageDigestMirrorSet). +Name | Required | Type | Default | Description +--------------- | -------- | -------- | ------------ +mc_oc_tool_path | Yes | string | | The path to the oc1 binary, e.g. '/path/to/oc' +mc_catalog | Yes | string | | The Fully Qualified Artifact Reference, e.g. 'example.com/namespace/web:v1.0' +mc_registry | Yes | string | | The registry where the catalog will be mirrored, e.g. 'registry.example.com' or 'reg.example.com:4443' +mc_pullsecret | No | string | "" | The credential file to pull and/or push the images, e.g. '/path/to/pullsecret.json' +mc_is_type | No | string | icsp | The type of image source to use, choose between icsp (imageContentsourcePolicy) (default) or idms (imageDigestMirrorSet). +mc_continue_on_error| No | boolean | false | Continue even if there if there are errors during mirroring 1 It's recommended to use a [stable version of oc](https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/) diff --git a/roles/mirror_catalog/defaults/main.yml b/roles/mirror_catalog/defaults/main.yml index 71f9fe1a6..eef39ce2f 100644 --- a/roles/mirror_catalog/defaults/main.yml +++ b/roles/mirror_catalog/defaults/main.yml @@ -1,2 +1,4 @@ --- mc_is_type: "icsp" +mc_continue_on_error: false +... diff --git a/roles/mirror_catalog/tasks/main.yml b/roles/mirror_catalog/tasks/main.yml index 046a962f1..2c469ba82 100644 --- a/roles/mirror_catalog/tasks/main.yml +++ b/roles/mirror_catalog/tasks/main.yml @@ -40,7 +40,7 @@ state: directory register: mc_tmp -- name: Mirror catalog manifests +- name: Mirror operators shell: cmd: > set -x; @@ -50,6 +50,7 @@ --index-filter-by-os="linux/amd64" --insecure --max-components=3 + --continue-on-error={{ mc_continue_on_error }} {% if mc_pullsecret is defined %} --registry-config {{ mc_pullsecret }} {% endif %}