diff --git a/Jenkinsfile b/Jenkinsfile index 900340a..a29dc45 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,38 +4,27 @@ pipeline { agent any environment { PROJECT_NAME = 'vn-vmware' - IMAGE = 'registry.verdnatura.es/vn-debuild' + } + agent { + docker { + image 'registry.verdnatura.es/vn-debuild' + registryUrl 'https://registry.verdnatura.es/' + registryCredentialsId 'docker-registry' + args '-v /mnt/storage/reprepro:/reprepro' + } } stages { stage('Checkout') { steps { - script { - if (!env.GIT_COMMITTER_EMAIL) { - env.COMMITTER_EMAIL = sh( - script: 'git --no-pager show -s --format="%ae"', - returnStdout: true - ).trim() - } else { - env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; - } - } - sh 'printenv' + sh 'whoami' } } stage('Deploy') { when { branch 'master' } - agent { - docker { - image 'registry.verdnatura.es/vn-debuild' - registryUrl 'https://registry.verdnatura.es/' - registryCredentialsId 'docker-registry' - } - } steps { - sh 'ls /var/jenkins_home' sh 'debuild -us -uc -b' } } @@ -43,14 +32,6 @@ pipeline { when { branch 'master' } - agent { - docker { - image 'registry.verdnatura.es/vn-debuild' - registryUrl 'https://registry.verdnatura.es/' - registryCredentialsId 'docker-registry' - args '-u www-data -v /mnt/storage/reprepro:/reprepro' - } - } steps { sh 'vn-include "$WORKSPACE"' } @@ -59,6 +40,15 @@ pipeline { post { always { script { + if (!env.GIT_COMMITTER_EMAIL) { + env.COMMITTER_EMAIL = sh( + script: 'git --no-pager show -s --format="%ae"', + returnStdout: true + ).trim() + } else { + env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL; + } + if (!env.COMMITTER_EMAIL) return try { mail(