forked from apache/incubator-kie-drools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KOGITO-1884] - Clean up old cucumber test namespaces (apache#10)
See: https://issues.redhat.com/browse/KOGITO-1884 Signed-off-by: Mauricio Magnani <mmagnani@redhat.com>
- Loading branch information
1 parent
95e19c6
commit 4768d8f
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pipeline{ | ||
agent {label 'operator-slave'} | ||
triggers { | ||
cron('@midnight') | ||
} | ||
stages{ | ||
stage('Clean Old Namespaces'){ | ||
steps{ | ||
sh "tools/clean-old-namespaces.sh" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
IN=$(kubectl get namespace -o jsonpath='{range .items[*].metadata}{.name}{";"}{.creationTimestamp}{"\n"}{end}' | awk '/cucumber-/') | ||
projects=$(echo $IN | tr "\n" "\n") | ||
date_cleanup=$(date -u +"%Y-%m-%dT%H:%M:%SZ" -d "1 day ago") | ||
for values in $projects | ||
do | ||
name_project=${values%;*} | ||
date_project=${values#*;} | ||
if [[ "$date_project" < "$date_cleanup" ]] ; then | ||
oc delete project $name_project | ||
echo "delete project ${name_project}" | ||
fi | ||
done |