Allow sha256 hash for dockerfile parent versions
Change-Id: Ib5a1022146761f153ded27a3068416d77c2c5a1f
diff --git a/jjb/shell/tagcollisionreject.sh b/jjb/shell/tagcollisionreject.sh
index a7ba04e..4a791b6 100755
--- a/jjb/shell/tagcollisionreject.sh
+++ b/jjb/shell/tagcollisionreject.sh
@@ -107,7 +107,7 @@
for df_parent in "${df_parents[@]}"
do
- df_pattern="FROM (.*):(.*)"
+ df_pattern="FROM ([^:]*):(.*)"
if [[ "$df_parent" =~ $df_pattern ]]
then
@@ -117,6 +117,10 @@
if [[ "${p_version}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
then
echo " OK: Parent '$p_image:$p_version' is a released SemVer version"
+ elif [[ "${p_version}" =~ ^.*@sha256:[0-9a-f]{64}.*$ ]]
+ then
+ # allow sha256 hashes to be used as version specifiers
+ echo " OK: Parent '$p_image:$p_version' is using a specific sha256 hash as a version"
elif [[ "${p_version}" =~ ^.*([0-9]+)\.([0-9]+).*$ ]]
then
# handle non-SemVer versions that have a Major.Minor version specifier in the name
diff --git a/jjb/shell/versiontag.sh b/jjb/shell/versiontag.sh
index 41971ce..d4091e6 100755
--- a/jjb/shell/versiontag.sh
+++ b/jjb/shell/versiontag.sh
@@ -108,7 +108,7 @@
for df_parent in "${df_parents[@]}"
do
- df_pattern="FROM (.*):(.*)"
+ df_pattern="FROM ([^:]*):(.*)"
if [[ "$df_parent" =~ $df_pattern ]]
then
@@ -118,6 +118,10 @@
if [[ "${p_version}" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
then
echo " OK: Parent '$p_image:$p_version' is a released SemVer version"
+ elif [[ "${p_version}" =~ ^.*@sha256:[0-9a-f]{64}.*$ ]]
+ then
+ # allow sha256 hashes to be used as version specifiers
+ echo " OK: Parent '$p_image:$p_version' is using a specific sha256 hash as a version"
elif [[ "${p_version}" =~ ^.*([0-9]+)\.([0-9]+).*$ ]]
then
# handle non-SemVer versions that have a Major.Minor version specifier in the name