Skip to content

Commit 21963da

Browse files
update Pipeline to pubslish sinel component image only
1 parent 507ca78 commit 21963da

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

tenantpipelines/pipeline.yaml

+18-10
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,39 @@ spec:
3434
script: |
3535
#!/usr/bin/env bash
3636
set -eo pipefail
37-
echo "Released Version : $(params.RELEASED_VERSION)"
38-
get-resource "snapshot" $(params.SNAPSHOT) > /tmp/snapshot.json
39-
cat /tmp/snapshot.json
40-
file="/tmp/snapshot.json"
41-
container_images=($(jq -r '.spec.components[].containerImage' "$file"))
37+
release=$(params.RELEASED_VERSION)
38+
snapshot=$(params.SNAPSHOT)
39+
echo "Released Version : release"
4240
41+
file="/tmp/snapshot.json"
4342
TARGET_REGISTRY="quay.io/openshift-pipeline"
4443
SOURCE_PATTEN="quay.io/.*/(pipeline-)?(.*@sha256:.+)"
4544
TARGET_PATTEN="${TARGET_REGISTRY}/pipelines-\2"
46-
BUNDLE_SOURCE_PATTEN="quay.io/.*/(.*)-rhel9(@sha256:.+)"
45+
BUNDLE_SOURCE_PATTEN="quay.io/.*/(.*)-rhel[0-9](@sha256:.+)"
4746
BUNDLE_TARGET_PATTEN="$TARGET_REGISTRY/pipelines-\1\2"
48-
49-
for container_image in "${container_images[@]}"; do
47+
48+
get-resource "snapshot" $snapshot > $file
49+
50+
component_name=$(jq '.metadata.labels."appstudio.openshift.io/component"' $file | tr -d '"')
51+
52+
jq -c '.spec.components[]' /tmp/snapshot.json | while read -r component ; do
53+
name=$(echo $component | jq -r .name)
54+
if [[ "$name" = "$component_name" ]]; then
55+
echo "Releasing Component : $component_name"
56+
container_image=$(echo $component | jq -r .containerImage)
5057
if [[ $container_image = *'operator-bundle'* ]]; then
5158
new_image=$(echo "$container_image" | sed -E "s|$BUNDLE_SOURCE_PATTEN|$BUNDLE_TARGET_PATTEN|g")
5259
else
5360
new_image=$(echo "$container_image" | sed -E "s|$SOURCE_PATTEN|$TARGET_PATTEN|g")
54-
new_image=$(echo "$new_image" | sed -E "s/operator-operator-rhel9/rhel9-operator/g")
61+
new_image=$(echo "$new_image" | sed -E "s/operator-operator-rhel9/rhel9-operator/g")
5562
fi
5663
echo "Component Image updated for release : $new_image"
5764
sha=${new_image/*@sha256:/}
5865
new_image=${new_image/@sha256:*/}
59-
tags=($(params.RELEASED_VERSION) ${sha} )
66+
tags=($release $sha)
6067
for tag in "${tags[@]}"; do
6168
echo "copying the image from $container_image to $new_image with tag $tag and preserving digests"
6269
skopeo copy docker://"$container_image" docker://"$new_image:$tag" --all --preserve-digests
6370
done
71+
fi
6472
done

0 commit comments

Comments
 (0)