Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Fix triggered jobs duration #730

Merged
merged 1 commit into from
May 16, 2021
Merged

Conversation

tommyknows
Copy link
Contributor

Description

This commit fixes a bug where a glab ci status would panic if there is
a job within that CI pipeline that is not triggered yet. In such a case,
the StartedAt field is not populated, which triggered a panic.

To fix this, we use time.Now() if StartedAt is nil, which means that
the job will be displayed with a duration of 0.

Related Issue

Resolves #727

How Has This Been Tested?

Locally to a private gitlab instance which has triggered jobs.

Screenshots (if appropriate):

(failed) • 03m 47s      test            test
(success) • 01m 00s     test            my
(success) • 09m 37s     test            super
(success) • 00m 23s     test            jobs
(manual) • not started  test            triggered

https://privateinstance.com/myproject/-/pipelines/1
SHA: ...
Pipeline State: failed

? Choose an action:  [Use arrows to move, type to filter]
  View Logs
  Retry
> Exit

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)

This commit fixes a bug where a `glab ci status` would panic if there is
a job within that CI pipeline that is not triggered yet. In such a case,
the StartedAt field is not populated, which triggered a panic.

To fix this, we use `time.Now()` if `StartedAt` is nil, which means that
the job will be displayed with a duration of 0.

Fixes profclems#727
Copy link
Owner

@profclems profclems left a comment

Choose a reason for hiding this comment

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

Thanks a lot @tommyknows...
This makes a lot of sense

@profclems profclems merged commit 6f6bae4 into profclems:trunk May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

glab ci status failing (glab version 1.17.0)
2 participants