#!/usr/bin/env groovy pipeline { agent any environment { PROJECT_NAME = 'hedera-web' } stages { stage('Checkout') { steps { setEnv() } } stage('Package') { when { branch 'master' } agent { docker { image 'registry.verdnatura.es/vn-debuild' registryUrl 'https://registry.verdnatura.es/' registryCredentialsId 'docker-registry' args '-v /mnt/appdata/reprepro:/reprepro' } } steps { sh 'debuild -us -uc -b' sh 'vn-includedeb' } } stage('Build') { when { branch 'master' } environment { CREDS = credentials('docker-registry') } steps { sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY' sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel' sh 'docker-compose push' } } stage('Deploy') { when { branch 'master' } environment { DOCKER_HOST = "${env.SWARM_HOST}" } steps { dockerStackDeploy() } } } post { always { sendEmail() } } }