Do not allow to retry the pipeline after it has run successfully

Do not allow to rerun the pipeline after it has run successfully

Describe your question in as much detail as possible:

  • What are you seeing, and how does that differ from what you expect to see?
    Normally, we can retry a pipeline to re-run pipeline. But in my case, I want to block the pipeline that mean don’t allow to retry the pipeline after it has finished successfully.

  • Consider including screenshots, error messages, and/or other helpful visuals


    As you can see in the above picture I can retry to run the pipeline again. Actually, the expected behavior that want is don’t allow to retry the pipeline after it has finished successfully.

  • What version are you on? Are you using self-managed or GitLab.com?

    • GitLab (Hint: /help): 15.0 (plan: premium/self managed)
    • Runner (Hint: /admin/runners): 14.9.1
  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)

release:alpha:
  image: debian:10-slim
  stage: alpha
  variables:
    NOMAD_VAR_datacenters: '["alpha"]'
    NOMAD_VAR_dns_servers: '["xxx"]'
    NOMAD_VAR_hostname: 'xxx'
    NOMAD_ADDR: "https://xxx:4646"
    NOMAD_TOKEN: $ALPHA_NOMAD_TOKEN
    NOMAD_VAR_docker_image: $CI_REGISTRY_IMAGE:$RELEASE_VERSION
    NOMAD_VAR_consul_kv_read_token: $ALPHA_CONSUL_TOKEN
    NOMAD_VAR_vault_kv_read_token: $ALPHA_VAULT_TOKEN
    NOMAD_FILE_NAME: "${CI_PROJECT_NAME}.nomad"
  script:
    - apt update
    - apt install curl unzip -y
    - curl --silent --remote-name https://releases.hashicorp.com/nomad/1.1.0/nomad_1.1.0_linux_amd64.zip
    - unzip nomad_1.1.0_linux_amd64.zip
    - ./nomad status -tls-skip-verify
    - echo "Release $RELEASE_VERSION to ALPHA"
    - echo "Nomad file name is $NOMAD_FILE_NAME"
    - |
      IFS=' ' read -ra FILES <<< "$NOMAD_FILE_NAME"
      for nomadFile in "${FILES[@]}"; do
        ./nomad job run -detach -tls-skip-verify $nomadFile
      done
  tags:
    - aws-hexsafe-alpha
  rules:
    - if: $CI_COMMIT_TAG != "" && $RUN_RELEASE_ALPHA == "true"
  when: manual

I understand that I might not be explaining perfectly, so feel free to ask any questions. If there is already a way to do it with consul alone or any solutions, please let me know
**

Many thanks,
Ryan