Skip to content

Commit

Permalink
aws-test: Drop need for parameters, just use latest/
Browse files Browse the repository at this point in the history
Get rid of the need to pass parameters to the `aws-test` job in
preparations for turning on `keepUndefinedParameters=true` in the
Jenkins instance.

We only every run the `aws-test` job from the `cloud` job, so we know at
that point that the latest output is in `latest/`. We can just resolve
that back to a specific versioned dir before proceeding.

This normalizes the `aws-test` job to take the exact same parameters as
the others, and makes it easy to e.g. run the job manually like the
others.
  • Loading branch information
jlebon committed Sep 26, 2018
1 parent 14f6af4 commit 4901a51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 12 additions & 1 deletion Jenkinsfile.aws-test
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,23 @@ node(NODE) {
return
}

// 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 dirpath, version
try {
utils.inside_assembler_container("-v /srv:/srv") {
stage("Sync In") {
withCredentials([
string(credentialsId: params.ARTIFACT_SERVER, variable: 'ARTIFACT_SERVER'),
sshUserPrivateKey(credentialsId: params.ARTIFACT_SSH_CREDS_ID, keyFileVariable: 'KEY_FILE'),
]) {
dirpath = "${images}/cloud/latest"
sh "mkdir -p ${dirpath}"
utils.rsync_file_in(ARTIFACT_SERVER, KEY_FILE, "${dirpath}/meta.json")
version = utils.sh_capture("jq -r '.[\"ostree-version\"]' ${dirpath}/meta.json")
# resolve to original dir to avoid races in the next rsync in
def imgv = utils.sh_capture("jq -r '.[\"image-version\"]' ${dirpath}/meta.json")
dirpath = "${images}/cloud/${imgv}"
sh "mkdir -p ${dirpath}"
utils.rsync_file_in(ARTIFACT_SERVER, KEY_FILE, "${dirpath}/aws-${AWS_REGION}.json")
}
Expand All @@ -44,10 +54,11 @@ node(NODE) {
string(credentialsId: params.AWS_CI_ACCOUNT, variable: 'AWS_CI_ACCOUNT'),
string(credentialsId: params.S3_PUBLIC_BUCKET, variable: 'S3_PUBLIC_BUCKET'),
]) {
def ami_intermediate = utils.sh_capture("jq -r .HVM ${dirpath}/aws-${AWS_REGION}.json")
currentBuild.description = "version=${version} ami=${ami_intermediate}"
sh """
# Do testing with intermediate aws image passed in by cloud job
if ! kola -b rhcos -p aws --aws-type ${aws_type} --tapfile rhcos-aws.tap --aws-ami ${ami_intermediate} --aws-region ${AWS_REGION} -j ${NUM_VMS} run; then
if ! kola -b rhcos -p aws --aws-type t2.small --tapfile rhcos-aws.tap --aws-ami ${ami_intermediate} --aws-region ${AWS_REGION} -j ${NUM_VMS} run; then
exit 1
fi

Expand Down
8 changes: 1 addition & 7 deletions Jenkinsfile.cloud
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,7 @@ node(NODE) {
parallel par_stages; par_stages = [:]

// Build the job responsible for testing and publishing the ami
def ami_intermediate = utils.sh_capture("jq -r .HVM ${dirpath}/aws-${AWS_REGION}.json")
build job: 'coreos-rhcos-aws-test', wait: false, parameters: [
string(name: 'ami_intermediate', value: "${ami_intermediate}"),
string(name: 'version', value: "${version}"),
string(name: 'dirpath', value: "${dirpath}"),
string(name: 'aws_type', value: "t2.small")
]
build job: 'coreos-rhcos-aws-test', wait: false
}
} catch (Throwable e) {
currentBuild.result = 'FAILURE'
Expand Down

0 comments on commit 4901a51

Please sign in to comment.