Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

feat: show build log timestamps in local time #241

Merged
merged 1 commit into from
Feb 12, 2021

Conversation

jawnsy
Copy link
Contributor

@jawnsy jawnsy commented Feb 12, 2021

The server-sent ISO8601 timestamps are not necessarily in the user's
preferred timezone. This change uses time.Local() to get the time in
the user's local time according to their system settings.

Success case, interactive terminal:

[coder@jawnsy-m coder-cli]$ coder envs watch-build jawnsy-m 
warning: version mismatch detected
  | Coder CLI version: unknown
  | Coder API version: 1.14.0+709-g75124e3d4-20210211
  | 
  | tip: download the appropriate version here: https://github.com/cdr/coder-cli/releases
✅ -- 2021-02-11T16:21:12-08:00 Your environment was queued for rebuilding
✅ -- 2021-02-11T16:21:16-08:00 Deleting old environment
✅ -- 2021-02-11T16:21:16-08:00 Deleting old network isolation policy
✅ -- 2021-02-11T16:21:16-08:00 Deleting old service
✅ -- 2021-02-11T16:21:16-08:00 Getting default user from image
✅ -- 2021-02-11T16:22:15-08:00 Ensuring environment has a home volume
✅ -- 2021-02-11T16:22:15-08:00 Creating network isolation policy
✅ -- 2021-02-11T16:22:15-08:00 Creating environment service
✅ -- 2021-02-11T16:22:15-08:00 Creating environment
✅ -- 2021-02-11T16:22:56-08:00 Initializing environment as container-based virtual machine
✅ -- 2021-02-11T16:22:56-08:00 Pulling image gcr.io/coder-dogfood/master/enterprise-dev
✅ -- 2021-02-11T16:25:29-08:00 Mounting volumes into environment
✅ -- 2021-02-11T16:25:29-08:00 Starting environment /sbin/init
✅ -- 2021-02-11T16:25:29-08:00 Creating container
✅ -- 2021-02-11T16:25:31-08:00 Starting environment
✅ -- 2021-02-11T16:25:31-08:00 Waiting for environment to become available
✅ -- 2021-02-11T16:25:33-08:00 Injecting secrets into environment
✅ -- 2021-02-11T16:25:33-08:00 Configuring Git
✅ -- 2021-02-11T16:25:33-08:00 Running /coder/configure
✅ -- 2021-02-11T16:25:36-08:00 Running ~/personalize

Success case, non-interactive terminal:

[coder@jawnsy-m coder-cli]$ coder envs watch-build jawnsy-m | cat
warning: version mismatch detected
  | Coder CLI version: unknown
  | Coder API version: 1.14.0+709-g75124e3d4-20210211
  | 
  | tip: download the appropriate version here: https://github.com/cdr/coder-cli/releases
2021-02-11T16:21:12-08:00 Your environment was queued for rebuilding
2021-02-11T16:21:16-08:00 Deleting old environment
2021-02-11T16:21:16-08:00 Deleting old network isolation policy
2021-02-11T16:21:16-08:00 Deleting old service
2021-02-11T16:21:16-08:00 Getting default user from image
2021-02-11T16:22:15-08:00 Ensuring environment has a home volume
2021-02-11T16:22:15-08:00 Creating network isolation policy
2021-02-11T16:22:15-08:00 Creating environment service
2021-02-11T16:22:15-08:00 Creating environment
2021-02-11T16:22:56-08:00 Initializing environment as container-based virtual machine
2021-02-11T16:22:56-08:00 Pulling image gcr.io/coder-dogfood/master/enterprise-dev
2021-02-11T16:25:29-08:00 Mounting volumes into environment
2021-02-11T16:25:29-08:00 Starting environment /sbin/init
2021-02-11T16:25:29-08:00 Creating container
2021-02-11T16:25:31-08:00 Starting environment
2021-02-11T16:25:31-08:00 Waiting for environment to become available
2021-02-11T16:25:33-08:00 Injecting secrets into environment
2021-02-11T16:25:33-08:00 Configuring Git
2021-02-11T16:25:33-08:00 Running /coder/configure
2021-02-11T16:25:36-08:00 Running ~/personalize
[coder@jawnsy-m coder-cli]$ TZ=America/Toronto coder envs watch-build jawnsy-m | cat
warning: version mismatch detected
  | Coder CLI version: unknown
  | Coder API version: 1.14.0+709-g75124e3d4-20210211
  | 
  | tip: download the appropriate version here: https://github.com/cdr/coder-cli/releases
2021-02-11T19:21:12-05:00 Your environment was queued for rebuilding
2021-02-11T19:21:16-05:00 Deleting old environment
2021-02-11T19:21:16-05:00 Deleting old network isolation policy
2021-02-11T19:21:16-05:00 Deleting old service
2021-02-11T19:21:16-05:00 Getting default user from image
2021-02-11T19:22:15-05:00 Ensuring environment has a home volume
2021-02-11T19:22:15-05:00 Creating network isolation policy
2021-02-11T19:22:15-05:00 Creating environment service
2021-02-11T19:22:15-05:00 Creating environment
2021-02-11T19:22:56-05:00 Initializing environment as container-based virtual machine
2021-02-11T19:22:56-05:00 Pulling image gcr.io/coder-dogfood/master/enterprise-dev
2021-02-11T19:25:29-05:00 Mounting volumes into environment
2021-02-11T19:25:29-05:00 Starting environment /sbin/init
2021-02-11T19:25:29-05:00 Creating container
2021-02-11T19:25:31-05:00 Starting environment
2021-02-11T19:25:31-05:00 Waiting for environment to become available
2021-02-11T19:25:33-05:00 Injecting secrets into environment
2021-02-11T19:25:33-05:00 Configuring Git
2021-02-11T19:25:33-05:00 Running /coder/configure
2021-02-11T19:25:36-05:00 Running ~/personalize

Error case, interactive terminal:

image

Error case, non-interactive terminal (piped command through cat):

image

The server-sent ISO8601 timestamps are not necessarily in the user's
preferred timezone. This change uses time.Local() to get the time in
the user's local time according to their system settings.
@jawnsy jawnsy requested review from tychoish and cmoog February 12, 2021 02:29
@jawnsy jawnsy self-assigned this Feb 12, 2021
@shortcut-integration
Copy link

This pull request has been linked to Clubhouse Story #8016: coder-cli build log should use local timezone.

Copy link
Contributor

@cmoog cmoog left a comment

Choose a reason for hiding this comment

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

Great improvement 👍

@jawnsy jawnsy merged commit 4eafe01 into master Feb 12, 2021
@jawnsy jawnsy deleted the jawnsy/ch8016/cli-local-timezone branch February 12, 2021 02:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants