File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -52,15 +52,18 @@ variables:
5252 services :
5353 - docker:$DOCKER_VERSION-dind
5454 script :
55- # - export UNIX_TIMESTAMP=$(date -d "$CI_COMMIT_TIMESTAMP" -D "%Y-%m-%dT%H:%M:%SZ"+%s)
56- # - echo "Unix timestamp - $UNIX_TIMESTAMP"
57- - echo "Tagging $DOCKER_IMAGE_NAME:$PROMOTED_ENVIRONMENT-$CI_COMMIT_TIMESTAMP from $DOCKER_IMAGE_FULL_TAG"
55+ # Remove the UTC offset, not supported by `date` in docker image (busybox)
56+ - export CLEAN_DATETIME=$(echo "$CI_COMMIT_TIMESTAMP" | sed 's/+00:00//' | sed 's/Z//')
57+ # Transform in unix timestamp
58+ - export UNIX_TIMESTAMP=$(date -d "$CLEAN_DATETIME" -D "%Y-%m-%dT%H:%M:%SZ"+%s)
59+ - echo "Unix timestamp - $UNIX_TIMESTAMP"
60+ - echo "Tagging $DOCKER_IMAGE_NAME:$PROMOTED_ENVIRONMENT-$UNIX_TIMESTAMP from $DOCKER_IMAGE_FULL_TAG"
5861 - docker buildx imagetools create
5962 --annotation "index:org.opencontainers.image.version=$CI_COMMIT_SHORT_SHA"
6063 --annotation "index:org.opencontainers.image.revision=$CI_COMMIT_SHA"
6164 --annotation "index:org.opencontainers.image.source=$CI_PROJECT_URL"
6265 --annotation "index:org.opencontainers.image.created=$CI_JOB_STARTED_AT"
63- --tag "$DOCKER_IMAGE_NAME:$PROMOTED_ENVIRONMENT-$CI_COMMIT_TIMESTAMP "
66+ --tag "$DOCKER_IMAGE_NAME:$PROMOTED_ENVIRONMENT-$UNIX_TIMESTAMP "
6467 " $DOCKER_IMAGE_FULL_TAG"
6568
6669.python-typing :
You can’t perform that action at this time.
0 commit comments