summaryrefslogtreecommitdiff
path: root/Jenkinsfile
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-12-26 16:28:56 +0100
committerChristian Poessinger <christian@poessinger.com>2019-12-26 16:28:56 +0100
commitc82e353e08e2d6c1a453c8266fdb6356b8f2758d (patch)
treebd78654612203a97b1a39aa624d9c6b71ff48193 /Jenkinsfile
parent04848a46febc55261fd64a1378d5a48c1bc388d6 (diff)
downloadvyos-build-c82e353e08e2d6c1a453c8266fdb6356b8f2758d.tar.gz
vyos-build-c82e353e08e2d6c1a453c8266fdb6356b8f2758d.zip
Jenkins: auto publish container to DockerHub
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile31
1 files changed, 23 insertions, 8 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 2abfa282..d01a31be 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -62,16 +62,35 @@ def setDescription() {
item.save()
}
-/* Only keep the 10 most recent builds. */
+// Only keep the 10 most recent builds
def projectProperties = [
- [$class: 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '1']],
+ [$class: 'BuildDiscarderProperty',strategy: [$class: 'LogRotator', numToKeepStr: '10']],
]
properties(projectProperties)
setDescription()
+// Due to long build times on DockerHub we rather build the container by ourself
+// and publish it later on.
+node('Docker') {
+ stage('Build Container') {
+ script {
+ git branch: getGitBranchName(),
+ url: getGitRepoURL()
+
+ // create container name on demand
+ env.DOCKER_IMAGE = "vyos/vyos-build:" + getGitBranchName()
+ sh "docker build -t ${env.DOCKER_IMAGE} docker"
+ withDockerRegistry([credentialsId: "DockerHub"]) {
+ sh "docker push ${env.DOCKER_IMAGE}"
+ }
+ }
+ }
+}
+
pipeline {
options {
+ skipDefaultCheckout()
disableConcurrentBuilds()
timeout(time: 90, unit: 'MINUTES')
parallelsAlwaysFailFast()
@@ -87,21 +106,17 @@ pipeline {
}
}
stages {
- stage('Configure') {
+ stage('Build ISO') {
steps {
script {
def commitId = sh(returnStdout: true, script: 'git rev-parse --short=11 HEAD').trim()
currentBuild.description = sprintf('Git SHA1: %s', commitId[-11..-1])
sh './configure --build-by autobuild@vyos.net --debian-mirror http://ftp.us.debian.org/debian/'
+ sh 'sudo make iso'
}
}
}
- stage('Build') {
- steps {
- sh 'sudo make iso'
- }
- }
}
post {
cleanup {