build: refs #5483 dev deploy, tag image with version
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
7d2b5fbeda
commit
027f7d2c1d
|
@ -8,24 +8,41 @@ pipeline {
|
|||
PROJECT_NAME = 'salix'
|
||||
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||
}
|
||||
parameters {
|
||||
booleanParam(
|
||||
name: 'PROTECTED_BRANCH',
|
||||
defaultValue: false,
|
||||
description: 'Whether branch is a protected branch'
|
||||
)
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
env.VERSION = packageJson.version
|
||||
|
||||
switch (env.BRANCH_NAME) {
|
||||
case 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
env.BACK_REPLICAS = 4
|
||||
case 'dev':
|
||||
env.NODE_ENV = 'dev'
|
||||
env.BACK_REPLICAS = 1
|
||||
break
|
||||
case 'test':
|
||||
env.NODE_ENV = 'test'
|
||||
env.BACK_REPLICAS = 2
|
||||
break
|
||||
case 'dev':
|
||||
env.NODE_ENV = 'dev'
|
||||
case 'master':
|
||||
env.NODE_ENV = 'production'
|
||||
env.BACK_REPLICAS = 4
|
||||
break
|
||||
}
|
||||
|
||||
params.PROTECTED_BRANCH = [
|
||||
'dev',
|
||||
'test',
|
||||
'master'
|
||||
].contains(env.BRANCH_NAME)
|
||||
|
||||
env.GIT_COMMIT_MSG = sh(
|
||||
script: 'git log -1 --pretty=%B ${GIT_COMMIT}',
|
||||
returnStdout: true
|
||||
|
@ -69,6 +86,7 @@ pipeline {
|
|||
when {
|
||||
environment name: 'RUN_SOURCE', value: 'git'
|
||||
not { anyOf {
|
||||
branch 'dev'
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
|
@ -98,6 +116,7 @@ pipeline {
|
|||
when {
|
||||
environment name: 'RUN_SOURCE', value: 'git'
|
||||
anyOf {
|
||||
branch 'dev'
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}
|
||||
|
@ -114,13 +133,13 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
when { anyOf {
|
||||
branch 'dev'
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
parallel {
|
||||
stage('Database') {
|
||||
when { anyOf {
|
||||
branch 'dev'
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}}
|
||||
steps {
|
||||
configFileProvider([
|
||||
configFile(fileId: "config.${env.NODE_ENV}.ini",
|
||||
|
@ -137,10 +156,6 @@ pipeline {
|
|||
stage('Docker') {
|
||||
when {
|
||||
environment name: 'RUN_SOURCE', value: 'git'
|
||||
anyOf {
|
||||
branch 'test'
|
||||
branch 'master'
|
||||
}
|
||||
}
|
||||
environment {
|
||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||
|
@ -155,8 +170,7 @@ pipeline {
|
|||
post {
|
||||
success {
|
||||
script {
|
||||
if (env.RUN_SOURCE == 'git'
|
||||
&& ['master', 'test'].contains(env.BRANCH_NAME)) {
|
||||
if (env.RUN_SOURCE == 'git' && env.BRANCH_NAME == 'master') {
|
||||
String message = env.GIT_COMMIT_MSG
|
||||
int index = message.indexOf('\n')
|
||||
if (index != -1)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
version: '3.7'
|
||||
services:
|
||||
front:
|
||||
image: registry.verdnatura.es/salix-front:${BRANCH_NAME:?}
|
||||
image: registry.verdnatura.es/salix-front:${VERSION:?}
|
||||
tags:
|
||||
- ${BRANCH_NAME:?}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: front/Dockerfile
|
||||
|
@ -16,7 +18,9 @@ services:
|
|||
limits:
|
||||
memory: 1G
|
||||
back:
|
||||
image: registry.verdnatura.es/salix-back:${BRANCH_NAME:?}
|
||||
image: registry.verdnatura.es/salix-back:${VERSION:?}
|
||||
tags:
|
||||
- ${BRANCH_NAME:?}
|
||||
build: .
|
||||
ports:
|
||||
- 3000
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "24.06.01",
|
||||
"version": "24.6.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
Loading…
Reference in New Issue