Pipeline duration is always 00:00 in Slack notifications

Summary

Build pipeline duration is always 00:00 in Slack notifications

Steps to reproduce

I am using Jenkins for the build and updateGitlabCommitStatus from the gitlab jenkins plugin to notify GitLab when the build starts and completes. The project has Slack notifications enabled for pipelines.

What is the current bug behavior?

When the build completes, the Slack notification says "Pipeline ... passed in 00:00". However, on the jobs tab of the CI/CD pipelines page on GitLab shows the correct duration.

What is the expected correct behavior?

The Slack notification contains the same duration that is displayed on the pipelines page.

Relevant logs and/or screenshots

This issue seems to be similar to gitlab-ce#22660. One of the comments on that issue asked the reporter to get the started_at, finished_at and pipeline.duration of a GenericCommitStatus. Here is the output for one of my recent pipeline jobs

irb(main):010:0> status.started_at # => ?
=> Wed, 31 Oct 2018 14:47:35 UTC +00:00
irb(main):011:0> status.finished_at # => ?
=> Wed, 31 Oct 2018 14:51:45 UTC +00:00
irb(main):012:0> status.pipeline.duration # => ?
=> 0

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Ubuntu 18.04 Current User: git Using RVM: no Ruby Version: 2.4.5p335 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.1 Go Version: unknown

GitLab information Version: 11.4.4 Revision: 2e8fd64ba68 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: XXX HTTP Clone URL: XXX SSH Clone URL: XXX Using LDAP: yes Using Omniauth: yes Omniauth Providers: azure_oauth2

GitLab Shell Version: 8.3.3 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Assignee Loading
Time tracking Loading