Skip to content

Commit 4236ec1

Browse files
CLOUDP-221656: Added an openshift test cleaner to the regular cleaner job (#2360)
Added an openshift test cleaner to the regular cleaner job
1 parent 56fa397 commit 4236ec1

File tree

4 files changed

+148
-42
lines changed

4 files changed

+148
-42
lines changed

.github/workflows/cleanup-test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,10 @@ jobs:
6666
PROJECT_LIFETIME: ${{ inputs.lifetime || 1 }}
6767
run: |
6868
devbox run -- 'cd tools/clean && ./clean atlas'
69+
70+
- name: Run openshift test cleaner
71+
env:
72+
OC_TOKEN: ${{ secrets.OPENSHIFT_UPGRADE_TOKEN }}
73+
CLUSTER_API_URL: ${{ secrets.OPENSHIFT_UPGRADE_SERVER_API }}
74+
run: |
75+
devbox run -- 'cd scripts && ./openshift-upgrade-test-cleaner.sh'

devbox.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
2525
"awscli2@latest",
2626
"go-mockery@latest",
27-
"docker-sbom@latest"
27+
"docker-sbom@latest",
28+
"openshift@latest"
2829
]
2930
}

devbox.lock

Lines changed: 88 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,50 @@
22
"lockfile_version": "1",
33
"packages": {
44
"act@latest": {
5-
"last_modified": "2025-05-16T20:19:48Z",
6-
"resolved": "github:NixOS/nixpkgs/12a55407652e04dcf2309436eb06fef0d3713ef3#act",
5+
"last_modified": "2025-06-05T08:10:37Z",
6+
"resolved": "github:NixOS/nixpkgs/ec62ae342c340d24289735e31eb9155261cd5fe7#act",
77
"source": "devbox-search",
8-
"version": "0.2.77",
8+
"version": "0.2.78",
99
"systems": {
1010
"aarch64-darwin": {
1111
"outputs": [
1212
{
1313
"name": "out",
14-
"path": "/nix/store/30f9jix2hdkbcigx5wbzvfcr6ddxamd0-act-0.2.77",
14+
"path": "/nix/store/gmwb5nb910r0g11wphyhcgkkb73cyz4g-act-0.2.78",
1515
"default": true
1616
}
1717
],
18-
"store_path": "/nix/store/30f9jix2hdkbcigx5wbzvfcr6ddxamd0-act-0.2.77"
18+
"store_path": "/nix/store/gmwb5nb910r0g11wphyhcgkkb73cyz4g-act-0.2.78"
1919
},
2020
"aarch64-linux": {
2121
"outputs": [
2222
{
2323
"name": "out",
24-
"path": "/nix/store/s8bykxs7wglgvvwqf7pi3mq9hw0a93x5-act-0.2.77",
24+
"path": "/nix/store/3h6w4yyv6krgiwvy7kfm2f7hm1h5z8sv-act-0.2.78",
2525
"default": true
2626
}
2727
],
28-
"store_path": "/nix/store/s8bykxs7wglgvvwqf7pi3mq9hw0a93x5-act-0.2.77"
28+
"store_path": "/nix/store/3h6w4yyv6krgiwvy7kfm2f7hm1h5z8sv-act-0.2.78"
2929
},
3030
"x86_64-darwin": {
3131
"outputs": [
3232
{
3333
"name": "out",
34-
"path": "/nix/store/5drbfgpw10h7n3d9w5q5x3wxva6w4rzx-act-0.2.77",
34+
"path": "/nix/store/2ldaxvizvd4130rjsnn0dm4xnsvjq2wz-act-0.2.78",
3535
"default": true
3636
}
3737
],
38-
"store_path": "/nix/store/5drbfgpw10h7n3d9w5q5x3wxva6w4rzx-act-0.2.77"
38+
"store_path": "/nix/store/2ldaxvizvd4130rjsnn0dm4xnsvjq2wz-act-0.2.78"
3939
},
4040
"x86_64-linux": {
4141
"outputs": [
4242
{
4343
"name": "out",
44-
"path": "/nix/store/hv5fbj7iws3xkn0bn06hp8j67dbc2nl2-act-0.2.77",
44+
"path": "/nix/store/nnjly4y9m3mssv7g1l151bwmbs294qlk-act-0.2.78",
4545
"default": true
4646
}
4747
],
48-
"store_path": "/nix/store/hv5fbj7iws3xkn0bn06hp8j67dbc2nl2-act-0.2.77"
48+
"store_path": "/nix/store/nnjly4y9m3mssv7g1l151bwmbs294qlk-act-0.2.78"
4949
}
5050
}
5151
},
@@ -162,8 +162,8 @@
162162
}
163163
},
164164
"docker-sbom@latest": {
165-
"last_modified": "2025-05-28T23:33:38Z",
166-
"resolved": "github:NixOS/nixpkgs/e80506de785dc48dcfbb636c443c5e2b0b5b2d7d#docker-sbom",
165+
"last_modified": "2025-05-16T20:19:48Z",
166+
"resolved": "github:NixOS/nixpkgs/12a55407652e04dcf2309436eb06fef0d3713ef3#docker-sbom",
167167
"source": "devbox-search",
168168
"version": "0.6.1",
169169
"systems": {
@@ -181,11 +181,11 @@
181181
"outputs": [
182182
{
183183
"name": "out",
184-
"path": "/nix/store/6x1g87s1nvbvyf3hhvynviycq3r7p73v-docker-sbom-0.6.1",
184+
"path": "/nix/store/376jffsarq5y17hi3kzilvxxp43d068b-docker-sbom-0.6.1",
185185
"default": true
186186
}
187187
],
188-
"store_path": "/nix/store/6x1g87s1nvbvyf3hhvynviycq3r7p73v-docker-sbom-0.6.1"
188+
"store_path": "/nix/store/376jffsarq5y17hi3kzilvxxp43d068b-docker-sbom-0.6.1"
189189
},
190190
"x86_64-darwin": {
191191
"outputs": [
@@ -201,17 +201,17 @@
201201
"outputs": [
202202
{
203203
"name": "out",
204-
"path": "/nix/store/0ypwhmk25zjn7jnj16rbmkyj39biqkbn-docker-sbom-0.6.1",
204+
"path": "/nix/store/wgq665adqxj748k402sq93jzi281c337-docker-sbom-0.6.1",
205205
"default": true
206206
}
207207
],
208-
"store_path": "/nix/store/0ypwhmk25zjn7jnj16rbmkyj39biqkbn-docker-sbom-0.6.1"
208+
"store_path": "/nix/store/wgq665adqxj748k402sq93jzi281c337-docker-sbom-0.6.1"
209209
}
210210
}
211211
},
212212
"docker@latest": {
213-
"last_modified": "2025-05-28T23:33:38Z",
214-
"resolved": "github:NixOS/nixpkgs/e80506de785dc48dcfbb636c443c5e2b0b5b2d7d#docker",
213+
"last_modified": "2025-05-16T20:19:48Z",
214+
"resolved": "github:NixOS/nixpkgs/12a55407652e04dcf2309436eb06fef0d3713ef3#docker",
215215
"source": "devbox-search",
216216
"version": "27.5.1",
217217
"systems": {
@@ -229,11 +229,11 @@
229229
"outputs": [
230230
{
231231
"name": "out",
232-
"path": "/nix/store/1yl6p3f1v83cm5r87gj4r4dsfdj8wjlc-docker-27.5.1",
232+
"path": "/nix/store/gz4mp52l9ycryglmn5r1r96yqpl4p9dx-docker-27.5.1",
233233
"default": true
234234
}
235235
],
236-
"store_path": "/nix/store/1yl6p3f1v83cm5r87gj4r4dsfdj8wjlc-docker-27.5.1"
236+
"store_path": "/nix/store/gz4mp52l9ycryglmn5r1r96yqpl4p9dx-docker-27.5.1"
237237
},
238238
"x86_64-darwin": {
239239
"outputs": [
@@ -249,11 +249,11 @@
249249
"outputs": [
250250
{
251251
"name": "out",
252-
"path": "/nix/store/6j9mml5qqxd5z9kdzrqmkz85g1cqnxp5-docker-27.5.1",
252+
"path": "/nix/store/a20gyq0y2j770yw6yjlpkqv149y268zg-docker-27.5.1",
253253
"default": true
254254
}
255255
],
256-
"store_path": "/nix/store/6j9mml5qqxd5z9kdzrqmkz85g1cqnxp5-docker-27.5.1"
256+
"store_path": "/nix/store/a20gyq0y2j770yw6yjlpkqv149y268zg-docker-27.5.1"
257257
}
258258
}
259259
},
@@ -406,8 +406,8 @@
406406
}
407407
},
408408
"git@latest": {
409-
"last_modified": "2025-05-29T08:12:58Z",
410-
"resolved": "github:NixOS/nixpkgs/3866ad91cfc172f08a6839def503d8fc2923c603#git",
409+
"last_modified": "2025-05-16T20:19:48Z",
410+
"resolved": "github:NixOS/nixpkgs/12a55407652e04dcf2309436eb06fef0d3713ef3#git",
411411
"source": "devbox-search",
412412
"version": "2.49.0",
413413
"systems": {
@@ -432,13 +432,13 @@
432432
"path": "/nix/store/bqk89pw1wmjzrqi20vqz194ylfhl5cnm-git-2.49.0",
433433
"default": true
434434
},
435-
{
436-
"name": "doc",
437-
"path": "/nix/store/ll9hlbwp3vvihpx2p2g7mykrl2a4snk4-git-2.49.0-doc"
438-
},
439435
{
440436
"name": "debug",
441437
"path": "/nix/store/ypv73aihzciz9x12imf5dvz4qkn4wakd-git-2.49.0-debug"
438+
},
439+
{
440+
"name": "doc",
441+
"path": "/nix/store/ll9hlbwp3vvihpx2p2g7mykrl2a4snk4-git-2.49.0-doc"
442442
}
443443
],
444444
"store_path": "/nix/store/bqk89pw1wmjzrqi20vqz194ylfhl5cnm-git-2.49.0"
@@ -478,8 +478,7 @@
478478
}
479479
},
480480
"github:NixOS/nixpkgs/nixpkgs-unstable": {
481-
"last_modified": "2025-06-06T12:35:49Z",
482-
"resolved": "github:NixOS/nixpkgs/a4ff0e3c64846abea89662bfbacf037ef4b34207?lastModified=1749213349&narHash=sha256-UAaWOyQhdp7nXzsbmLVC67fo%2BQetzoTm9hsPf9X3yr4%3D"
481+
"resolved": "github:NixOS/nixpkgs/8d6cdc7756817e0c4b24567271634a44bcf80752?lastModified=1749743618&narHash=sha256-ibsz06u1jlWyH7YURnRhLQn38Tuc5zwknr00suFjvfA%3D"
483482
},
484483
"go-mockery@latest": {
485484
"last_modified": "2025-05-16T20:19:48Z",
@@ -722,8 +721,8 @@
722721
}
723722
},
724723
"jq@latest": {
725-
"last_modified": "2025-05-29T08:12:58Z",
726-
"resolved": "github:NixOS/nixpkgs/3866ad91cfc172f08a6839def503d8fc2923c603#jq",
724+
"last_modified": "2025-06-10T02:39:58Z",
725+
"resolved": "github:NixOS/nixpkgs/cdc68935eba9f86d155585fdf6f17af6824f38ac#jq",
727726
"source": "devbox-search",
728727
"version": "1.7.1",
729728
"systems": {
@@ -793,17 +792,17 @@
793792
"path": "/nix/store/0rsic796c75zmdaa3qw74676dgcibwan-jq-1.7.1-man",
794793
"default": true
795794
},
796-
{
797-
"name": "doc",
798-
"path": "/nix/store/dvap16zqbcxmil71f6ivbpzx49z7brzx-jq-1.7.1-doc"
799-
},
800795
{
801796
"name": "out",
802797
"path": "/nix/store/0gw2kw6zkvzg7zlqy4rrgdxjk13yg0z4-jq-1.7.1"
803798
},
804799
{
805800
"name": "dev",
806801
"path": "/nix/store/38vgg0iqwmhh8shn12ys3wqxv24gkq5n-jq-1.7.1-dev"
802+
},
803+
{
804+
"name": "doc",
805+
"path": "/nix/store/dvap16zqbcxmil71f6ivbpzx49z7brzx-jq-1.7.1-doc"
807806
}
808807
],
809808
"store_path": "/nix/store/if69q6bw49y67lv9f4bf78cgpf7xrnrb-jq-1.7.1-bin"
@@ -820,17 +819,17 @@
820819
"path": "/nix/store/2dmx0pgvxjmqywg25rva6cgkz94icnw7-jq-1.7.1-man",
821820
"default": true
822821
},
822+
{
823+
"name": "out",
824+
"path": "/nix/store/sdqzcyfy52y0vf10nfsxy3mhv9b2vmkv-jq-1.7.1"
825+
},
823826
{
824827
"name": "dev",
825828
"path": "/nix/store/yika3khvh871bvk5sgpcxfdbqznyi3w0-jq-1.7.1-dev"
826829
},
827830
{
828831
"name": "doc",
829832
"path": "/nix/store/97zv95jlfnw4v3k0lyxmkmkqqjhx7np9-jq-1.7.1-doc"
830-
},
831-
{
832-
"name": "out",
833-
"path": "/nix/store/sdqzcyfy52y0vf10nfsxy3mhv9b2vmkv-jq-1.7.1"
834833
}
835834
],
836835
"store_path": "/nix/store/n9ch6ggimi6ri5vx62mqmzgrrkb3qfwg-jq-1.7.1-bin"
@@ -1089,6 +1088,54 @@
10891088
}
10901089
}
10911090
},
1091+
"openshift@latest": {
1092+
"last_modified": "2025-05-16T20:19:48Z",
1093+
"resolved": "github:NixOS/nixpkgs/12a55407652e04dcf2309436eb06fef0d3713ef3#openshift",
1094+
"source": "devbox-search",
1095+
"version": "4.16.0",
1096+
"systems": {
1097+
"aarch64-darwin": {
1098+
"outputs": [
1099+
{
1100+
"name": "out",
1101+
"path": "/nix/store/jznnib7y38v5fy69p6xnpnvnks664xgq-openshift-4.16.0",
1102+
"default": true
1103+
}
1104+
],
1105+
"store_path": "/nix/store/jznnib7y38v5fy69p6xnpnvnks664xgq-openshift-4.16.0"
1106+
},
1107+
"aarch64-linux": {
1108+
"outputs": [
1109+
{
1110+
"name": "out",
1111+
"path": "/nix/store/rqn7n8mhn79f5np4z5hj2jagy6x53ijw-openshift-4.16.0",
1112+
"default": true
1113+
}
1114+
],
1115+
"store_path": "/nix/store/rqn7n8mhn79f5np4z5hj2jagy6x53ijw-openshift-4.16.0"
1116+
},
1117+
"x86_64-darwin": {
1118+
"outputs": [
1119+
{
1120+
"name": "out",
1121+
"path": "/nix/store/gw4ki0w6via0vj3578cinibj1w2iqq8i-openshift-4.16.0",
1122+
"default": true
1123+
}
1124+
],
1125+
"store_path": "/nix/store/gw4ki0w6via0vj3578cinibj1w2iqq8i-openshift-4.16.0"
1126+
},
1127+
"x86_64-linux": {
1128+
"outputs": [
1129+
{
1130+
"name": "out",
1131+
"path": "/nix/store/rmd36xgdz4vgd8w6x8mcx2pig7c3aafq-openshift-4.16.0",
1132+
"default": true
1133+
}
1134+
],
1135+
"store_path": "/nix/store/rmd36xgdz4vgd8w6x8mcx2pig7c3aafq-openshift-4.16.0"
1136+
}
1137+
}
1138+
},
10921139
10931140
"last_modified": "2024-09-10T15:01:03Z",
10941141
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#operator-sdk",
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
# Copyright 2025 MongoDB Inc
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
17+
# This script is made to make sure the test environment is clean after running the upgrade test.
18+
set -eou pipefail
19+
20+
expect_success_silent(){
21+
local cmd=$1
22+
if $cmd ; then
23+
return 0
24+
fi
25+
return 1
26+
}
27+
28+
oc_login() {
29+
echo "Logging in to the cluster..."
30+
expect_success_silent "oc login --token=${OC_TOKEN} --server=${CLUSTER_API_URL}"
31+
echo "Logged in to the cluster"
32+
oc get clusterversion/version
33+
}
34+
35+
main() {
36+
echo "AKO openshift upgrade test cleaner"
37+
oc_login
38+
echo "Cleaning up the test leftovers..."
39+
namespaces=$(oc get namespaces | grep "ako-upgrade-test-" | awk '{print $1}')
40+
if [ -z "$namespaces" ]; then
41+
echo "No namespaces found for cleanup"
42+
else
43+
for ns in $namespaces; do
44+
echo "Deleting namespace: $ns"
45+
oc delete namespace --force "$ns" --wait=true --timeout=60s || true
46+
done
47+
fi
48+
}
49+
50+
# Entrypoint
51+
main

0 commit comments

Comments
 (0)