2016-12-27 61 views
0

我想查看Jenkins儀表板中版本控制中存在的所有分支。如果任何分支被推送,它也應該在詹金斯中複製。我如何得到它? 我需要使用任何插件嗎?這在Bamboo中是可行的。我試圖通過Jenkins管理我的版本控制。查看Jenkins中儲存庫的分支

+0

您正在使用哪種VCS?你想用詹金斯建立一個特定的分支。請詳細說明你的問題。 –

+0

使用git,使用多分支管道 – Rik

回答

0

存儲庫中的分支可以在jenkins中反映出來,但是您需要具體指明您嘗試運行的級別。 要麼你想用新的分支名稱工作,要麼你只是一個下拉菜單來列出分支。

def ant = new AntBuilder() 
ant.exec(
outputproperty:"text", 
     errorproperty: "error", 
     resultproperty: "exitValue", 
failonerror: false, 
executable: 'svn') 
{ 
arg(line:"""list  https://REPOSITORY/branches/""") 
} 
def result = new Expando(
    text: ant.project.properties.text, 
    error: ant.project.properties.error, 
    exitValue: ant.project.properties.exitValue as Integer, 
    toString: {text} 
) 
if (result.exitValue != 0){ 
    throw new Exception("""command failed with ${result.exitValue} 
executed: ${commandLiteral} 
error: ${result.error} 
text: ${result.text}""") 
} 
print result 

運行在上述代碼本地主機:8080 /腳本或jenkinsurl /腳本
這將顯示分支的列表。 你可以在任何groovy接受的腳本控制檯中運行這段代碼。 請注意,jenkins inbuilt具有運行groovy腳本的功能。