We have a build and deploy process for every artifact(it is not a maven
build, and not a maven arifact). If build or deploy for a single artifact
fails it should not stop the whole process.
We have a separate jobs for build and deploy. Build jobs can work in
parallel on a slaves, deploy not.
The results of a build job should be used by deploy job. I need somehow to
get a workspace location of a build and set it as a parameter of a deploy
job, that deploy job can use ear files from build job and deploy them on a
server.
The place where I need to put a workspace is marked with a question mark.
def branches = [:]
def artifactsToDeploy = []
node{
workspace = pwd()
echo "Workspace:${workspace}"
//read artifact names from file
def appFile=readFile(workspace+"@script/artifacts.txt")
def artifactNames = appFile.tokenize()
//prepare parallel jobs
for (int i=0 ; i < artifactNames.size ; i++) {
def artifactName=artifactNames[i]
branches[artifactName]={
//start build job
def buildResult = build job: 'build-artifact', parameters:
[[$class: 'StringParameterValue', name: 'ARTIFACT', value:artifactName],
[$class: 'StringParameterValue', name: 'SVN_TAG', value:SVN_TAG]]
//need to read workspace from a build job, that was running on a
slave
artifactsToDeploy[artifactsToDeploy.size]=[artifact:artifactName,workspace:?????]
}
}
echo 'pipeline begin'
stage('build'){
parallel branches
}
stage('deploy'){
//read artifacts from a list and deploy
for (int i=0;i<artifactsToDeploy.size;i++) {
def buildResult = build job: 'deploy-artifact', parameters:
[[$class: 'StringParameterValue', name: 'ARTIFACT',
value:artifactsToDeploy[i].artifact],
[$class: 'StringParameterValue', name: 'WORKSPACE',
value:artifactsToDeploy[i].workspace]]
}
}
echo 'pipeline end'
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/71996b15-cac9-4de2-a812-70b26e642e7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.