1

I want to (git) tag a state of the branch with successfully finishing a CI/CD pipleine

E.g.

  • compile
  • test
  • package
  • deploy

if all this stages worked well, I would like to have a tag

/branchName/stableDeploy/

How can this be done with gitlab-CE?

Of course I could do the opposite, means first tag and afterwards build, but on many commits, I would like to be able to cherry-pick only that tags, which successfully processed the pipeline.

cilap
  • 2,215
  • 1
  • 25
  • 51

1 Answers1

0

Maybe with after_script:

deploy:
  ...
  after_script:
    - >
      if [ $CI_JOB_STATUS == 'success' ]; then
        create your tag
      else
        what to do on failure
      fi
Vi.
  • 940
  • 6
  • 24
  • thank you... "create your tag" do you have working commands for the local git repo? – cilap Oct 21 '22 at 14:33
  • I don't know, maybe ` - tag=${CI_COMMIT_SHORT_SHA}-mytag - git tag $tag - git push origin $tag` – Vi. Oct 21 '22 at 15:36