diff --git a/Jenkinsfile b/Jenkinsfile index 1e9c13f..e8ef6c4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,9 +2,19 @@ node('docker') { + checkout scm + stage 'Build Containers' sh './build-rubies.sh' stage 'Publish Containers' - sh './push-rubies.sh' + /* Using credentials with the ID 'dockerhub' from the Jenkins installation */ + withCredentials([[$class: 'UsernamePasswordMultiBinding', + credentialsId: 'dockerhub', + passwordVariable: 'DOCKERHUB_TOKEN', + usernameVariable: 'DOCKERHUB_EMAIL']]) { + /* Our variables be exposed in the environment and we must log in before trying to publish to Dockerhub */ + sh 'docker login --username ${DOCKERHUB_EMAIL} --password ${DOCKERHUB_TOKEN}' + sh './push-rubies.sh' + } }