diff options
author | Matt Rendina <mrendina@stsci.edu> | 2017-08-03 11:49:40 -0400 |
---|---|---|
committer | Matt Rendina <mrendina@stsci.edu> | 2017-08-03 11:49:40 -0400 |
commit | 33f49bedd2c9087a7ec2f7204f5baf6c280bbdc7 (patch) | |
tree | 57d63970e8b2aabba579dcc4c45d43119cffea04 /jenkins | |
parent | 187fe2e8627fbdcebe585b5c3b07f3b9480e3287 (diff) | |
download | build_control-33f49bedd2c9087a7ec2f7204f5baf6c280bbdc7.tar.gz |
Lockfile testing
Diffstat (limited to 'jenkins')
-rw-r--r-- | jenkins/dispatch.groovy | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/jenkins/dispatch.groovy b/jenkins/dispatch.groovy index 03cdad6..c2c1c95 100644 --- a/jenkins/dispatch.groovy +++ b/jenkins/dispatch.groovy @@ -238,17 +238,31 @@ node(LABEL) { } stage ("Publication") { - //sh(script: "rsync -avzr ${this.conda_build_output_dir}/*.tar.bz2 ${PUBLICATION_PATH}") + // Copy packages built during this session to the publication path. + sh(script: "rsync -avzr ${this.conda_build_output_dir}/*.tar.bz2 ${PUBLICATION_PATH}") // Use a lock file to prevent two dispatch jobs that finish at the same // time from trampling each other's indexing process. - def lockfile = "${PUBLICATION_PATH}/${this.CONDA_PLATFORM}/LOCK-Jenkins" + def lockfile = "${this.conda_build_output_dir}/LOCK-Jenkins" def file = new File(lockfile) - if ( !file.exists() ) { + def tries_remaining = 5 + if ( file.exists() ) { + println("Lockfile already exists, waiting for it to be released...") + while ( tries_remaining > 0) { + println("Waiting 3s for lockfile release...") + sleep(3000) + if ( !file.exists() ) { + break + } + tries_remaining-- + } + } + if ( tries_remaining != 0 ) { sh(script: "touch ${lockfile}") + dir(this.conda_build_output_dir) { + sh(script: "conda index") + } + sh(script: "rm -f ${lockfile}") } - //dir(this.conda_build_output_dir) { - // sh(script: "conda index") - //} } } |