使用 groovy 从 Active Choices Parameters 插件连接到 SVN
Connect to SVN from Active Choices Parameters plug-in using groovy
在 Active Choices Parameters 中,我使用 groovy 脚本从特定路径读取 jar 文件,并使用这些 jar 文件填充下拉菜单:
Jar=[]
path = "/home/users/jars/"
new File(path).eachFileMatch(~/.*.jar/) {
Jar.add(it.getName())
}
return Jar.sort()
我不知道是否可以使用 groovy,使用 "read" 的用户名和密码连接到 SVN,并在下拉列表中显示来自 SVN 特定目录的所有 jar?!
谢谢!
经过一些 google 搜索后,我发现此方法稍作调整 bit.This 显示来自特定 SVN 位置的目录。
def user = hudson.model.User.current();
def a = jenkins.model.Jenkins.getAuthentication()
def userId = user.getId()
def pass =a.getCredentials()
def svnurl = 'yourSvnUrl'
def dirs = []
def command = ['svn', 'list', svnurl , '--username' , 'yourSvnUser' , '--password' , 'YourSvnPassword' ]
def proc = command.execute()
print command
proc.in.eachLine {dirs.add(it) }
return dirs
在 Active Choices Parameters 中,我使用 groovy 脚本从特定路径读取 jar 文件,并使用这些 jar 文件填充下拉菜单:
Jar=[]
path = "/home/users/jars/"
new File(path).eachFileMatch(~/.*.jar/) {
Jar.add(it.getName())
}
return Jar.sort()
我不知道是否可以使用 groovy,使用 "read" 的用户名和密码连接到 SVN,并在下拉列表中显示来自 SVN 特定目录的所有 jar?! 谢谢!
经过一些 google 搜索后,我发现此方法稍作调整 bit.This 显示来自特定 SVN 位置的目录。
def user = hudson.model.User.current();
def a = jenkins.model.Jenkins.getAuthentication()
def userId = user.getId()
def pass =a.getCredentials()
def svnurl = 'yourSvnUrl'
def dirs = []
def command = ['svn', 'list', svnurl , '--username' , 'yourSvnUser' , '--password' , 'YourSvnPassword' ]
def proc = command.execute()
print command
proc.in.eachLine {dirs.add(it) }
return dirs