Compare commits
No commits in common. "master" and "5144-improveArc" have entirely different histories.
master
...
5144-impro
|
@ -2,54 +2,64 @@
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
options {
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
}
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'vn-rfid'
|
PROJECT_NAME = 'vn-rfid'
|
||||||
|
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Setup') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
script {
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
switch (env.BRANCH_NAME) {
|
||||||
|
case 'master':
|
||||||
|
env.NODE_ENV = 'production'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setEnv()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
when {
|
when { anyOf {
|
||||||
branch 'master'
|
branch 'master'
|
||||||
}
|
}}
|
||||||
environment {
|
environment {
|
||||||
CREDENTIALS = credentials('docker-registry')
|
CREDENTIALS = credentials('docker-registry')
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
|
||||||
def packageJson = readJSON file: 'package.json'
|
|
||||||
env.VERSION = packageJson.version
|
|
||||||
}
|
|
||||||
dockerBuild()
|
dockerBuild()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
when {
|
when { anyOf {
|
||||||
branch 'master'
|
branch 'master'
|
||||||
|
}}
|
||||||
|
environment {
|
||||||
|
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
|
||||||
def packageJson = readJSON file: 'package.json'
|
|
||||||
env.VERSION = packageJson.version
|
|
||||||
}
|
|
||||||
withKubeConfig([
|
|
||||||
serverUrl: "$KUBERNETES_API",
|
|
||||||
credentialsId: 'kubernetes',
|
|
||||||
namespace: 'vn-rfid'
|
|
||||||
]) {
|
|
||||||
sh 'kubectl set image deployment/vn-rfid vn-rfid=$REGISTRY/vn-rfid:$VERSION'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
setEnv()
|
script {
|
||||||
sendEmail()
|
if (!env.COMMITTER_EMAIL || currentBuild.currentResult == 'SUCCESS') return;
|
||||||
|
try {
|
||||||
|
mail(
|
||||||
|
to: env.COMMITTER_EMAIL,
|
||||||
|
subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}",
|
||||||
|
body: "Check status at ${env.BUILD_URL}"
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
echo e.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,20 @@
|
||||||
version: '3.7'
|
version: '3.7'
|
||||||
services:
|
services:
|
||||||
main:
|
main:
|
||||||
image: registry.verdnatura.es/vn-rfid:${VERSION:?}
|
image: registry.verdnatura.es/vn-rfid:${BRANCH_NAME:?}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 8888
|
||||||
|
configs:
|
||||||
|
- source: config
|
||||||
|
target: /app/config.local.yml
|
||||||
|
deploy:
|
||||||
|
placement:
|
||||||
|
constraints:
|
||||||
|
- node.role == worker
|
||||||
|
configs:
|
||||||
|
config:
|
||||||
|
external: true
|
||||||
|
name: vn-rfid_config
|
|
@ -1,10 +1,12 @@
|
||||||
import con from '../db/connect.js';
|
import con from '../db/connect.js';
|
||||||
|
import counter from './counter.js';
|
||||||
import t from '../util/translator.js';
|
import t from '../util/translator.js';
|
||||||
|
|
||||||
export default async(rfids, arcId) => {
|
export default async(rfids, arcId) => {
|
||||||
try {
|
try {
|
||||||
console.log(Array.from(rfids));
|
console.log(Array.from(rfids));
|
||||||
await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [Array.from(rfids), arcId, null]);
|
await con.query(`CALL vn.expeditionPallet_build(JSON_ARRAY(?), ?, ?, @palletId);`, [Array.from(rfids), arcId, null]);
|
||||||
|
await counter(null, arcId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
await con.query(`UPDATE vn.arcRead SET error = ?, counter = NULL WHERE id = ?;`, [t(error.sqlMessage), arcId]);
|
await con.query(`UPDATE vn.arcRead SET error = ?, counter = NULL WHERE id = ?;`, [t(error.sqlMessage), arcId]);
|
||||||
|
|
|
@ -43,7 +43,6 @@ export default async(conf, cb) => {
|
||||||
newPallet(rfidbuffer, conf.arcId);
|
newPallet(rfidbuffer, conf.arcId);
|
||||||
rfidbuffer = new Set();
|
rfidbuffer = new Set();
|
||||||
rfidbufferExtend = [];
|
rfidbufferExtend = [];
|
||||||
counterIntervalManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function counterIntervalManager() {
|
function counterIntervalManager() {
|
||||||
|
|
Loading…
Reference in New Issue