简体   繁体   中英

When to run git tag in GitHub and Jenkins?

I want to build Deploy Jenkins pipeline with Github.

This is my deploy flow:

  • Clone the repo
  • Run npm i
  • Run npm build -- --prod
  • Run docker build (from the dist - the framework isn't matter)
  • Push the docker image to aws repo.
  • Run aws ecs update-service to update the service on the cluster (aws shutdown the container and creates a new one).

How to handle git tag ? when to run this command? after the clone step? or in my local computer and GitHub will trigger the Jenkins pipeline when tag hook happens?

The answer to this can merely be an opinion since there is no right or wrong.

In some cases you want to tag only if everything was completed (deployed) successfully. In other cases you want to tag every try (Jenkins build).

The actual question you have to answer is (and @jonrsharpe already mentioned this in a comment): What is the purpose of a tag in your project? What do you do with those tags ?

In my iOS projects I usually just create a tag when a new build was actually deployed. If the Jenkins job failed before that I don't bother tagging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM