Skip to content

Commit ee8a4bd

Browse files
authored
MULTIARCH-5196: change the org to prb112 (#63407)
* MULTIARCH-5196: change the org to prb112 Signed-off-by: Paul Bastide <[email protected]> * fix: now versus the created_at date of the image which was getting blown away Signed-off-by: Paul Bastide <[email protected]> * fix: remove usued image_date Signed-off-by: Paul Bastide <[email protected]> --------- Signed-off-by: Paul Bastide <[email protected]>
1 parent 228c0ec commit ee8a4bd

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

ci-operator/step-registry/upi/deprovision/powervs/cluster/upi-deprovision-powervs-cluster-commands.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function login_ibmcloud() {
8585
function download_automation_code() {
8686
echo "Downloading the head for ocp-upi-powervs"
8787
cd "${IBMCLOUD_HOME}" \
88-
&& curl -L https://github.com/ocp-power-automation/ocp4-upi-powervs/archive/refs/heads/ocp4-upi-powervs-terraform-1.76.2-updates.tar.gz \
88+
&& curl -L https://github.com/prb112/ocp4-upi-powervs/archive/refs/heads/terraform-1.76.2-updates.tar.gz \
8989
-o "${IBMCLOUD_HOME}"/ocp.tar.gz \
9090
&& tar -xzf "${IBMCLOUD_HOME}"/ocp.tar.gz \
9191
&& mv "${IBMCLOUD_HOME}/ocp4-upi-powervs-terraform-1.76.2-updates" "${IBMCLOUD_HOME}"/ocp4-upi-powervs
@@ -185,10 +185,17 @@ function cleanup_prior() {
185185
|| true
186186

187187
# VPC Images
188-
# TODO: FIXME add filtering by date.... ?
189-
for RESOURCE_TGT in $(ibmcloud is images --owner-type user --resource-group-name "$(< ${SHARED_DIR}/RESOURCE_GROUP)" --output json | jq -r '.[].id')
188+
for RESOURCE_TGT in $(ibmcloud is images --owner-type user --resource-group-name "${RESOURCE_GROUP}" --output json | jq -r '.[] | select(.name | contains("ci-op-") | not) .id?')
190189
do
191-
ibmcloud is image-delete "${RESOURCE_TGT}" -f
190+
echo "Removing image with id/details"
191+
ibmcloud is image --output json "${RESOURCE_TGT}" > /tmp/image.json
192+
cat /tmp/image.json
193+
jq -r 'select((.created_at | split(".")[0] | strptime("%Y-%m-%dT%H:%M:%S") | mktime | strftime("%F %X")) < (now - 86400))' /tmp/image.json > /tmp/image_old.json
194+
if [ ! -z "$(< /tmp/image_old.json)" ]
195+
then
196+
echo "Deleting Image"
197+
ibmcloud is image-delete "${RESOURCE_TGT}" -f
198+
fi
192199
done
193200

194201
echo "Done cleaning up prior runs"

ci-operator/step-registry/upi/install/powervs/cluster/upi-install-powervs-cluster-commands.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,17 @@ function cleanup_prior() {
233233
|| true
234234
235235
# VPC Images
236-
# TODO: FIXME add filtering by date.... ?
237236
for RESOURCE_TGT in $(ibmcloud is images --owner-type user --resource-group-name "${RESOURCE_GROUP}" --output json | jq -r '.[] | select(.name | contains("ci-op-") | not) .id?')
238237
do
239-
ibmcloud is image-delete "${RESOURCE_TGT}" -f
238+
echo "Removing image with id/details"
239+
ibmcloud is image --output json "${RESOURCE_TGT}" > /tmp/image.json
240+
cat /tmp/image.json
241+
jq -r 'select((.created_at | split(".")[0] | strptime("%Y-%m-%dT%H:%M:%S") | mktime | strftime("%F %X")) < (now - 86400))' /tmp/image.json > /tmp/image_old.json
242+
if [ ! -z "$(< /tmp/image_old.json)" ]
243+
then
244+
echo "Deleting Image"
245+
ibmcloud is image-delete "${RESOURCE_TGT}" -f
246+
fi
240247
done
241248
242249
echo "Done cleaning up prior runs"

0 commit comments

Comments
 (0)