2022-03-31 11:37:25 +02:00
|
|
|
pipeline {
|
2022-03-31 12:02:49 +02:00
|
|
|
agent {
|
|
|
|
label 'docker'
|
|
|
|
}
|
2022-03-31 11:37:25 +02:00
|
|
|
environment {
|
2022-03-31 12:06:51 +02:00
|
|
|
imagename = "d4science/r-full" //TO FILL WITH THE RIGHT VALUE (RepositoryName)
|
2022-03-31 11:37:25 +02:00
|
|
|
registryCredential = 'e348bfab-5580-4db6-b0e0-d854966bde08'
|
2022-03-31 12:06:51 +02:00
|
|
|
dockerImage = '' // TO FILL WITH THE RIGHT VALUE IF NEEDED
|
2022-03-31 11:37:25 +02:00
|
|
|
git_url='https://code-repo.d4science.org/gCubeSystem/docker-r-template-test.git'
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Cloning Git') {
|
|
|
|
steps {
|
|
|
|
git([url: git_url, branch: 'master', credentialsId: '88b54962-1c0e-49cb-8155-22276860f346'])
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Building image') {
|
|
|
|
steps{
|
|
|
|
script {
|
|
|
|
dockerImage = docker.build imagename
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Deploy Image') {
|
|
|
|
steps{
|
|
|
|
script {
|
|
|
|
docker.withRegistry( '', registryCredential ) {
|
|
|
|
dockerImage.push("$BUILD_NUMBER")
|
|
|
|
dockerImage.push('latest')
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Remove Unused docker image') {
|
|
|
|
steps{
|
|
|
|
sh "docker rmi $imagename:$BUILD_NUMBER"
|
|
|
|
sh "docker rmi $imagename:latest"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|