ci: refs #7442 Kubernetes deploy
gitea/worker-time-control/pipeline/head This commit looks good
Details
gitea/worker-time-control/pipeline/head This commit looks good
Details
This commit is contained in:
parent
be3d8ba04a
commit
95b56a7c36
|
@ -4,12 +4,12 @@ pipeline {
|
||||||
agent any
|
agent any
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'worker-time-control'
|
PROJECT_NAME = 'worker-time-control'
|
||||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
setEnv()
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||||
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
|
@ -21,6 +21,10 @@ pipeline {
|
||||||
CREDENTIALS = credentials('docker-registry')
|
CREDENTIALS = credentials('docker-registry')
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
env.VERSION = packageJson.version
|
||||||
|
}
|
||||||
dockerBuild()
|
dockerBuild()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,16 +33,24 @@ pipeline {
|
||||||
branch 'test'
|
branch 'test'
|
||||||
branch 'master'
|
branch 'master'
|
||||||
}}
|
}}
|
||||||
environment {
|
|
||||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
sh "docker stack deploy --with-registry-auth --prune --compose-file docker-compose.yml ${env.STACK_NAME}"
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
env.VERSION = packageJson.version
|
||||||
|
}
|
||||||
|
withKubeConfig([
|
||||||
|
serverUrl: "$KUBERNETES_API",
|
||||||
|
credentialsId: 'kubernetes',
|
||||||
|
namespace: 'worker-time-control'
|
||||||
|
]) {
|
||||||
|
sh 'kubectl set image deployment/worker-time-control-$BRANCH_NAME worker-time-control-$BRANCH_NAME=$REGISTRY/worker-time-control:$VERSION'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
setEnv()
|
||||||
sendEmail()
|
sendEmail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,5 @@
|
||||||
version: '3.7'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
main:
|
main:
|
||||||
image: registry.verdnatura.es/worker-time-control:${BRANCH_NAME:?}
|
image: registry.verdnatura.es/worker-time-control:${VERSION:?}
|
||||||
build: .
|
build: .
|
||||||
ports:
|
|
||||||
- 80
|
|
||||||
configs:
|
|
||||||
- source: config
|
|
||||||
target: /usr/local/apache2/htdocs/config.js
|
|
||||||
deploy:
|
|
||||||
replicas: 1
|
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
- node.role == worker
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 500M
|
|
||||||
configs:
|
|
||||||
config:
|
|
||||||
external: true
|
|
||||||
name: worker-time-control_${BRANCH_NAME:?}_config
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "worker-time-control",
|
"name": "worker-time-control",
|
||||||
"version": "1.0.2",
|
"version": "24.22.1",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Verdnatura Time Control",
|
"description": "Verdnatura Time Control",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue