From e4f784a5d405824b6149a34489ad3095c54d580d Mon Sep 17 00:00:00 2001 From: Micah Abbott Date: Fri, 28 Sep 2018 17:26:42 -0400 Subject: [PATCH] aws-test: use readJSON to extract values from JSON files --- Jenkinsfile.aws-test | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile.aws-test b/Jenkinsfile.aws-test index 32fe41e0..ea754864 100644 --- a/Jenkinsfile.aws-test +++ b/Jenkinsfile.aws-test @@ -26,7 +26,7 @@ node(NODE) { // We're only ever triggered by the cloud job, so we know the latest build is in latest/ // We immediately resolve it back to the specific images/ dir - def ostree_commit, version + def latest_meta, ostree_commit, version try { utils.inside_assembler_container("") { stage("Sync In") { @@ -35,16 +35,18 @@ node(NODE) { sshUserPrivateKey(credentialsId: params.ARTIFACT_SSH_CREDS_ID, keyFileVariable: 'KEY_FILE'), ]) { utils.rsync_file_in_dest(ARTIFACT_SERVER, KEY_FILE, "${images}/cloud/latest/meta.json", "${WORKSPACE}/meta.json") - ostree_commit = utils.sh_capture("jq -r '.[\"ostree-commit\"]' ${WORKSPACE}/meta.json") - version = utils.sh_capture("jq -r '.[\"ostree-version\"]' ${WORKSPACE}/meta.json") + latest_meta = readJSON file: "meta.json"; + ostree_commit = latest_meta["ostree-commit"]; + version = latest_meta["ostree-version"]; // resolve to original dir to avoid races in the next rsync in - def imgv = utils.sh_capture("jq -r '.[\"image-version\"]' ${WORKSPACE}/meta.json") + def imgv = latest_meta["image-version"] utils.rsync_file_in_dest(ARTIFACT_SERVER, KEY_FILE, "${images}/cloud/${imgv}/aws-${AWS_REGION}.json", "${WORKSPACE}/aws-${AWS_REGION}.json") } } // Number of parallel kola tests def NUM_VMS = "10" + def aws_json try { stage("Run Kola tests on intermediate aws image") { withCredentials([ @@ -54,7 +56,8 @@ node(NODE) { string(credentialsId: params.S3_PUBLIC_BUCKET, variable: 'S3_PUBLIC_BUCKET'), usernameColonPassword(credentialsId: params.REGISTRY_CREDENTIALS, variable: 'CREDS'), ]) { - def ami_intermediate = utils.sh_capture("jq -r .HVM ${WORKSPACE}/aws-${AWS_REGION}.json") + aws_json = readJSON file: "aws-${AWS_REGION}.json"; + def ami_intermediate = aws_json["HVM"]; // login to registry and setup container storage def (registryUser, registryPass) = "${CREDS}".split(':') @@ -95,6 +98,7 @@ node(NODE) { sh 'if test -e _kola_temp; then tar -cJf _kola_temp.tar.xz _kola_temp; fi' archiveArtifacts artifacts: "_kola_temp.tar.xz", allowEmptyArchive: true archiveArtifacts artifacts: "rhcos-aws.tap", allowEmptyArchive: true + archiveArtifacts artifacts: "*.json", allowEmptyArchive: true } stage("rsync out") {