pipeline { agent none environment { HOME = "${env.WORKSPACE}" CREDENTIALS_ID = 'digital-ocean-ailuridae-registry' DOCKER_REGISTRY = 'https://registry.digitalocean.com' DOCKER_IMAGE_NAME = 'registry.digitalocean.com/ailuridae-registry/ailuridae.io/everybodymov' DOCKER_IMAGE = '' } stages { stage('Setup') { agent { docker { image 'python:3.10-slim-bullseye' } } steps { sh 'python -m pip install --no-cache-dir --upgrade --user pip' sh 'python -m pip install --no-cache-dir pipenv --user' sh 'python -m pipenv install --dev' } } stage('Check') { agent { docker { image 'python:3.10-slim-bullseye' } } steps { sh 'python -m pipenv verify' sh 'python -m pipenv check --clear' sh 'python -m pipenv run bandit *.py' } } stage('Build') { agent { label 'main' } steps { script { DOCKER_IMAGE = docker.build("${DOCKER_IMAGE_NAME}") } } } stage('Publish') { agent { label 'main' } // when { // branch 'main' // } steps { script { withCredentials([usernamePassword( credentialsId: env.CREDENTIALS_ID, usernameVariable: 'JENKINS_USERNAME', passwordVariable: 'JENKINS_PASSWORD' )]) { docker.withRegistry(env.DOCKER_REGISTRY, env.CREDENTIALS_ID) { DOCKER_IMAGE.push("${BUILD_NUMBER}") DOCKER_IMAGE.push('latest') } } } } } } post { always { node('main') { cleanWs() } } } }