summaryrefslogtreecommitdiff
path: root/Jenkinsfile
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-02-02 12:49:06 +0100
committerGitHub <noreply@github.com>2020-02-02 12:49:06 +0100
commitd7a2ea6195bd6a53dae6d107d3bb6d315186f09c (patch)
tree054a7d2da67f0e68fcb7a4c1b8f188bb19bc5652 /Jenkinsfile
parentc145b4b092b37a93ae11c8cc5eb016a018369eff (diff)
parent3446ab67778fbc4040fc7fe40ba5110491fb6222 (diff)
downloadvyos-build-d7a2ea6195bd6a53dae6d107d3bb6d315186f09c.tar.gz
vyos-build-d7a2ea6195bd6a53dae6d107d3bb6d315186f09c.zip
Merge pull request #80 from runborg/arm-build
T1927: Extend main docker container to support arm builds
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile81
1 files changed, 69 insertions, 12 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 40729a58..326c03e8 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -72,19 +72,76 @@ setDescription()
// Due to long build times on DockerHub we rather build the container by ourself
// and publish it later on.
+
+// create container names on demand
+env.DOCKER_IMAGE = "vyos/vyos-build:" + getGitBranchName()
+env.DOCKER_IMAGE_ARM = "vyos/vyos-build:" + getGitBranchName() + "-armhf"
+env.DOCKER_IMAGE_ARM64 = "vyos/vyos-build:" + getGitBranchName() + "-arm64"
+
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}"
+ stage('Fetch') {
+ git branch: getGitBranchName(),
+ url: getGitRepoURL()
+ }
+ stage('Build Docker container') {
+ parallel (
+ 'x86-64': {
+ script {
+ dir('docker') {
+ sh """
+ mkdir -p x86-64
+ cp Dockerfile x86-64/Dockerfile
+ cp entrypoint.sh x86-64/entrypoint.sh
+
+ docker build -t ${env.DOCKER_IMAGE} x86-64
+ """
+ if ( ! isCustomBuild()) {
+ withDockerRegistry([credentialsId: "DockerHub"]) {
+ sh "docker push ${env.DOCKER_IMAGE}"
+ }
+
+ }
+ }
+ }
+ },
+ 'armhf': {
+ script {
+ dir('docker') {
+ sh """
+ cp Dockerfile armhf/Dockerfile
+ cp entrypoint.sh armhf/entrypoint.sh
+ sed -i 's#^FROM.*#FROM multiarch/debian-debootstrap:armhf-buster-slim#' armhf/Dockerfile
+ docker build -t ${env.DOCKER_IMAGE_ARM} armhf
+ """
+ if ( ! isCustomBuild()) {
+ withDockerRegistry([credentialsId: "DockerHub"]) {
+ sh "docker push ${env.DOCKER_IMAGE_ARM}"
+ }
+ }
+ }
+ }
+ },
+ 'arm64': {
+ script {
+ dir('docker') {
+ sh """
+ cp Dockerfile arm64/Dockerfile
+ cp entrypoint.sh arm64/entrypoint.sh
+ sed -i 's#^FROM.*#FROM multiarch/debian-debootstrap:arm64-buster-slim#' arm64/Dockerfile
+ docker build -t ${env.DOCKER_IMAGE_ARM64} arm64
+
+ """
+
+ if ( ! isCustomBuild()) {
+ withDockerRegistry([credentialsId: "DockerHub"]) {
+ sh "docker push ${env.DOCKER_IMAGE_ARM64}"
+
+ }
+ }
+ }
+ }
}
- }
+ )
}
}
@@ -92,7 +149,7 @@ pipeline {
options {
skipDefaultCheckout()
disableConcurrentBuilds()
- timeout(time: 90, unit: 'MINUTES')
+ timeout(time: 120, unit: 'MINUTES')
parallelsAlwaysFailFast()
timestamps()
}