Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (61 sloc) 3.1 KB
def gitProject = 'ralphnuessecpwr'
def gitBranch = 'master'
def gitTttRepo = 'FTSDEMO_RXN3_Unit_Tests'
def gitTttProject = 'CWXTSUBC_Unit_Tests'
def tttTargetFolder = 'tests' // Local folder in Jenkins workspace to contain the TTT assets
def tttRunnerJcl = 'Runner_PATH1.jcl' // TTT runner jcl to use
def tttScenario = 'CWXTSUBC_Mgmt_Scenario.testscenario' // TTT scenario to execute
def hciConnectionId = XXXXXXXX // HCI Connection as defined in Manage Jenkins, Tool Configuration
def hostCredentialsId = XXXXXXXX // Jenkins crendentials for host userid and password
node
{
/* Retrieving TTT assets from GitHub */
/* Only retrieve one TTT project, not the whole repository (using sparseCheckoutPaths) */
/* Place the TTT project(s) into a specific folder (“tests”) (using relativeTargetDir) */
stage("Get TTT from GitHub")
{
checkout(
changelog: false,
poll: false,
scm: [$class: 'GitSCM',
branches: [[name: "*/${gitBranch}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SparseCheckoutPaths',
sparseCheckoutPaths: [[path: "${gitTttProject}"]]],
[$class: 'RelativeTargetDirectory',
relativeTargetDir: "${tttTargetFolder}"]],
submoduleCfg: [],
userRemoteConfigs: [[url: "https://github.com/${gitProject}/${gitTttRepo}"]]]
)
}
/* Execute the TTT scenario(s) */
stage("Run Tests")
{
step([$class: 'TotalTestBuilder',
ccRepo: '',
ccSystem: '',
ccTestId: '',
connectionId: "${hciConnectionId}",
credentialsId: "${hostCredentialsId}",
hlq: '',
jcl: "${tttRunnerJcl}",
projectFolder: "${tttTargetFolder}/${gitTttProject}",
testSuite: "${tttScenario}"])
}
/* Push any changes during execution, i.e. Output generated by TTT back to GitHub */
/* Requires any .gitignore files to exclude the “Output” folder */
stage("Push TTT Results to GitHub")
{
def message = '"Jenkins Build ' + BUILD_NUMBER + '"'
/**********************************************************************************************/
/* The Credentials Binding Plugin can be used to avoid using user id and password in the code */
def gitUser = XXXXXXXX // Use a valid GitHub user id
def gitPassword = XXXXXXXX // Use passward for that user id
/**********************************************************************************************/
dir("tests")
{
bat(returnStdout: true, script: 'git commit -a -m ' + message)
bat(returnStdout: true, script: "git push https://${gitUser}:${gitPassword}@github.com/${gitProject}/${gitTttRepo} HEAD:${gitBranch} -f")
}
}
}
You can’t perform that action at this time.