Skip to content

Commit 3b9e2d4

Browse files
committed
Temporary workaround to overwrite pending repos manually
1 parent cc82302 commit 3b9e2d4

8 files changed

Lines changed: 105 additions & 12 deletions

File tree

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-index.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,29 @@ spec:
120120
echo -n "success" | tee "$(results.status.path)"
121121
echo
122122
cat index-image-paths.txt
123+
echo
124+
125+
# WORKAROUND: Manually overwriting index images using skopeo (TODO: remove when overwrite token is fixed)
126+
if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
127+
TEMP_IMAGES=$(cat index-image-paths.txt | tr "," " ")
128+
for i in $TEMP_IMAGES
129+
do
130+
SRC_IMAGE=$(echo $i | awk -F '+' '{print $2}')
131+
DEST_IMAGE=$(echo $i | awk -F '+' '{print $1}')
132+
echo "1. Version tag: copying $SRC_IMAGE to $DEST_IMAGE"
133+
skopeo copy --format v2s2 --all --src-no-creds \
134+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
135+
docker://$SRC_IMAGE \
136+
docker://$DEST_IMAGE
137+
138+
# Also copy with permanent tag if build_tags_suffix is set
139+
if [[ "$(params.build_tags_suffix)" != "" ]]; then
140+
DEST_IMAGE_PERMANENT="${DEST_IMAGE}-$(params.build_tags_suffix)"
141+
echo "2. Permanent tag: copying $SRC_IMAGE to $DEST_IMAGE_PERMANENT"
142+
skopeo copy --format v2s2 --all --src-no-creds \
143+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
144+
docker://$SRC_IMAGE \
145+
docker://$DEST_IMAGE_PERMANENT
146+
fi
147+
done
148+
fi

ansible/roles/operator-pipeline/templates/openshift/tasks/build-fbc-index-images.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,32 @@ spec:
111111
$EXTRA_ARGS
112112
113113
cat index-image-paths.txt
114+
echo
115+
116+
# WORKAROUND: Manually overwrite index images using skopeo (TODO: remove when IIB fixed)
117+
if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
118+
TEMP_IMAGES=$(cat index-image-paths.txt | tr "," " ")
119+
for i in $TEMP_IMAGES
120+
do
121+
SRC_IMAGE=$(echo $i | awk -F '+' '{print $2}')
122+
DEST_IMAGE=$(echo $i | awk -F '+' '{print $1}')
123+
echo "1. Version tag: copying $SRC_IMAGE to $DEST_IMAGE"
124+
skopeo copy --format v2s2 --all --src-no-creds \
125+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
126+
docker://$SRC_IMAGE \
127+
docker://$DEST_IMAGE
128+
129+
# Also copy with permanent tag if build_tags_suffix is set
130+
if [[ "$(params.build_tags_suffix)" != "" ]]; then
131+
DEST_IMAGE_PERMANENT="${DEST_IMAGE}-$(params.build_tags_suffix)"
132+
echo "2. Permanent tag: copying $SRC_IMAGE to $DEST_IMAGE_PERMANENT"
133+
skopeo copy --format v2s2 --all --src-no-creds \
134+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
135+
docker://$SRC_IMAGE \
136+
docker://$DEST_IMAGE_PERMANENT
137+
fi
138+
done
139+
fi
114140
115141
- name: rm-operator-from-index
116142
image: "$(params.pipeline_image)"
@@ -157,3 +183,29 @@ spec:
157183
$EXTRA_ARGS
158184
159185
cat index-image-paths.txt
186+
echo
187+
188+
# WORKAROUND: Manually overwrite index images using skopeo (TODO: remove when IIB fixed)
189+
if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
190+
TEMP_IMAGES=$(cat index-image-paths.txt | tr "," " ")
191+
for i in $TEMP_IMAGES
192+
do
193+
SRC_IMAGE=$(echo $i | awk -F '+' '{print $2}')
194+
DEST_IMAGE=$(echo $i | awk -F '+' '{print $1}')
195+
echo "1. Version tag: copying $SRC_IMAGE to $DEST_IMAGE"
196+
skopeo copy --format v2s2 --all --src-no-creds \
197+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
198+
docker://$SRC_IMAGE \
199+
docker://$DEST_IMAGE
200+
201+
# Also copy with permanent tag if build_tags_suffix is set
202+
if [[ "$(params.build_tags_suffix)" != "" ]]; then
203+
DEST_IMAGE_PERMANENT="${DEST_IMAGE}-$(params.build_tags_suffix)"
204+
echo "2. Permanent tag: copying $SRC_IMAGE to $DEST_IMAGE_PERMANENT"
205+
skopeo copy --format v2s2 --all --src-no-creds \
206+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
207+
docker://$SRC_IMAGE \
208+
docker://$DEST_IMAGE_PERMANENT
209+
fi
210+
done
211+
fi

