Using timezone in tasks
To use timezone in concourse tasks, 2 conditions must be met:
- The image used by the concourse task must be timezone-aware
- The TZ env variable must be set
This is a sample dockerfile for a Ubuntu-based image with timezone awareness:
# oozie/los_angelesFROM ubuntuENV TZ=America/Los_AngelesRUN apt update && apt install -y tzdata
The following pipeline embeds a task that results in a timezoned output from the date
command.
The first invocation will display date and time in PST format while the subsequent invocation
will produce date and time in UTC.
jobs:- name: timezoned-taskplan:- task: tz-awareconfig:platform: linuximage_resource:type: docker-imagesource:repository: oozie/los_angelesrun:path: /bin/bashargs:- -c- |dateTZ=UTC date