Refactor groovy calling test script using newer common script apis; Seperate scripts
This commit is contained in:
parent
a7f2de8b86
commit
fbd0c169d9
2 changed files with 64 additions and 66 deletions
|
|
@ -1,79 +1,18 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
class ToolOptions {
|
||||
def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo)
|
||||
|
||||
String m_toolName
|
||||
|
||||
String m_gitURL
|
||||
String m_revision
|
||||
String m_repoRoot
|
||||
int m_cloneDepth
|
||||
boolean m_shallowClone
|
||||
|
||||
ToolOptions(script) {
|
||||
m_script = script
|
||||
m_gitURL = '-'
|
||||
m_revision = '-'
|
||||
m_repoRoot = ''
|
||||
m_cloneDepth = 1
|
||||
m_shallowClone = true
|
||||
}
|
||||
|
||||
void toolName(String name) {
|
||||
m_toolName = name.trim()
|
||||
}
|
||||
|
||||
void toolRepo(String repo, String revision) {
|
||||
m_repo = repo.trim()
|
||||
m_revision = revision.trim()
|
||||
}
|
||||
|
||||
void repoRoot(String root) {
|
||||
m_repoRoot = root.trim()
|
||||
}
|
||||
|
||||
void clonedepth(int depth) {
|
||||
m_cloneDepth = depth
|
||||
}
|
||||
|
||||
void shallowclone(boolean shallow) {
|
||||
m_shallowClone = shallow
|
||||
}
|
||||
}
|
||||
|
||||
ToolOptions getNewToolOptions() {
|
||||
return new ToolOptions(this)
|
||||
}
|
||||
|
||||
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
|
||||
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
|
||||
}
|
||||
|
||||
def registerPipelineScriptConfiguration(meta) {
|
||||
def options = getNewToolOptions()
|
||||
|
||||
options.toolName('pipeline script');
|
||||
registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(autobuilder.getautobuildpath()))
|
||||
registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath()))
|
||||
}
|
||||
|
||||
def getTool(meta, ToolOptions options, String targetDir) {
|
||||
gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone)
|
||||
def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') {
|
||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
||||
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
|
||||
|
||||
registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir))
|
||||
}
|
||||
|
||||
def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = '', int cloneDepth = 1, boolean shallowClone = true, String filter = '') {
|
||||
echo "DEPRECATED method: gitCheckoutAndRegister(meta,, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, ...)"
|
||||
def options = getNewToolOptions()
|
||||
|
||||
options.toolName(tool);
|
||||
options.toolRepo(gitURL, revision)
|
||||
options.repoRoot(repoRoot)
|
||||
options.clonedepth(cloneDepth)
|
||||
options.shallowclone(shallowClone)
|
||||
|
||||
getTool(meta, options, targetDir)
|
||||
registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
|
||||
}
|
||||
|
||||
return this
|
||||
|
|
|
|||
59
configuration/tools.groovy
Normal file
59
configuration/tools.groovy
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
class ToolOptions {
|
||||
def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo)
|
||||
|
||||
String m_toolName
|
||||
|
||||
String m_gitURL
|
||||
String m_revision
|
||||
String m_repoRoot
|
||||
int m_cloneDepth
|
||||
boolean m_shallowClone
|
||||
|
||||
ToolOptions(script) {
|
||||
m_script = script
|
||||
m_gitURL = '-'
|
||||
m_revision = '-'
|
||||
m_repoRoot = ''
|
||||
m_cloneDepth = 1
|
||||
m_shallowClone = true
|
||||
}
|
||||
|
||||
void toolName(String name) {
|
||||
m_toolName = name.trim()
|
||||
}
|
||||
|
||||
void toolRepo(String repo, String revision) {
|
||||
m_repo = repo.trim()
|
||||
m_revision = revision.trim()
|
||||
}
|
||||
|
||||
void repoRoot(String root) {
|
||||
m_repoRoot = root.trim()
|
||||
}
|
||||
|
||||
void clonedepth(int depth) {
|
||||
m_cloneDepth = depth
|
||||
}
|
||||
|
||||
void shallowclone(boolean shallow) {
|
||||
m_shallowClone = shallow
|
||||
}
|
||||
}
|
||||
|
||||
ToolOptions getNewToolOptions() {
|
||||
return new ToolOptions(this)
|
||||
}
|
||||
|
||||
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
|
||||
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
|
||||
}
|
||||
|
||||
def getTool(meta, ToolOptions options, String targetDir) {
|
||||
gh.gitCheckoutAlt(options.m_gitURL, options.m_revision, targetDir, options.m_repoRoot, options.m_cloneDepth, options.m_shallowClone)
|
||||
|
||||
registerConfigurationInfo(meta, options.m_toolName, options.m_gitURL, options.m_revision, gh.getGitInfo(targetDir))
|
||||
}
|
||||
|
||||
return this
|
||||
Loading…
Add table
Add a link
Reference in a new issue