Search code examples
gitlab-ci

Determine when a gitlab CI job ran


I have a CI job that ran last week:

CI Job Summary stats

Is there a way to find out exactly when it finished? I am trying to debug a problem that we just noticed, and knowing if the job finished at 9:00am or 9:06am or 6:23pm a week ago would be useful information.

The output from the job does not appear to indicate what time it started or stopped. When I asked Google, I got information about how to run jobs in serial or parallel or create CI jobs, but nothing about getting the time of the job.

For the future, I could put date into script or before_script, but that is not going to help with this job.

This is on a self-hosted gitlab instance. I am not sure of the version or what optional settings have been enabled.


Solution

  • You can get this data only by gitlab api using this request:

    curl https://gitlab.example.com/api/v4/projects/<project_id>/jobs/<the_job_id>

    The job id you can get by this thread answer

    In the job schema you get: "created_at", "started_at", "finished_at"