Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set string to current date time?

I'm working through my first circleci build using aws-ecr orb and I want my tag to be set dynamically based on the current timestamp. How can I do that?

orbs:
  aws-ecr: circleci/[email protected]
version: 2.1
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: <HOW TO SET TAG TO CURRENT DATETIME????>
          filters:
            branches:
              only: master
like image 252
Catfish Avatar asked Sep 17 '25 04:09

Catfish


1 Answers

You can append the date using Linux formatting (date +FORMAT).

As user Al-un mentioned above, this is a great reference on how to use those formats.

Here is another user who does something similar.

like image 173
Axelle Avatar answered Sep 19 '25 16:09

Axelle