-
Notifications
You must be signed in to change notification settings - Fork 2k
adding a cleanup to the evaluation tests #68951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# DO NOT EDIT; this file is auto-generated using https://github.com/openshift/ci-tools. | ||
# Fetched from https://github.com/rh-ecosystem-edge/assisted-chat root OWNERS | ||
# If the repo had OWNERS_ALIASES then the aliases were expanded | ||
# Logins who are not members of 'openshift' organization were filtered out | ||
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md | ||
|
||
approvers: | ||
- carbonin | ||
- eranco74 | ||
- jhernand | ||
- omertuc | ||
options: {} | ||
reviewers: | ||
- carbonin | ||
- eranco74 | ||
- jhernand | ||
- omertuc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -o nounset | ||
set -o errexit | ||
set -o pipefail | ||
|
||
OC_URL="https://api.stage.openshift.com/api/assisted-install/v2" | ||
|
||
n=4 # number of hours to subtract | ||
current_time=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
past_time=$(date -u -d "$current_time -$n hours" +"%Y-%m-%dT%H:%M") | ||
|
||
echo "Current UTC time: $current_time" | ||
echo "Time $n hours ago (UTC): $past_time" | ||
|
||
if ! command -v ocm >/dev/null 2>&1; then \ | ||
mkdir -p "${HOME}/.local/bin" && \ | ||
curl -sSL -o "${HOME}/.local/bin/ocm" "https://github.com/openshift-online/ocm-cli/releases/latest/download/ocm-linux-amd64" && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use the API directly (curl) with the secret and id elsewhere, right? Let's just do the same here and not have to download this binary. |
||
chmod +x "${HOME}/.local/bin/ocm"; \ | ||
export PATH="${HOME}/.local/bin:${PATH}" | ||
fi | ||
|
||
ocm login --client-id "$(cat /var/run/secrets/sso-ci/client_id)" \ | ||
--client-secret "$(cat /var/run/secrets/sso-ci/client_secret)" \ | ||
--url "${OC_URL}" | ||
|
||
curl -H "Authorization: Bearer $(ocm token)" "${OC_URL}/clusters" > ${ARTIFACT_DIR}/available_clusters.json | ||
cat ${ARTIFACT_DIR}/available_clusters.json | jq '[.[] |{id, name, created_at}]' > ${ARTIFACT_DIR}/relevant_cluster_data.json | ||
cat ${ARTIFACT_DIR}/relevant_cluster_data.json | jq -r ".[] | select(.created_at < \"${past_time}\") | .id" > ${ARTIFACT_DIR}/clusters_to_delete | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we don't expect to have too many of these, right? Maybe 100 at most? |
||
|
||
cat ${ARTIFACT_DIR}/clusters_to_delete | xargs -I@ curl -X DELETE -H "Authorization: Bearer $(ocm token)" "${OC_URL}/clusters/@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"path": "rh-ecosystem-edge/assisted-chat/clean-up/rh-ecosystem-edge-assisted-chat-clean-up-ref.yaml", | ||
"owners": { | ||
"approvers": [ | ||
"carbonin", | ||
"eranco74", | ||
"jhernand", | ||
"omertuc" | ||
], | ||
"reviewers": [ | ||
"carbonin", | ||
"eranco74", | ||
"jhernand", | ||
"omertuc" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ref: | ||
as: rh-ecosystem-edge-assisted-chat-clean-up | ||
from: src | ||
cli: latest | ||
timeout: 0h30m0s | ||
commands: rh-ecosystem-edge-assisted-chat-clean-up-commands.sh | ||
credentials: | ||
- namespace: test-credentials | ||
name: assisted-chat-sso-ci | ||
mount_path: /var/run/secrets/sso-ci | ||
resources: | ||
requests: | ||
cpu: 1000m | ||
memory: 500Mi | ||
documentation: |- | ||
Run the evaluation tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is called
OC_URL
, it's the assisted service url...