From 2b926f0b3b448b79fa14185060f540b4515da365 Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Mon, 4 Jan 2021 15:54:09 -0500 Subject: [PATCH] test --- Jenkinsfile | 12 +++++++++--- Jenkinsfile-pod-template.yml | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 Jenkinsfile-pod-template.yml diff --git a/Jenkinsfile b/Jenkinsfile index 8d783bc..67e346f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,10 +2,16 @@ pipeline { environment { registry = 'https://registry.hub.docker.com' registryCredential = 'dockerhub_jcabillot' - dockerImage = 'jcabillot/ip' + dockerImage = 'jcabillot/ip:arm64' } - agent any + //agent any + agent { + kubernetes { + defaultContainer 'docker' // All `steps` instructions will be executed by this container + yamlFile 'Jenkinsfile-pod-template.yml' + } + } triggers { cron('@midnight') @@ -20,7 +26,7 @@ pipeline { stage('Build image') { steps{ - sh 'docker build --force-rm=true --no-cache=true --pull -t ${dockerImage} .' + sh 'docker build --build-arg VERSION=arm64 --force-rm=true --no-cache=true --pull -t ${dockerImage} .' } } diff --git a/Jenkinsfile-pod-template.yml b/Jenkinsfile-pod-template.yml new file mode 100644 index 0000000..a7cc769 --- /dev/null +++ b/Jenkinsfile-pod-template.yml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Pod +metadata: + labels: + jenkins: 'true' +spec: + containers: + - name: jnlp + image: 'jcabillot/docker-inbound-agent-arm64' + - name: docker + image: docker:20.10-dind + securityContext: + privileged: true + #volumeMounts: + #- mountPath: '/var/run/docker.sock' + # name: docker-socket + #volumes: + #- name: docker-socket + # hostPath: + # path: '/var/run/docker.sock' + securityContext: + runAsUser: 0