Skip to content

Pass build date in build_args when building Dockerfile #6810

Answered by taylorsilva
ddhanak asked this question in General
Discussion options

You must be logged in to vote

You'll need to have a task generate the date in the format you want. You could output the date into a file and then use load_var to read the file into a variable that you can then pass into your build step as a param using the var format ((.:my-var))

Might look something like this:

- task: generate-date
  config:
  ...
  outputs:
  - name: todays
  run:
    path: sh
    args:
    - -cx
    - |
      date +'%Y%m%d' > todays/date
- load_var: date
  file: todays/date
- task: build-image
  config:
    ...
    params:
      ARG_DATE: ((.:date))

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Shuu-Ri
Comment options

@taylorsilva
Comment options

@Shuu-Ri
Comment options

Answer selected by ddhanak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants