File tree Expand file tree Collapse file tree
tasks/managed/publish-index-image Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,6 +152,8 @@ spec:
152152
153153 sourceIndex="$(jq -r --argjson i "$i" \
154154 '.components[$i].index_image' "$(params.dataDir)/$(params.internalRequestResultsFile)")"
155+ sourceResolvedIndex="$(jq -r --argjson i "$i" \
156+ '.components[$i].index_image_resolved' "$(params.dataDir)/$(params.internalRequestResultsFile)")"
155157
156158 targetOcpVersion=$(jq -r --argjson i "$i" \
157159 '.components[$i].ocp_version' "$(params.dataDir)/$(params.internalRequestResultsFile)")
@@ -173,6 +175,13 @@ spec:
173175 for((x=0; x<${#publishingImages[@]}; x++ )); do
174176 echo "=== Creating internal request to publish image:"
175177 echo ""
178+
179+ # if we are pushing the timestamped index (always the index #1), we should
180+ # use index_image_resolved instead, because the target_index sha can poten_
181+ # tially be changed by a concurrent fbc process.
182+ if [ "$x" -eq 1 ]; then
183+ sourceIndex="$sourceResolvedIndex"
184+ fi
176185 echo "- from: ${sourceIndex}"
177186 echo "- to: ${publishingImages[$x]}"
178187
Original file line number Diff line number Diff line change @@ -193,9 +193,23 @@ spec:
193193 exit 1
194194 fi
195195
196- if [ "$(jq -r '.sourceIndex' <<< "${params}")" != "redhat.com/rh-stage/iib:01" ]; then
197- echo "sourceIndex image does not match for IR $i"
198- exit 1
196+ sourceIndex=$(jq -r '.sourceIndex' <<< "${params}")
197+ # IR 0 (first created, x=0) should use index_image (tag)
198+ # IR 1 (second created, x=1) should use index_image_resolved (digest)
199+ if [ $i = 0 ]; then
200+ if [ "$sourceIndex" != "redhat.com/rh-stage/iib:01" ]; then
201+ echo "sourceIndex image does not match for IR 0"
202+ echo "Expected: redhat.com/rh-stage/iib:01"
203+ echo "Got: $sourceIndex"
204+ exit 1
205+ fi
206+ else
207+ if [ "$sourceIndex" != "redhat.com/rh-stage/iib@sha256:abcdefghijk" ]; then
208+ echo "sourceIndex image does not match for IR 1"
209+ echo "Expected: redhat.com/rh-stage/iib@sha256:abcdefghijk"
210+ echo "Got: $sourceIndex"
211+ exit 1
212+ fi
199213 fi
200214
201215 targetIndex=$(jq -r '.targetIndex' <<< "${params}")
Original file line number Diff line number Diff line change @@ -188,9 +188,23 @@ spec:
188188 exit 1
189189 fi
190190
191- if [ "$(jq -r '.sourceIndex' <<< "${params}")" != "redhat.com/rh-stage/iib:01" ]; then
192- echo "sourceIndex image does not match"
193- exit 1
191+ sourceIndex=$(jq -r '.sourceIndex' <<< "${params}")
192+ # IR 0 (first created, x=0) should use index_image (tag)
193+ # IR 1 (second created, x=1) should use index_image_resolved (digest)
194+ if [ $i = 0 ]; then
195+ if [ "$sourceIndex" != "redhat.com/rh-stage/iib:01" ]; then
196+ echo "sourceIndex image does not match for IR 0"
197+ echo "Expected: redhat.com/rh-stage/iib:01"
198+ echo "Got: $sourceIndex"
199+ exit 1
200+ fi
201+ else
202+ if [ "$sourceIndex" != "redhat.com/rh-stage/iib@sha256:abcdefghijk" ]; then
203+ echo "sourceIndex image does not match for IR 1"
204+ echo "Expected: redhat.com/rh-stage/iib@sha256:abcdefghijk"
205+ echo "Got: $sourceIndex"
206+ exit 1
207+ fi
194208 fi
195209
196210 targetIndex=$(jq -r '.targetIndex' <<< "${params}")
You can’t perform that action at this time.
0 commit comments