diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-12-26 14:23:02 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-12-26 16:19:36 +0100 |
commit | e0c61a29d89d500772cb94aed07d537e7c7ea33e (patch) | |
tree | ea84c7857c9be6bbaa7b893fb28af88ab62b6bbc /Jenkinsfile | |
parent | 3a538c48545dc9f8284165cab398cb940ac626af (diff) | |
download | vyos-build-e0c61a29d89d500772cb94aed07d537e7c7ea33e.tar.gz vyos-build-e0c61a29d89d500772cb94aed07d537e7c7ea33e.zip |
Jenkins: auto publish container to DockerHub
Diffstat (limited to 'Jenkinsfile')
-rw-r--r-- | Jenkinsfile | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index 3eaa5fe8..d30f5b3d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,8 +70,27 @@ def projectProperties = [ 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,22 +106,18 @@ 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' - } - } - stage('Test') { + stage('Test ISO') { steps { sh """ cd build |