@ -27,9 +27,9 @@ Creates Date and Timestamp tags for a Docker Image on Google Cloud Registry, bas
Tags are in the format:
Tags are in the format:
YYYY-MM-DD
YYYY-MM-DD
YYYY-MM-DDTHHMMSS(standard ISO timestamp without the timezone or semi-colons which are invalid chars for docker image tags)
YYYY-MM-DDTHHMMSSZ (standard ISO UTC time without semi-colons which are invalid in docker tags)
The timestamp will be the localtime for timezone as-is from GCR itself, no munging is done to normalize to UTC
The timestamp will be normalized to UTC
Requires GCloud SDK to be installed and configured
Requires GCloud SDK to be installed and configured
"
"
@ -56,14 +56,22 @@ if [ -z "$timestamp" ]; then
echo"Failed to determine timestamp from Cloud Build for image '$docker_image' with tag '$tag'"
echo"Failed to determine timestamp from Cloud Build for image '$docker_image' with tag '$tag'"
exit1
exit1
fi
fi
timestamp="${timestamp%%+*}"
if ! [["$timestamp"=~ ^[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}[[:space:]][[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}[+-][[:digit:]]{2}:[[:digit:]]{2}$ ]];then
if ! [["$timestamp"=~ ^[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}[[:space:]][[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}$ ]];then
echo"Cloud Build timestamp not in expect YYYY-MM-DD HH:MM:SS[+-]HH:MM format, API may have changed"
echo"Cloud Build timestamp not in expect YYYY-MM-DD HH:MM:SS format, API may have changed"