Merge pull request 'test' (#1) from test into master
gitea/hedera-web/pipeline/head This commit looks good Details

Reviewed-on: #1
This commit is contained in:
Juan Ferrer 2022-05-05 09:43:20 +00:00
commit 07632e077e
5 changed files with 44 additions and 18 deletions

View File

@ -1,6 +1,9 @@
# Not using buster because of bug: https://bugs.php.net/bug.php?id=78870 # Not using buster because of bug: https://bugs.php.net/bug.php?id=78870
FROM debian:stretch-slim FROM debian:stretch-slim
ARG VERSION
ENV VERSION $VERSION
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
@ -37,8 +40,9 @@ RUN apt-get update \
cron cron
ARG BUILD_ID=unknown ARG BUILD_ID=unknown
RUN echo $VERSION
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y php-vn-lib hedera-web \ && apt-get install -y php-vn-lib hedera-web=$VERSION \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
CMD ["apachectl", "-D", "FOREGROUND"] CMD ["apachectl", "-D", "FOREGROUND"]

29
Jenkinsfile vendored
View File

@ -4,16 +4,35 @@ pipeline {
agent any agent any
environment { environment {
PROJECT_NAME = 'hedera-web' PROJECT_NAME = 'hedera-web'
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
} }
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
switch (env.BRANCH_NAME) {
case 'master':
env.NODE_ENV = 'production'
env.REPLICAS = 3
break
case 'test':
env.NODE_ENV = 'test'
env.REPLICAS = 1
break
}
}
setEnv() setEnv()
} }
} }
stage('Package') { stage('Package') {
when { when {
anyOf {
branch 'master' branch 'master'
branch 'test'
}
} }
agent { agent {
docker { docker {
@ -30,7 +49,10 @@ pipeline {
} }
stage('Build') { stage('Build') {
when { when {
anyOf {
branch 'master' branch 'master'
branch 'test'
}
} }
environment { environment {
CREDS = credentials('docker-registry') CREDS = credentials('docker-registry')
@ -43,18 +65,21 @@ pipeline {
} }
stage('Deploy') { stage('Deploy') {
when { when {
anyOf {
branch 'master' branch 'master'
branch 'test'
}
} }
environment { environment {
DOCKER_HOST = "${env.SWARM_HOST}" DOCKER_HOST = "${env.SWARM_HOST}"
} }
steps { steps {
dockerStackDeploy() sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
} }
} }
} }
post { post {
always { unsuccessful {
sendEmail() sendEmail()
} }
} }

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.407.65) stable; urgency=low hedera-web (1.407.66) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -1,28 +1,28 @@
version: '3.7' version: '3.7'
services: services:
main: main:
image: registry.verdnatura.es/hedera-web image: registry.verdnatura.es/hedera-web:${BRANCH_NAME:?}
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args:
- VERSION=${VERSION:?}
ports: ports:
- 80 - 80
configs: configs:
- source: config - source: config
target: /etc/hedera-web/config.my.php target: /etc/hedera-web/config.my.php
- source: test
target: /etc/hedera-web/config.test.php
volumes: volumes:
- /mnt/appdata:/mnt/storage - /mnt/appdata:/mnt/storage
- /mnt/appdata/image:/var/lib/hedera-web/image-db - /mnt/appdata/image:/var/lib/hedera-web/image-db
- /mnt/appdata/vn-access:/var/lib/hedera-web/vn-access - /mnt/appdata/vn-access:/var/lib/hedera-web/vn-access
deploy: deploy:
replicas: 3 replicas: ${REPLICAS:?}
placement: placement:
constraints: constraints:
- node.role == worker - node.role == worker
cron: cron:
image: registry.verdnatura.es/hedera-web image: registry.verdnatura.es/hedera-web:${BRANCH_NAME:?}
command: 'cron -f' command: 'cron -f'
configs: configs:
- source: config - source: config
@ -37,7 +37,4 @@ services:
configs: configs:
config: config:
external: true external: true
name: ${PROJECT_NAME:?}_config name: ${PROJECT_NAME:?}-${BRANCH_NAME:?}
test:
external: true
name: ${PROJECT_NAME:?}_test

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "1.407.65", "version": "1.407.66",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {