podTemplate(yaml: ''' apiVersion: v1 kind: Pod spec: volumes: - name: docker-socket emptyDir: {} - name: docker-local-certs configMap: name: docker-cert containers: - name: docker image: docker:19.03.1 command: - sleep args: - 99d volumeMounts: - name: docker-socket mountPath: /var/run - name: docker-daemon image: docker:19.03.1-dind securityContext: privileged: true volumeMounts: - name: docker-socket mountPath: /var/run - name: docker-local-certs mountPath: /etc/docker/certs.d/docker.local - name: python image: docker.local/ci/python:latest imagePullPolicy: Always command: - sleep args: - 99d - name: helm image: docker.local/ci/helm:latest imagePullPolicy: Always env: - name: KUBECONFIG value: /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/kube.config command: - sleep args: - 99d ''') { node(POD_LABEL) { try { stage('Git') { git url: 'https://gyulai.cloud/git/bme/covidok-backend.git', credentialsId: '1b1c30a0-590d-41d4-b775-bdb90e837bc8' container('docker') { stage('Build dev image') { sh 'docker build -f /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/CoviDok/Dockerfile.CI -t docker.local/bme/covidok:dev /home/jenkins/agent/workspace' } stage('Push dev image') { sh 'docker push docker.local/bme/covidok:dev' } } container('helm') { stage('Helm lint'){ sh 'helm lint /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' } stage('Install dev') { sh '/home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/helm_test.sh /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' } } container('python') { stage('API test'){ sh 'echo python3 -m pytest /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/tests' } } container('docker') { stage('Push tested image'){ sh 'docker tag docker.local/bme/covidok:dev docker.local/bme/covidok:latest' sh 'docker push docker.local/bme/covidok:latest' withCredentials([string(credentialsId: 'docker-dgyulaid-token', variable: 'DOCKER_PASS')]) { sh ''' echo "$DOCKER_PASS" | docker login --username dgyulaid --password-stdin docker tag docker.local/bme/covidok:latest dgyulaid/covidok:latest docker push dgyulaid/covidok:latest ''' } } } container('helm'){ stage('Package Helm') { sh 'helm package /home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/helm/covidok' } } stage('Archive chart'){ archiveArtifacts artifacts: 'covidok*tgz', followSymlinks: false, onlyIfSuccessful: true } } } finally { container('helm') { sh '/home/jenkins/agent/workspace/gitea-bme_covidok-backend_master/ci/cleanup.sh' } } } }