Skip to content

Commit 5f4835e

Browse files
authored
shiftstack/prune: relax images cleanup (openshift#60956)
With Hypershift e2e jobs, the RHCOS image will be pushed into Glance for HostedCluster. The link of the qcow2 is taken from the release payload. In order to save network transfers, we will keep the RHCOS image longer than 7h so it can be re-used by other jobs which need it until there is a new image that is published. For now, we'll cleanup the images every 2 weeks (only where the job runs, so on VEXXHOST) to see how that works but this could be adjusted in the future.
1 parent 356a132 commit 5f4835e

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

ci-operator/config/shiftstack/ci/shiftstack-ci-main.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ tests:
2828
steps:
2929
env:
3030
CLUSTER_TYPE_OVERRIDE: openstack-vexxhost
31+
IMAGES_TTL: 336h
3132
OPENSTACK_AUTHENTICATION_METHOD: password
3233
workflow: shiftstack-cleanup
3334
- as: cleanup-openstack-nfv

ci-operator/step-registry/shiftstack/cleanup/shiftstack-cleanup-commands.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,16 @@ export OS_CLIENT_CONFIG_FILE="${SHARED_DIR}/clouds.yaml"
77
export CLUSTER_TYPE="${CLUSTER_TYPE_OVERRIDE:-${CLUSTER_TYPE:-}}"
88
SLACK_HOOK="$(</var/run/slack-hooks/shiftstack-bot)"
99

10-
prune --resource-ttl="$RESOURCE_TTL" --slack-hook="$SLACK_HOOK" --no-dry-run > "${ARTIFACT_DIR}/result.json"
10+
EXCLUDE_ARG=""
11+
if [ -n "${IMAGES_TTL:-}" ]; then
12+
EXCLUDE_ARG="--exclude=images"
13+
prune --resource-ttl="$IMAGES_TTL" --slack-hook="$SLACK_HOOK" --no-dry-run --include="images" > "/tmp/images-result.json"
14+
fi
15+
16+
prune --resource-ttl="$RESOURCE_TTL" --slack-hook="$SLACK_HOOK" --no-dry-run "$EXCLUDE_ARG" > "/tmp/all-result.json"
17+
18+
if [ -n "${IMAGES_TTL:-}" ]; then
19+
jq -s '.[0] + .[1]' "/tmp/images-result.json" "/tmp/all-result.json" > "/tmp/result.json"
20+
else
21+
cp "/tmp/all-result.json" "/tmp/result.json"
22+
fi

ci-operator/step-registry/shiftstack/cleanup/shiftstack-cleanup-ref.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,10 @@ ref:
1919
If set, overrides CLUSTER_TYPE in this step.
2020
- name: RESOURCE_TTL
2121
default: 7h
22+
- name: IMAGES_TTL
23+
default: ''
24+
documentation: |-
25+
If set, prune the images with a different TTL than RESOURCE_TTL
26+
and exclude images from the other prune command.
2227
documentation: |-
2328
Prune resources on the CI clouds.

0 commit comments

Comments
 (0)