Skip outdated deployment jobs doesn't account for retried jobs
Summary
If a pipeline has two jobs that deploy to the same environment in different stages, retrying a failed deployment job in the initial stage will cause the next stage's deployment jobs to be considered older than the retried jobs. If "skip outdated deployment jobs" is enabled for the project this renders the secondary stage undeployable.
This was introduced by our recent change to the skip outdated deployment jobs feature and impacted one of our Premium customers (zd link, internal use).
Steps to reproduce
- Copy the following
.gitlab-ci.ymlinto a testing project. - Execute the pipeline.
- While the first deployment job is running, cancel the job.
- Re-run the failed job.
- After that jobs completes successfully, the next deployment job will be considered out of date and undeployable.
Example `.gitlab-ci.yml`
stages:
- deploy1
- deploy2
deploy1:
script:
- sleep 30s
environment:
name: example-env
stage: deploy1
when: manual
deploy2:
script:
- echo ""
environment:
name: example-env
stage: deploy2
when: manual
What is the current bug behavior?
Jobs that deploy to the same environment in later stages are unable to do so if jobs in a previous stage that deploy to the same environment have been retried.
What is the expected correct behavior?
Jobs that deploy to the same environment in later stages are permitted to deploy even if jobs in a previous stage that deploy to the same environment have been retried.