Is it possible for Jenkins to automatically detect and build newly created tags in a git repo?

前端 未结 5 1255
情深已故
情深已故 2020-12-07 12:59

It would be nice for our Jenkins CI server to automatically detect, deploy and build tags as they are created in our Github repository.

Is this possible?

5条回答
  •  青春惊慌失措
    2020-12-07 13:15

    With the following configuration, you can make a job build all tags:

    1. Make the job fetch tags as if they were branches: Click on the Advanced button below the repository URL and enter the Refspec +refs/tags/*:refs/remotes/origin/tags/*
    2. Have it build all tag "branches" with the Branch Specifier */tags/*
    3. Enable SCM polling, so that the job detects new tags.

    This approach has one drawback: The job will build all tags and not just newly added tags. So after you have created the job, it will be triggered once for every existing tag. So you probably want to have the job do nothing at first, then wait until all existing tags have been processed, and only then configure the build steps you want to be done for every new tag.

    Since tags don't change in git, the job will then only be triggered once for every new tag.

提交回复
热议问题