everybody-mov/Jenkinsfile

70 lines
1.7 KiB
Plaintext
Raw Normal View History

2022-09-01 03:23:10 +00:00
pipeline {
2022-09-02 03:46:34 +00:00
agent none
2022-09-01 03:23:10 +00:00
2022-09-01 04:41:17 +00:00
environment {
HOME = "${env.WORKSPACE}"
2022-09-02 03:46:34 +00:00
DOCKER_IMAGE_NAME = 'registry.digitalocean.com/ailuridae-registry/ailuridae.io/everybodymov'
DOCKER_IMAGE = ''
2022-09-01 04:41:17 +00:00
}
2022-09-01 03:23:10 +00:00
stages {
stage('Setup') {
2022-09-02 03:46:34 +00:00
agent {
docker {
image 'python:3.10-slim-bullseye'
}
}
2022-09-01 03:23:10 +00:00
steps {
2022-09-01 04:41:17 +00:00
sh 'python -m pip install --no-cache-dir --upgrade --user pip'
sh 'python -m pip install --no-cache-dir pipenv --user'
2022-09-01 04:44:15 +00:00
sh 'python -m pipenv install --dev'
2022-09-01 03:23:10 +00:00
}
}
stage('Check') {
2022-09-02 03:46:34 +00:00
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 -r .'
}
}
stage('Build') {
2022-09-02 03:48:10 +00:00
agent {
label 'main'
}
2022-09-02 03:46:34 +00:00
steps {
script {
DOCKER_IMAGE = docker.build("${DOCKER_IMAGE_NAME}")
}
}
}
stage('Publish') {
2022-09-02 03:48:10 +00:00
agent {
label 'main'
}
2022-09-01 03:23:10 +00:00
steps {
2022-09-02 03:46:34 +00:00
script {
docker.withRegistry("", "digital-ocean-ailuridae-registry") {
DOCKER_IMAGE.push("${BUILD_NUMBER}")
DOCKER_IMAGE.push('latest')
}
}
2022-09-01 03:23:10 +00:00
}
}
}
post {
2022-09-02 03:49:34 +00:00
agent {
label 'main'
}
2022-09-01 03:23:10 +00:00
always {
cleanWs()
}
}
}