简体   繁体   English

什么时候在 GitHub 和 Jenkins 中运行 git tag?

[英]When to run git tag in GitHub and Jenkins?

I want to build Deploy Jenkins pipeline with Github.我想用 Github 构建 Deploy Jenkins 管道。

This is my deploy flow:这是我的部署流程:

  • Clone the repo克隆回购
  • Run npm i运行npm i
  • Run npm build -- --prod运行npm build -- --prod
  • Run docker build (from the dist - the framework isn't matter)运行 docker build (来自 dist - 框架无关紧要)
  • Push the docker image to aws repo.将 docker 镜像推送到 aws 仓库。
  • Run aws ecs update-service to update the service on the cluster (aws shutdown the container and creates a new one).运行aws ecs update-service来更新集群上的服务(aws 关闭容器并创建一个新的)。

How to handle git tag ?如何处理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?或者在我的本地计算机和 GitHub 会在标签钩子发生时触发 Jenkins 管道?

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).在其他情况下,您希望标记每次尝试(Jenkins 构建)。

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?您必须回答的实际问题是(@jonrsharpe 已经在评论中提到了这一点):您的项目中tag的目的是什么? What do you do with those tags ?你用这些tags做什么?

In my iOS projects I usually just create a tag when a new build was actually deployed.在我的 iOS 项目中,我通常只在实际部署新构建时创建一个标签。 If the Jenkins job failed before that I don't bother tagging.如果 Jenkins 的工作在那之前失败了,我不会费心标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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