Skip to content

Commit

Permalink
treecompose: change tagging scheme for container image
Browse files Browse the repository at this point in the history
In an effort to get closer to what has been discussed in
#150, the tagging scheme has been changed so that the
latest container image out of the pipeline is tagged with
`buildmaster` and the commit ID.  The usage of the commit ID allows
for other parts of the piepline to easily refer to it for other
operations.
  • Loading branch information
miabbott committed Sep 28, 2018
1 parent a9062f4 commit ed956eb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Jenkinsfile.treecompose
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ def TIMER = "H/30 * * * *"
def NODE = "rhcos-jenkins"
def API_CI_REGISTRY = "registry.svc.ci.openshift.org"
def OS_NAME = "maipo";
def OSCONTAINER_IMG = API_CI_REGISTRY + "/rhcos/os-${OS_NAME}:latest"
def OSCONTAINER_IMG = API_CI_REGISTRY + "/rhcos/os-${OS_NAME}"
def COMPOSEFLAGS = "";

// 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 par_stages = [:]
Expand Down Expand Up @@ -90,8 +88,9 @@ node(NODE) {
stage("Build new container") { sh """
podman build --build-arg OS_VERSION=${composeMeta.version} \
--build-arg OS_COMMIT=${composeMeta.commit} \
-t ${OSCONTAINER_IMG} \
-t ${OSCONTAINER_IMG}:buildmaster \
-f ${WORKSPACE}/Dockerfile.rollup ${WORKSPACE}
podman tag ${OSCONTAINER_IMG}:buildmaster ${OSCONTAINER_IMG}:${composeMeta.commit}
""" }

if (params.DRY_RUN) {
Expand All @@ -102,8 +101,9 @@ node(NODE) {
}

stage("Push container") { sh """
podman push ${OSCONTAINER_IMG}
skopeo inspect docker://${OSCONTAINER_IMG} | jq '.Digest' > imgid.txt
podman push ${OSCONTAINER_IMG}:buildmaster
podman push ${OSCONTAINER_IMG}:${composeMeta.commit}
skopeo inspect docker://${OSCONTAINER_IMG}:buildmaster | jq '.Digest' > imgid.txt
"""
def cid = readFile('imgid.txt').trim().replaceAll('"','');
currentBuild.description = "🆕 ${OSCONTAINER_IMG}@${cid} (${composeMeta.version})";
Expand All @@ -119,7 +119,7 @@ node(NODE) {
--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'
"""
"""
} }

stage("Cleanup") { sh """
Expand Down

0 comments on commit ed956eb

Please sign in to comment.