Skip to content

Commit ef7e2a2

Browse files
committed
adding a cleanup to the evaluation tests
1 parent e4f3da9 commit ef7e2a2

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# DO NOT EDIT; this file is auto-generated using https://github.com/openshift/ci-tools.
2+
# Fetched from https://github.com/rh-ecosystem-edge/assisted-chat root OWNERS
3+
# If the repo had OWNERS_ALIASES then the aliases were expanded
4+
# Logins who are not members of 'openshift' organization were filtered out
5+
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md
6+
7+
approvers:
8+
- carbonin
9+
- eranco74
10+
- jhernand
11+
- omertuc
12+
options: {}
13+
reviewers:
14+
- carbonin
15+
- eranco74
16+
- jhernand
17+
- omertuc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
set -o nounset
4+
set -o errexit
5+
set -o pipefail
6+
7+
OC_URL="https://api.stage.openshift.com/api/assisted-install/v2"
8+
9+
n=4 # number of hours to subtract
10+
current_time=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
11+
past_time=$(date -u -d "$current_time -$n hours" +"%Y-%m-%dT%H:%M")
12+
13+
echo "Current UTC time: $current_time"
14+
echo "Time $n hours ago (UTC): $past_time"
15+
16+
if ! command -v ocm >/dev/null 2>&1; then \
17+
mkdir -p "${HOME}/.local/bin" && \
18+
curl -sSL -o "${HOME}/.local/bin/ocm" "https://github.com/openshift-online/ocm-cli/releases/latest/download/ocm-linux-amd64" && \
19+
chmod +x "${HOME}/.local/bin/ocm"; \
20+
export PATH="${HOME}/.local/bin:${PATH}"
21+
fi
22+
23+
ocm login --client-id "$(cat /var/run/secrets/sso-ci/client_id)" \
24+
--client-secret "$(cat /var/run/secrets/sso-ci/client_secret)" \
25+
--url "${OC_URL}"
26+
27+
curl -H "Authorization: Bearer $(ocm token)" "${OC_URL}/clusters" > ${ARTIFACT_DIR}/available_clusters.json
28+
cat ${ARTIFACT_DIR}/available_clusters.json | jq '[.[] |{id, name, created_at}]' > ${ARTIFACT_DIR}/relevant_cluster_data.json
29+
cat ${ARTIFACT_DIR}/relevant_cluster_data.json | jq -r ".[] | select(.created_at < \"${past_time}\") | .id" > ${ARTIFACT_DIR}/clusters_to_delete
30+
31+
cat ${ARTIFACT_DIR}/clusters_to_delete | xargs -I@ curl -X DELETE -H "Authorization: Bearer $(ocm token)" "${OC_URL}/clusters/@"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"path": "rh-ecosystem-edge/assisted-chat/clean-up/rh-ecosystem-edge-assisted-chat-clean-up-ref.yaml",
3+
"owners": {
4+
"approvers": [
5+
"carbonin",
6+
"eranco74",
7+
"jhernand",
8+
"omertuc"
9+
],
10+
"reviewers": [
11+
"carbonin",
12+
"eranco74",
13+
"jhernand",
14+
"omertuc"
15+
]
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ref:
2+
as: rh-ecosystem-edge-assisted-chat-clean-up
3+
from: src
4+
cli: latest
5+
timeout: 0h30m0s
6+
commands: rh-ecosystem-edge-assisted-chat-clean-up-commands.sh
7+
credentials:
8+
- namespace: test-credentials
9+
name: assisted-chat-sso-ci
10+
mount_path: /var/run/secrets/sso-ci
11+
resources:
12+
requests:
13+
cpu: 1000m
14+
memory: 500Mi
15+
documentation: |-
16+
Run the evaluation tests

ci-operator/step-registry/rh-ecosystem-edge/assisted-chat/rh-ecosystem-edge-assisted-chat-workflow.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ workflow:
99
test:
1010
- ref: rh-ecosystem-edge-assisted-chat-test
1111
post:
12+
- ref: rh-ecosystem-edge-assisted-chat-clean-up
1213
- chain: gather
1314
documentation: |-
1415
Install assisted-chat with all it's dependencies

0 commit comments

Comments
 (0)