I’m trying to set tag
dynamically to a date. I can’t seem to simply set it in a simple command b/c I get this issue https://github.com/CircleCI-Public/aws-ecr-orb/issues/50
How can I call the now
command when setting tag
?
orbs:
aws-ecr: circleci/aws-ecr@6.3.0
version: 2.1
commands:
now:
description: "Gets the current timestamp. If it already exists, return what was already set"
steps:
- run: |
# If DATE_TAG doesn't exist, set it
if [[ -z "${DATE_TAG}" ]]; then
echo "export DATE_TAG=$(date -u +"%Y-%m-%dT%H%M%SZ")" >> $BASH_ENV
fi
echo ${DATE_TAG}
workflows:
# Build and push to ECR on builds to master
build_and_push_image:
jobs:
- aws-ecr/build-and-push-image:
account-url: AWS_ACCOUNT_URL
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
region: AWS_REGION
repo: node
tag: now # ISO 8601 date format