Add job level variable that counts the number of retries

Based on the following comment It'd be neat if we can expose the number of retries, and/or expose the fact that this is a retry via some reserved CI_ variable. Examples:

  • CI_JOB_RETRY_ATTEMPT - type integer - increments with each retry, therefore this may be 0 for when a Job is first run.
  • CI_JOB_RETRY - type boolean - set to true only when a job is retried, therefore this would be false when a Job is first run.

These might be useful for people exploring this feature, or if building pipelines where SOME items are able to be retried and some cannot. This would mostly assist with the scripting being performed inside of the actual Job perhaps.

Assignee Loading
Time tracking Loading