Gitlab CI/CD and retries

Problem to solve

Hi Guys,
I have a CI/CD build job that can fail and I added the retry option. The issue is when the job fails and retries the build, the next job goes on first (deploy) then the build stage.

Configuration

use the flowing code:

build_custom_images:
  environment:
    name: staging
  stage: build
  retry: 2
  ****
  tags:
    - template
  needs: []
  timeout: 5h

deploy_images:
  environment:
    name: staging
  stage: deploy
  ****
  needs:
    - job: build_custom_images
      optional: true
  timeout: 10h

In the picture, I was forced to cancel the deployment myself and after the retry job for the build was done, retry the deployment myself

Versions

Please select whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Self-hosted Runners

Versions