@@ -86,32 +86,42 @@ class MROPipelineUtil extends PipelineUtil {
8686 }
8787
8888 private void executeODSComponent (Map repo , String baseDir ) {
89- this . steps. dir(baseDir) {
90- if (repo. data. openshift. resurrectedBuild) {
91- logger. info(" Repository '${ repo.id} ' is in sync with OpenShift, no need to rebuild" )
92- return
93- }
94-
95- def job
96- List<String > mainEnv = this . project. getMainReleaseManagerEnv()
97- mainEnv << " NOTIFY_BB_BUILD=${ !project.isWorkInProgress} "
98- this . steps. withEnv (mainEnv) {
99- job = this . loadGroovySourceFile(" ${ baseDir} /Jenkinsfile" )
100- }
101- // Collect ODS build artifacts for repo.
102- // We get a map with at least two keys ("build" and "deployments").
103- def buildArtifacts = job. getBuildArtifactURIs()
104- buildArtifacts. each { k , v ->
105- if (k != ' failedStage' ) {
106- repo. data. openshift[k] = v
89+ // force this to happen on master - if an agent is needed, the closure has to
90+ // take care about it. The reason for this is the closure to have access to files
91+ // from the component, e.g. jenkinsfile, shell scripts,...
92+ this . steps. node {
93+ // when a node switch happens, jenkins creates a new dir workspace@xxx
94+ // so we need to copy.
95+ def currentNodeBaseDir = " ${ this.steps.env.WORKSPACE} /${ REPOS_BASE_DIR} /${ repo.id} "
96+ this . steps. sh " cp -rf ${ baseDir} ${ currentNodeBaseDir} | true"
97+ this . steps. dir(baseDir) {
98+
99+ if (repo. data. openshift. resurrectedBuild) {
100+ logger. info(" Repository '${ repo.id} ' is in sync with OpenShift, no need to rebuild" )
101+ return
107102 }
108- }
109- def versionAndBuild = " ${ this.project.buildParams.version} /${ this.steps.env.BUILD_NUMBER} "
110- repo. data. openshift[DeploymentDescriptor . CREATED_BY_BUILD_STR ] = versionAndBuild
111- this . logger. debug(" Collected ODS build artifacts for repo '${ repo.id} ': ${ repo.data.openshift} " )
112103
113- if (buildArtifacts. failedStage) {
114- throw new RuntimeException (" Error: aborting due to previous errors in repo '${ repo.id} '." )
104+ def job
105+ List<String > mainEnv = this . project. getMainReleaseManagerEnv()
106+ mainEnv << " NOTIFY_BB_BUILD=${ !project.isWorkInProgress} "
107+ this . steps. withEnv (mainEnv) {
108+ job = this . loadGroovySourceFile(" ${ baseDir} /Jenkinsfile" )
109+ }
110+ // Collect ODS build artifacts for repo.
111+ // We get a map with at least two keys ("build" and "deployments").
112+ def buildArtifacts = job. getBuildArtifactURIs()
113+ buildArtifacts. each { k , v ->
114+ if (k != ' failedStage' ) {
115+ repo. data. openshift[k] = v
116+ }
117+ }
118+ def versionAndBuild = " ${ this.project.buildParams.version} /${ this.steps.env.BUILD_NUMBER} "
119+ repo. data. openshift[DeploymentDescriptor . CREATED_BY_BUILD_STR ] = versionAndBuild
120+ this . logger. debug(" Collected ODS build artifacts for repo '${ repo.id} ': ${ repo.data.openshift} " )
121+
122+ if (buildArtifacts. failedStage) {
123+ throw new RuntimeException (" Error: aborting due to previous errors in repo '${ repo.id} '." )
124+ }
115125 }
116126 }
117127 }
0 commit comments