[英]Building SVN trunk, branches, and tags, in Jenkins?
我正在嘗試在 Jenkins 中創建一個工作,這將允許我構建一個存儲在 Subversion 中的項目,但會詢問我要構建哪個標簽、分支或主干。
我嘗試將其設為參數化構建,添加“List Subversion tags”參數,但這會創建一個僅包含 /branches、/tags 和 /trunk 的下拉列表。 它沒有列出各個分支或標簽。
我原以為使用Subversion Release Manager可以解決這個問題,但它沒有提供關於如何使用它的有意義的文檔,到目前為止我所有使用它的嘗試都導致它沒有要求我提供一個分支,而是繼續結帳整棵樹 - 樹干和每個分支和標簽。
Jenkins Issue 10678應該提供了這個,但那是在 2011 年,如果它仍然可以工作,我就無法讓它為我工作。
有誰知道如何做到這一點?
您可以將變量用於存儲庫位置,因此 jenkins 中的存儲庫 URL 看起來類似於http://myhost.com/MY_REPO/${some_branch}
,其中 some_branch 是您的參數。 此參數可以設置為您可以手動輸入的字符串參數,或者您可以使用動態選擇參數並讓它使用存儲庫中的信息自動填充下拉菜單( https://wiki.jenkins-ci.org/display /JENKINS/Jenkins+動態+參數+插件)。 例子:
動態選擇參數:'some_branch'
// Choices Script (groovy)
def dirs = ['trunk/'] // defaults to trunk
def command = ['svn', 'ls', 'http://myhost.com/MY_REPO/tags']
def proc = command.execute()
proc.in.eachLine { dirs.add('tags/' + it) }
command = ['svn', 'ls', 'http://myhost.com/MY_REPO/branches']
proc = command.execute()
proc.in.eachLine { dirs.add('branches/' + it) }
dirs
聲明式或腳本式管道? 我在我的腳本管道中使用 ListSubversionTagsParameterDefinition 插件 + 以下內容祝我好運...
parameters([
[$class: 'ListSubversionTagsParameterDefinition',
name: 'SVN_TAG_TO_BUILD',
tagsDir: 'https://server/svn/repo/tags',
credentialsId: 'jenkins',
maxTags: '50',
reverseByDate: true,
reverseByName: false],
string(
defaultValue: 'Running release build',
description: 'Comments to leave when creating the release build tag',
name: 'SVN_COMMENTS'
)
])
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.