Skip to content

Set Europe/London timezone in pipeline-visualiser container#1507

Merged
sarahseewhy merged 5 commits into
mainfrom
visualiser_use_server_timezone
Apr 14, 2025
Merged

Set Europe/London timezone in pipeline-visualiser container#1507
sarahseewhy merged 5 commits into
mainfrom
visualiser_use_server_timezone

Conversation

@AP-Hunt
Copy link
Copy Markdown
Contributor

@AP-Hunt AP-Hunt commented Apr 8, 2025

What problem does this pull request solve?

Trello card: https://trello.com/c/gg3J5mMT/434-visualiser-fix-timezone

The timezone needs to be set explicitly to Europe/London in order to show the correct time in tool. Ruby respects the timezone information when it's present, and automatically converts timestamps with a timezone attached into the local time.

How to review

  1. Go to CodePipeline in an AWS account and find the date a pipeline last ran. Make a note of the time and timezone.
  2. Run the tool locally in a container
cd support/pipeline-visualiser/
docker build . -t forms-pipeline-visualizer:latest

CREDS_JSON="$$(aws sts assume-role --role-arn "arn:aws:iam::711966560482:role/deploy-pipeline-visualiser-ecs-task" --role-session-name "run-pipeline-visualiser")"; \
AWS_ACCESS_KEY_ID="$$(echo "$${CREDS_JSON}" | jq -r '.Credentials.AccessKeyId')" \
AWS_SECRET_ACCESS_KEY="$$(echo "$${CREDS_JSON}" | jq -r '.Credentials.SecretAccessKey')" \
AWS_SESSION_TOKEN="$$(echo "$${CREDS_JSON}" | jq -r '.Credentials.SessionToken')" \
\
docker run -p "4567:4567" -e "TZ=Europe/London" -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION -v "$$(pwd):/app" forms-pipeline-visualizer:latest
  1. Open it up, find the pipeline you were looking at in the AWS console
  2. Check the time noted there matches what it should be in Europe/London

Reminders

If you've made changes to the deployer role (files in modules/deployer-access):

  • Remember to run make <environment> forms/account apply on the relevant environments (dev, staging, user-research, and/or prod)
  • Check the #govuk-forms-deployment-notifications Slack channel to ensure the apply-forms-terraform-<environment> pipelines have run successfully

The timezone needs to be set explicitly to Europe/London in order to show the
correct time in tool.
@lfdebrux
Copy link
Copy Markdown
Contributor

lfdebrux commented Apr 9, 2025

Is there a way we could get it to show the timezone based on the browser locale?

@AP-Hunt
Copy link
Copy Markdown
Contributor Author

AP-Hunt commented Apr 9, 2025

I dunno, I'll have a look into it!

AP-Hunt added 2 commits April 9, 2025 11:02
Running the visualiser in Docker is useful for replicating how it behaves in production
@AP-Hunt
Copy link
Copy Markdown
Contributor Author

AP-Hunt commented Apr 9, 2025

I've addressed it with a little bit of JS to reformat the dates into local time. I couldn't see that HTTP requests send client timezone information with them, so it wasn't possible to do server side.

Comment thread support/pipeline-visualiser/views/group.erb Outdated
Comment thread support/pipeline-visualiser/views/layout.erb
Comment thread support/pipeline-visualiser/views/partials/time.erb Outdated
…is available

A progressive enhancement. Otherwise the user will see the times as server
times (Europe/London).
@AP-Hunt AP-Hunt force-pushed the visualiser_use_server_timezone branch from 0691b20 to 08f1d49 Compare April 9, 2025 12:20
Copy link
Copy Markdown
Contributor

@sarahseewhy sarahseewhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🚀

@sarahseewhy sarahseewhy merged commit c6aafbf into main Apr 14, 2025
5 checks passed
@sarahseewhy sarahseewhy deleted the visualiser_use_server_timezone branch April 14, 2025 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants