Skip to content

Commit

Permalink
pipeline: upload builds to S3
Browse files Browse the repository at this point in the history
This is a first step towards switching to S3. We still rsync to the
artifact server, but we also upload new builds to S3. Once we confirm
this works nicely, we can switch over to using `buildprep` and
completely wean off the artifact server.
  • Loading branch information
jlebon committed Jun 5, 2019
1 parent dca6922 commit 7fd41ca
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ properties([
])
])

// see bucket layout in https://github.com/coreos/fedora-coreos-tracker/issues/189
def s3_builddir = "fcos-builds/prod/streams/${params.STREAM}/builds"

podTemplate(cloud: 'openshift', label: 'coreos-assembler', yaml: pod, defaultContainer: 'jnlp') {
node('coreos-assembler') { container('coreos-assembler') {

Expand All @@ -46,6 +49,15 @@ podTemplate(cloud: 'openshift', label: 'coreos-assembler', yaml: pod, defaultCon
}

stage('Fetch') {
/*
// XXX: uncomment once we have a build there
if (prod && utils.path_exists("/.aws")) {
utils.shwrap("""
coreos-assembler buildprep s3://${s3_builddir}
""")
}
*/

if (prod) {
// make sure our cached version matches prod exactly before continuing
utils.rsync_in("builds", "builds")
Expand Down Expand Up @@ -101,6 +113,7 @@ podTemplate(cloud: 'openshift', label: 'coreos-assembler', yaml: pod, defaultCon
}

stage('Prune') {
// XXX: stop pruning like this when we fully drop artifact server
utils.shwrap("""
coreos-assembler prune --keep=8
""")
Expand All @@ -125,6 +138,7 @@ podTemplate(cloud: 'openshift', label: 'coreos-assembler', yaml: pod, defaultCon

// Change perms to allow reading on webserver side.
// Don't touch symlinks (https://github.com/CentOS/sig-atomic-buildscripts/pull/355)
// XXX: can drop this when dropping artifact server
utils.shwrap("""
find builds/ ! -type l -exec chmod a+rX {} +
""")
Expand All @@ -135,6 +149,13 @@ podTemplate(cloud: 'openshift', label: 'coreos-assembler', yaml: pod, defaultCon
if (prod) {
utils.rsync_out("builds", "builds")
}

if (prod && utils.path_exists("/.aws")) {
// XXX: just upload as public-read for now
utils.shwrap("""
coreos-assembler buildupload s3 --acl=public-read ${s3_builddir}
""")
}
}
}}
}

0 comments on commit 7fd41ca

Please sign in to comment.