Skip to content

Commit

Permalink
jenkins: Redirect pkg diff to pkg_diff.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahuls0720 committed Aug 15, 2018
1 parent 80f0b4c commit d229700
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions Jenkinsfile.treecompose
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ def OSCONTAINER_IMG = API_CI_REGISTRY + "/rhcos/os-maipo:latest"

// We write to this one for now
def artifact_repo = "/srv/rhcos/output/repo"
// We write pkg_diff.txt here
def images = "/srv/rhcos/output/images"

node(NODE) {
def manifest = "host.yaml"
Expand Down Expand Up @@ -92,7 +94,11 @@ node(NODE) {
version = utils.get_rev_version("${repo}", commit)
currentBuild.description = "🆕 ${version} (commit ${commit})";
if (previous_commit.length() > 0) {
sh "rpm-ostree --repo=${repo} db diff ${previous_commit} ${commit}"
sh "mkdir -p ${images}"
utils.rsync_dir_in(ARTIFACT_SERVER, KEY_FILE, images)
sh "rpm-ostree --repo=${repo} db diff ${previous_commit} ${commit} > ${WORKSPACE}/pkg_diff.txt"
archiveArtifacts artifacts: "pkg_diff.txt", allowEmptyArchive: true
sh "cp ${WORKSPACE}/pkg_diff.txt ${images}/pkg_diff.txt"
}
sh "ostree --repo=${repo} prune --refs-only --depth=0"
sh "ostree summary --repo=${repo} --update"
Expand Down Expand Up @@ -134,16 +140,20 @@ node(NODE) {
}

stage("rsync out") {
withCredentials([
string(credentialsId: params.ARTIFACT_SERVER, variable: 'ARTIFACT_SERVER'),
sshUserPrivateKey(credentialsId: params.ARTIFACT_SSH_CREDS_ID, keyFileVariable: 'KEY_FILE'),
]) {
sh """
/usr/app/ostree-releng-scripts/rsync-repos \
--dest ${ARTIFACT_SERVER}:${artifact_repo} --src=${repo}/ \
--rsync-opt=--stats --rsync-opt=-e \
--rsync-opt='ssh -i ${KEY_FILE} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
""" } }
withCredentials([
string(credentialsId: params.ARTIFACT_SERVER, variable: 'ARTIFACT_SERVER'),
sshUserPrivateKey(credentialsId: params.ARTIFACT_SSH_CREDS_ID, keyFileVariable: 'KEY_FILE'),
]) {
sh """
/usr/app/ostree-releng-scripts/rsync-repos \
--dest ${ARTIFACT_SERVER}:${artifact_repo} --src=${repo}/ \
--rsync-opt=--stats --rsync-opt=-e \
--rsync-opt='ssh -i ${KEY_FILE} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
"""
if (previous_commit.length() > 0) {
utils.rsync_dir_out(ARTIFACT_SERVER, KEY_FILE, images)
} }
}

stage("Cleanup") { sh """
rm ${treecompose_workdir} -rf
Expand Down

0 comments on commit d229700

Please sign in to comment.