Skip to content
Snippets Groups Projects
Commit 62e5db90 authored by Sjoerd Simons's avatar Sjoerd Simons
Browse files

only do uploads on production build


To make it possible to use the same Jenkins file in playground jobs for
testing and in production jobs for, well, proper builds detect whether
this is a "production" job vs a test. If it's not a production job don't
build/upload the docker image nor upload any other artifacts

Signed-off-by: default avatarSjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: default avatarAndrew Shadura <andrew.shadura@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D7343
parent 8071a3b6
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,13 @@ properties(
]
)
def uploadDirectory(source, target) {
def uploadDirectory(source, target, upload = true) {
if (!upload) {
println "Skipping upload of ${source} to ${target}"
return
}
sshagent (credentials: [ "5a23cd79-e26d-41bf-9f91-d756c131b811", ] ) {
env.NSS_WRAPPER_PASSWD = "/tmp/passwd"
env.NSS_WRAPPER_GROUP = '/dev/null'
......@@ -15,7 +21,7 @@ def uploadDirectory(source, target) {
}
}
def buildImage(architecture, type, board, debosarguments = "", sysroot = false, ostree = false) {
def buildImage(architecture, type, board, debosarguments = "", sysroot = false, ostree = false, production = false) {
return {
node("docker-slave") {
checkout scm
......@@ -43,7 +49,7 @@ def buildImage(architecture, type, board, debosarguments = "", sysroot = false,
}
stage("${architecture} ${type} ospack upload") {
uploadDirectory (env.PIPELINE_VERSION, "daily/debos/${release}")
uploadDirectory (env.PIPELINE_VERSION, "daily/debos/${release}", production)
}
if (sysroot) {
......@@ -58,7 +64,7 @@ def buildImage(architecture, type, board, debosarguments = "", sysroot = false,
}
stage("${architecture} sysroot upload") {
uploadDirectory (env.PIPELINE_VERSION, "sysroot/${release}")
uploadDirectory (env.PIPELINE_VERSION, "sysroot/${release}", production)
}
}
......@@ -74,7 +80,7 @@ def buildImage(architecture, type, board, debosarguments = "", sysroot = false,
}
stage("${architecture} ${type} ${board} image upload") {
uploadDirectory (env.PIPELINE_VERSION, "daily/debos/${release}")
uploadDirectory (env.PIPELINE_VERSION, "daily/debos/${release}", production)
}
if (ostree) {
......@@ -103,7 +109,7 @@ def buildImage(architecture, type, board, debosarguments = "", sysroot = false,
}
stage("${architecture} ${type} OStree upload") {
uploadDirectory ("${env.PIPELINE_VERSION}/${architecture}/${type}/repo", "ostree/${architecture}-generic-${type}/")
uploadDirectory("${env.PIPELINE_VERSION}/${architecture}/${type}/repo", "ostree/${architecture}-generic-${type}", production)
}
}
......@@ -118,19 +124,29 @@ def buildImage(architecture, type, board, debosarguments = "", sysroot = false,
}
}
node("docker-slave") {
checkout scm
stage("Image builder docker") {
docker.withRegistry('https://auth.docker-registry.apertis.org', 'apertis-docker') {
d = docker.build("auth.docker-registry.apertis.org/apertis/apertis-image-builder", "apertis-image-builder")
d.push()
/* Determine whether to run uploads based on the prefix of the job name; in
* case of apertis we expect the official jobs under apertis-<release>/ while
* non-official onces can be in e.g. playground/ */
def production = env.JOB_NAME.startsWith("apertis-")
if (production) {
node("docker-slave") {
checkout scm
stage("Image builder docker") {
docker.withRegistry('https://auth.docker-registry.apertis.org', 'apertis-docker') {
d = docker.build("auth.docker-registry.apertis.org/apertis/apertis-image-builder", "apertis-image-builder")
d.push()
}
}
}
}
def images = [:]
images["Sdk"] = buildImage("amd64", "sdk", "sdk", "--scratchsize 10G")
images["Sdk"] = buildImage("amd64", "sdk", "sdk",
"--scratchsize 10G",
false, false, production)
// Types for all boards, common debos arguments, sysroots and
def types = [ [ "minimal", "", false, true],
......@@ -143,20 +159,23 @@ images += types.collectEntries { [ "Amd64 ${it[0]}": buildImage("amd64",
"uefi",
it[1],
it[2],
it[3]) ] }
it[3],
production ) ] }
images += types.collectEntries { [ "Arm64 ${it[0]}": buildImage("arm64",
it[0],
"uboot",
it[1],
it[2],
it[3]) ] }
it[3],
production ) ] }
images += types.collectEntries { [ "Armhf ${it[0]}": buildImage("armhf",
it[0],
"uboot",
it[1],
it[2],
it[3]) ] }
it[3],
production ) ] }
parallel images
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment