@@ -6,8 +6,8 @@ GITLAB_REPO=https://gitlab.com/$MY_GITLAB_USER/tssc-dev-gitops
6
6
JENKINS_REPO=https://github.com/$MY_GITHUB_USER /tssc-dev-gitops-jenkins
7
7
8
8
DEFAULT_INIT_IMAGES=(
9
- ' quay.io/redhat-appstudio/dance-bootstrap-app:latest '
10
- ' registry.redhat.io/ubi9/httpd-24:latest '
9
+ ' quay.io/redhat-appstudio/dance-bootstrap-app'
10
+ ' registry.access. redhat.com/rhtap-task-runner/rhtap-task-runner-rhel9 '
11
11
)
12
12
13
13
WORK=$( mktemp -d)
@@ -26,6 +26,17 @@ function getImage() {
26
26
)
27
27
}
28
28
29
+ function isDefaultImage() {
30
+ local image
31
+ image=$1
32
+ for default_image in " ${DEFAULT_INIT_IMAGES[@]} " ; do
33
+ if [[ " $image " =~ ^" $default_image " ]]; then
34
+ return 0
35
+ fi
36
+ done
37
+ return 1
38
+ }
39
+
29
40
# Note, the env var name PREV_IMAGE_ENV_NAME is passed so it can be updated
30
41
function promoteIfUpdated() {
31
42
PREV_IMAGE_ENV_NAME=$1
@@ -36,20 +47,10 @@ function promoteIfUpdated() {
36
47
echo " P: ${! PREV_IMAGE_ENV_NAME} "
37
48
echo " C: $CURRENT_IMAGE "
38
49
39
- DEFAULT_INIT_IMAGE=" quay.io/redhat-appstudio/dance-bootstrap-app:latest"
40
50
if [[ " ${! PREV_IMAGE_ENV_NAME} " != " $CURRENT_IMAGE " ]]; then
41
51
echo " $REPO dev changes, from ${! PREV_IMAGE_ENV_NAME} to $CURRENT_IMAGE "
42
52
43
- is_default=false
44
- for default_image in " ${DEFAULT_INIT_IMAGES[@]} " ; do
45
- if [[ " $CURRENT_IMAGE " == " $default_image " ]]; then
46
- echo " Image changed back to default, skipping using PR to promote image"
47
- is_default=true
48
- break
49
- fi
50
- done
51
-
52
- if ! " $is_default " ; then
53
+ if ! isDefaultImage " ${CURRENT_IMAGE} " ; then
53
54
bash $SCRIPTDIR /rhtap-promote --repo $REPO
54
55
fi
55
56
@@ -67,7 +68,7 @@ function pushIfUpdated() {
67
68
68
69
if [[ " ${! PREV_IMAGE_ENV_NAME} " != " $CURRENT_IMAGE " ]]; then
69
70
echo " $REPO dev changes, from ${! PREV_IMAGE_ENV_NAME} to $CURRENT_IMAGE "
70
- if [[ " $CURRENT_IMAGE " == " $DEFAULT_INIT_IMAGE " ]] ; then
71
+ if isDefaultImage " ${ CURRENT_IMAGE} " ; then
71
72
echo " Image changed, skipping reset for default base image"
72
73
else
73
74
# jenkins update the gitops repo with a push and then run the job
0 commit comments