Skip to content

Commit

Permalink
fix: release pipeline checkout by tag not branch need special handle …
Browse files Browse the repository at this point in the history
…in jenkins git plugin (#562)
  • Loading branch information
zdtsw authored Jan 5, 2023
1 parent fbd107b commit c1b177f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pipelines/build/common/config_regeneration.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,11 @@ class Regeneration implements Serializable {
params.put('PR_BUILDER', true)
}

// Makre sure the dsl knows if we are building for release job which checkout by a tag not branch
if (jobType == "release") {
params.put('CHECKOUT_AS_TAG', true) // in dsl, we convert GIT_BRANCH to a tag then checkout
}

// Execute job dsl, using adopt's template if the user doesn't have one
def create = null
try {
Expand Down
4 changes: 4 additions & 0 deletions pipelines/build/common/create_job_from_template.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if (!binding.hasVariable('GIT_BRANCH')) {
GIT_BRANCH = 'master'
}

if (binding.hasVariable('CHECKOUT_AS_TAG')) {
GIT_BRANCH = "refs/tags/"+GIT_BRANCH
}

isLightweight = true
if (binding.hasVariable('PR_BUILDER')) {
isLightweight = false
Expand Down

0 comments on commit c1b177f

Please sign in to comment.