@@ -53,8 +53,10 @@ function is_dockerfile_fresh() {
5353function build_ansible_base() {
5454 local tag=$1
5555 local platforms=$2
56+ local buildlatest=$3
5657 local dockerfile=./images/ansible-operator/base.Dockerfile
5758
59+
5860 git checkout refs/tags/$tag
5961 local ansible_base_image_tag=$( grep -oP ' FROM \K(quay\.io/operator-framework/ansible-operator-base:.+)' ./images/ansible-operator/Dockerfile)
6062 # Attempt to get the git ref that built this image from the git_commit image label,
@@ -69,8 +71,13 @@ function build_ansible_base() {
6971 echo " Skipping build of $dockerfile , it is FRESH!"
7072 else
7173 # dockerfile is not fresh, rebuildng image
72- echo " Rebuilding image [$ansible_base_image_tag ] for [$platforms ]"
73- _buildx --tag $ansible_base_image_tag --platform " $platforms " --file " $dockerfile " $IMAGE_DO --build-arg GIT_COMMIT=$ansible_base_git_ref ./images/ansible-operator
74+ if $buildlatest ; then
75+ echo " Rebuilding image [$ansible_base_image_tag ] and latest for [$platforms ]"
76+ _buildx --tag $ansible_base_image_tag --tag quay.io/operator-framework/ansible-operator-base:latest --platform " $platforms " --file " $dockerfile " $IMAGE_DO --build-arg GIT_COMMIT=$ansible_base_git_ref ./images/ansible-operator
77+ else
78+ echo " Rebuilding image [$ansible_base_image_tag ] for [$platforms ]"
79+ _buildx --tag $ansible_base_image_tag --platform " $platforms " --file " $dockerfile " $IMAGE_DO --build-arg GIT_COMMIT=$ansible_base_git_ref ./images/ansible-operator
80+ fi
7481 fi
7582}
7683
@@ -82,16 +89,23 @@ function build_generic() {
8289 local tag=$1
8390 local id=$2
8491 local platforms=$3
92+ local buildlatest=$4
8593 local tag_maj_min=" quay.io/operator-framework/${id} :$( echo $tag | grep -Eo " v[1-9]+\.[0-9]+" ) "
8694 local tag_full=" quay.io/operator-framework/${id} :${tag} "
95+ local tag_latest=" quay.io/operator-framework/${id} :latest"
8796 local dockerfile=./images/${id} /Dockerfile
8897
8998 git checkout refs/tags/$tag
9099 if is_dockerfile_fresh " $dockerfile " ; then
91100 echo " Skipping build of $dockerfile , it is FRESH!"
92101 else
93102 # dockerfile is not fresh, rebuildng image
94- echo " Rebuilding image [$tag_maj_min ] for [$platforms ]"
95- _buildx --builder=container --tag " $tag_maj_min " --tag " $tag_full " --platform " $platforms " --file " $dockerfile " $IMAGE_DO .
103+ if $buildlatest ; then
104+ echo " Rebuilding image [$tag_maj_min ] and latest for [$platforms ]"
105+ _buildx --builder=container --tag " $tag_maj_min " --tag " $tag_full " --tag " $tag_latest " --platform " $platforms " --file " $dockerfile " $IMAGE_DO .
106+ else
107+ echo " Rebuilding image [$tag_maj_min ] for [$platforms ]"
108+ _buildx --builder=container --tag " $tag_maj_min " --tag " $tag_full " --platform " $platforms " --file " $dockerfile " $IMAGE_DO .
109+ fi
96110 fi
97111}
0 commit comments