Skip to content

Commit

Permalink
Merge pull request openshift#272 from cgwalters/cloud-change-detection
Browse files Browse the repository at this point in the history
jenkins/cloud: Fix change detection
  • Loading branch information
openshift-merge-robot authored Sep 4, 2018
2 parents 8d1d433 + 7717059 commit 4ee1fdd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Jenkinsfile.cloud
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ node(NODE) {
if (fileExists('force-nocache-build')) {
force_nocache = readFile('force-nocache-build').trim();
}
def previous_meta_path = "${images}/cloud/latest/meta.json";
if (fileExists(previous_meta_path)) {
last_build_meta = readJSON file: previous_meta_path;
def previous = "${images}/cloud/latest";
def previous_meta_path = "${previous}/meta.json";
// I tried with fileExists before, but that only operates on ${WORKSPACE}
if (sh(script: "stat ${previous_meta_path}>/dev/null", returnStatus: true) == 0) {
// readJSON only operates on the ${WORKSPACE} too
sh "cp --reflink=auto ${previous_meta_path} ${WORKSPACE}/previous-meta.json";
last_build_meta = readJSON file: "previous-meta.json";
echo "Previous build: ${last_build_meta}";
} else {
echo "No previous build.";
}
}

Expand Down

0 comments on commit 4ee1fdd

Please sign in to comment.