New gitlab-ci predefined variable for job start time
Problem to solve
We need a reliable UTC and ISO-8601 compliant date/timestamp indicating the start of a CI job.
Further details
Hopefully there are other use-cases. What prompted me to go looking and, ultimately, to propose this feature was trying to apply standard Docker image labels, specifically: org.opencontainers.image.created ("date and time on which the image was built").
For the time being, I'm making a date call in my before_script:
before_script:
- export CI_JOB_TIMESTAMP=$(date --utc --iso-8601=seconds)
But, wait, these exact parameters for date are valid on my machine, but not on the gitlab.com shared runners! I had to use a different form.
before_script:
- export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
OK, now, what happens when I also have Windows runners? Gah! That's why a nice timestamp from the runner would be lovely
Proposal
What does success look like, and how can we measure that?
A new "predefined" environment variable. My suggestions are...
CI_JOB_TIMESTAMP- or
CI_JOB_STARTED