Kavsha
Apr 20, 2021

--

Set timezone of docker Image in bitbucket.yaml

Some of you might have come across failure of automation scripts in CI machines due to different timezones. Sometimes our application supports local timezone but CI machines by default supports UTC time zone.

For this case, adding small script to .yaml file helps to resolve this issue.

In my case, used bitbucket pipeline and cypress as automation tool. Below is the script added to bitbucket .Yaml to change the timezone.

script:

- date # Date with current Time zone

- cp -f /usr/share/zoneinfo/Australia/Melbourne /etc/localtime # Change current time zone to Australia/MelbourneTime zone

- date # New Timezone’s Date/Time

Cypress: Add the following before the run command

TZ=Australia/Melbourne cypress run

--

--