Performing better masking on credentials; renaming env variables; cleaning up after Docker agents.
Apps/everybody-mov/pipeline/head This commit looks good
Details
Apps/everybody-mov/pipeline/head This commit looks good
Details
This commit is contained in:
parent
5e4a63af9c
commit
9d3b41f338
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"extends": "recommended",
|
||||||
|
"rules": {
|
||||||
|
"NestedBlockDepth": {
|
||||||
|
"enabled": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +1,21 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
|
|
||||||
agent none
|
agent none
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
HOME = "${env.WORKSPACE}"
|
HOME = "${env.WORKSPACE}"
|
||||||
DOCKER_REGISTRY = 'https://registry.digitalocean.com'
|
PYTHON_IMAGE = 'python:3.10-slim-bullseye'
|
||||||
DOCKER_IMAGE_NAME = 'registry.digitalocean.com/ailuridae-registry/ailuridae.io/everybodymov'
|
CREDENTIALS_ID = 'digital-ocean-ailuridae-registry'
|
||||||
DOCKER_IMAGE = ''
|
REGISTRY = 'https://registry.digitalocean.com'
|
||||||
|
IMAGE_NAME = 'registry.digitalocean.com/ailuridae-registry/ailuridae.io/everybodymov'
|
||||||
|
IMAGE_BUILD = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Setup') {
|
stage('Setup') {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'python:3.10-slim-bullseye'
|
image env.PYTHON_IMAGE
|
||||||
|
args '--rm'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
|
@ -25,7 +27,8 @@ pipeline {
|
||||||
stage('Check') {
|
stage('Check') {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'python:3.10-slim-bullseye'
|
image env.PYTHON_IMAGE
|
||||||
|
args '--rm'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
|
@ -40,7 +43,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
DOCKER_IMAGE = docker.build("${DOCKER_IMAGE_NAME}")
|
IMAGE_BUILD = docker.build("${IMAGE_NAME}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,9 +56,16 @@ pipeline {
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.withRegistry(env.DOCKER_REGISTRY, 'digital-ocean-ailuridae-registry') {
|
// withCredentials annoyingly required to mask token.
|
||||||
DOCKER_IMAGE.push("${BUILD_NUMBER}")
|
withCredentials([usernamePassword(
|
||||||
DOCKER_IMAGE.push('latest')
|
credentialsId: env.CREDENTIALS_ID,
|
||||||
|
usernameVariable: 'API_TOKEN_USER',
|
||||||
|
passwordVariable: 'API_TOKEN_PASS'
|
||||||
|
)]) {
|
||||||
|
docker.withRegistry(env.REGISTRY, env.CREDENTIALS_ID) {
|
||||||
|
IMAGE_BUILD.push("${BUILD_NUMBER}")
|
||||||
|
IMAGE_BUILD.push('latest')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,5 +79,4 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue