Skip to content

Commit 9290704

Browse files
committed
Temporary workaround to overwrite pending repos manually
1 parent 2ac955d commit 9290704

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
@@ -132,3 +132,29 @@ spec:
132132
echo -n "success" | tee "$(results.status.path)"
133133
echo
134134
cat index-image-paths.txt
135+
echo
136+
137+
# WORKAROUND: Manually overwriting index images using skopeo (TODO: remove when overwrite token is fixed)
138+
if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
139+
TEMP_IMAGES=$(cat index-image-paths.txt | tr "," " ")
140+
for i in $TEMP_IMAGES
141+
do
142+
SRC_IMAGE=$(echo $i | awk -F '+' '{print $2}')
143+
DEST_IMAGE=$(echo $i | awk -F '+' '{print $1}')
144+
echo "1. Version tag: copying $SRC_IMAGE to $DEST_IMAGE"
145+
skopeo copy --format v2s2 --all --src-no-creds \
146+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
147+
docker://$SRC_IMAGE \
148+
docker://$DEST_IMAGE
149+
150+
# Also copy with permanent tag if build_tags_suffix is set
151+
if [[ "$(params.build_tags_suffix)" != "" ]]; then
152+
DEST_IMAGE_PERMANENT="${DEST_IMAGE}-$(params.build_tags_suffix)"
153+
echo "2. Permanent tag: copying $SRC_IMAGE to $DEST_IMAGE_PERMANENT"
154+
skopeo copy --format v2s2 --all --src-no-creds \
155+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
156+
docker://$SRC_IMAGE \
157+
docker://$DEST_IMAGE_PERMANENT
158+
fi
159+
done
160+
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
@@ -122,6 +122,32 @@ spec:
122122
$EXTRA_ARGS
123123
124124
cat index-image-paths.txt
125+
echo
126+
127+
# WORKAROUND: Manually overwrite index images using skopeo (TODO: remove when IIB fixed)
128+
if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
129+
TEMP_IMAGES=$(cat index-image-paths.txt | tr "," " ")
130+
for i in $TEMP_IMAGES
131+
do
132+
SRC_IMAGE=$(echo $i | awk -F '+' '{print $2}')
133+
DEST_IMAGE=$(echo $i | awk -F '+' '{print $1}')
134+
echo "1. Version tag: copying $SRC_IMAGE to $DEST_IMAGE"
135+
skopeo copy --format v2s2 --all --src-no-creds \
136+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
137+
docker://$SRC_IMAGE \
138+
docker://$DEST_IMAGE
139+
140+
# Also copy with permanent tag if build_tags_suffix is set
141+
if [[ "$(params.build_tags_suffix)" != "" ]]; then
142+
DEST_IMAGE_PERMANENT="${DEST_IMAGE}-$(params.build_tags_suffix)"
143+
echo "2. Permanent tag: copying $SRC_IMAGE to $DEST_IMAGE_PERMANENT"
144+
skopeo copy --format v2s2 --all --src-no-creds \
145+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
146+
docker://$SRC_IMAGE \
147+
docker://$DEST_IMAGE_PERMANENT
148+
fi
149+
done
150+
fi
125151
126152
- name: rm-operator-from-index
127153
image: "$(params.pipeline_image)"
@@ -179,3 +205,29 @@ spec:
179205
$EXTRA_ARGS
180206
181207
cat index-image-paths.txt
208+
echo
209+
210+
# WORKAROUND: Manually overwrite index images using skopeo (TODO: remove when IIB fixed)
211+
if [[ "$(workspaces.iib-credentials.bound)" == "true" ]]; then
212+
TEMP_IMAGES=$(cat index-image-paths.txt | tr "," " ")
213+
for i in $TEMP_IMAGES
214+
do
215+
SRC_IMAGE=$(echo $i | awk -F '+' '{print $2}')
216+
DEST_IMAGE=$(echo $i | awk -F '+' '{print $1}')
217+
echo "1. Version tag: copying $SRC_IMAGE to $DEST_IMAGE"
218+
skopeo copy --format v2s2 --all --src-no-creds \
219+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
220+
docker://$SRC_IMAGE \
221+
docker://$DEST_IMAGE
222+
223+
# Also copy with permanent tag if build_tags_suffix is set
224+
if [[ "$(params.build_tags_suffix)" != "" ]]; then
225+
DEST_IMAGE_PERMANENT="${DEST_IMAGE}-$(params.build_tags_suffix)"
226+
echo "2. Permanent tag: copying $SRC_IMAGE to $DEST_IMAGE_PERMANENT"
227+
skopeo copy --format v2s2 --all --src-no-creds \
228+
--dest-creds $IIB_QUAY_USER:$IIB_QUAY_TOKEN \
229+
docker://$SRC_IMAGE \
230+
docker://$DEST_IMAGE_PERMANENT
231+
fi
232+
done
233+
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)