operatorcert/entrypoints/add_fbc_fragments_to_index.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,11 @@ def add_fbc_fragment_to_index(
204204
payload["build_tags"] = [version, f"{version}-{build_tags_suffix}"]
205205

206206
if overwrite_token:
207-
payload["overwrite_from_index"] = True
208-
payload["overwrite_from_index_token"] = overwrite_token
207+
# WORKAROUND: Manually overwriting index images using skopeo
208+
# TODO: uncomment when overwrite token is fixed, delete pass
209+
# payload["overwrite_from_index"] = True
210+
# payload["overwrite_from_index_token"] = overwrite_token
211+
pass
209212

210213
resp = iib.add_fbc_build(iib_url, payload)
211214
request_ids.append(resp["id"])

operatorcert/entrypoints/index.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ def add_bundle_to_index( # pylint: disable=too-many-arguments,too-many-position
113113
build_request["build_tags"] = [version, f"{version}-{build_tags_suffix}"]
114114

115115
if overwrite_token:
116-
build_request["overwrite_from_index"] = True
117-
build_request["overwrite_from_index_token"] = overwrite_token
116+
# WORKAROUND: Manually overwriting index images using skopeo
117+
# TODO: uncomment when overwrite token is fixed, delete pass
118+
# build_request["overwrite_from_index"] = True
119+
# build_request["overwrite_from_index_token"] = overwrite_token
120+
pass
118121

119122
payload["build_requests"].append(build_request)
120123

operatorcert/entrypoints/rm_operator_from_index.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ def rm_operator_from_index(
144144
]
145145

146146
if overwrite_token:
147-
build_request["overwrite_from_index"] = True
148-
build_request["overwrite_from_index_token"] = overwrite_token
147+
# WORKAROUND: Manually overwriting index images using skopeo
148+
# TODO: uncomment when overwrite token is fixed, delete pass
149+
# build_request["overwrite_from_index"] = True
150+
# build_request["overwrite_from_index_token"] = overwrite_token
151+
pass
149152

150153
payload["build_requests"].append(build_request)
151154

tests/entrypoints/test_add_fbc_fragments_to_index.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,10 @@ def test_add_fbc_fragment_to_index(
234234
"from_index": "registry/index:v4.15",
235235
"fbc_fragment": "registry.foo/repo/foo:v4.15-fragment-sha256:1234",
236236
"build_tags": ["v4.15", "v4.15-1711883400"],
237-
"overwrite_from_index": True,
238-
"overwrite_from_index_token": "user:token123",
237+
# WORKAROUND: Manually overwriting index images using skopeo
238+
# TODO: uncomment when overwrite token is fixed
239+
# "overwrite_from_index": True,
240+
# "overwrite_from_index_token": "user:token123",
239241
},
240242
)
241243

tests/entrypoints/test_index.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ def test_add_bundle_to_index(
6969
"add_arches": ["amd64", "s390x", "ppc64le"],
7070
"graph_update_mode": "replaces",
7171
"build_tags": ["v4.9", "v4.9-1711883400"],
72-
"overwrite_from_index": True,
73-
"overwrite_from_index_token": "user:token123",
72+
# WORKAROUND: Manually overwriting index images using skopeo
73+
# TODO: uncomment when overwrite token is fixed
74+
# "overwrite_from_index": True,
75+
# "overwrite_from_index_token": "user:token123",
7476
}
7577
]
7678
},

tests/entrypoints/test_rm_operator_from_index.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ def test_rm_operator_from_index(
7777
"from_index": "iib-pullspec",
7878
"operators": ["op1"],
7979
"build_tags": ["v4.15", "v4.15-1711883400"],
80-
"overwrite_from_index": True,
81-
"overwrite_from_index_token": "user:token123",
80+
# WORKAROUND: Manually overwriting index images using skopeo
81+
# TODO: uncomment when overwrite token is fixed
82+
# "overwrite_from_index": True,
83+
# "overwrite_from_index_token": "user:token123",
8284
}
8385
]
8486
},

0 commit comments

Comments
 (0)