Skip to content

Commit

Permalink
aws-test: use readJSON to extract values from JSON files
Browse files Browse the repository at this point in the history
  • Loading branch information
miabbott committed Sep 28, 2018
1 parent ede4d52 commit e4f784a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Jenkinsfile.aws-test
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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([
Expand All @@ -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(':')
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit e4f784a

Please sign in to comment.