Compare commits
2 Commits
dev
...
8296-siste
Author | SHA1 | Date |
---|---|---|
|
1adead8b6b | |
|
da4a733254 |
|
@ -1,80 +1,33 @@
|
||||||
#!/usr/bin/env groovy
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
def PROTECTED_BRANCH
|
|
||||||
|
|
||||||
node {
|
|
||||||
stage('Setup') {
|
|
||||||
PROTECTED_BRANCH = [
|
|
||||||
'dev',
|
|
||||||
'test',
|
|
||||||
'master',
|
|
||||||
'main',
|
|
||||||
'beta'
|
|
||||||
].contains(env.BRANCH_NAME)
|
|
||||||
|
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
options {
|
options {
|
||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Version') {
|
stage('Build') {
|
||||||
when {
|
when {branch 'master'}
|
||||||
expression { PROTECTED_BRANCH }
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
env.VERSION = packageJson.version
|
||||||
|
}
|
||||||
|
sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Push') {
|
||||||
|
when {branch 'master'}
|
||||||
|
environment {
|
||||||
|
CREDENTIALS = credentials('docker-registry')
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
def version = "${packageJson.version}-build${env.BUILD_ID}"
|
env.VERSION = packageJson.version
|
||||||
writeFile(file: 'VERSION.txt', text: version)
|
|
||||||
echo "VERSION: ${version}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Build') {
|
|
||||||
when {
|
|
||||||
expression { PROTECTED_BRANCH }
|
|
||||||
}
|
|
||||||
environment {
|
|
||||||
VERSION = readFile 'VERSION.txt'
|
|
||||||
}
|
|
||||||
parallel {
|
|
||||||
stage('Producer') {
|
|
||||||
steps {
|
|
||||||
dockerBuild 'mycdc-producer', '.', 'assets/Dockerfile.producer'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Consumer') {
|
|
||||||
steps {
|
|
||||||
dockerBuild 'mycdc-consumer', '.', 'assets/Dockerfile.consumer'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Deploy') {
|
|
||||||
when {
|
|
||||||
anyOf {
|
|
||||||
branch 'dev'
|
|
||||||
branch 'test'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
environment {
|
|
||||||
VERSION = readFile 'VERSION.txt'
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
withKubeConfig([
|
|
||||||
serverUrl: "$KUBERNETES_API",
|
|
||||||
credentialsId: 'kubernetes',
|
|
||||||
namespace: "mycdc-${env.BRANCH_NAME}"
|
|
||||||
]) {
|
|
||||||
sh 'kubectl set image deployment/producer main=$REGISTRY/mycdc-producer:$VERSION'
|
|
||||||
sh 'kubectl set image deployment/consumer main=$REGISTRY/mycdc-consumer:$VERSION'
|
|
||||||
}
|
}
|
||||||
|
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
||||||
|
sh 'docker-compose push'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,20 +38,3 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def dockerBuild(imageName, context, dockerfile = null) {
|
|
||||||
if (dockerfile == null)
|
|
||||||
dockerfile = "${context}/Dockerfile"
|
|
||||||
def baseImage = "${imageName}:${env.VERSION}"
|
|
||||||
def image = docker.build(baseImage, "-f ${dockerfile} ${context}")
|
|
||||||
dockerPush(image)
|
|
||||||
}
|
|
||||||
|
|
||||||
def dockerPush(image) {
|
|
||||||
def isLatest = ['master', 'main'].contains(env.BRANCH_NAME)
|
|
||||||
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
|
|
||||||
image.push()
|
|
||||||
image.push(env.BRANCH_NAME)
|
|
||||||
if (isLatest) image.push('latest')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -50,4 +50,4 @@ npm run consumer
|
||||||
|
|
||||||
* [Zongji](https://github.com/nevill/zongji)
|
* [Zongji](https://github.com/nevill/zongji)
|
||||||
* [MySQL2](https://github.com/sidorares/node-mysql2#readme)
|
* [MySQL2](https://github.com/sidorares/node-mysql2#readme)
|
||||||
* [RabbitMQ](https://www.rabbitmq.com/)
|
* [RabbitMQ] (https://www.rabbitmq.com/)
|
||||||
|
|
|
@ -9,3 +9,5 @@ CREATE TABLE `util`.`binlogQueue`(
|
||||||
CREATE USER 'mycdc-producer'@'%' IDENTIFIED BY 'P4$$w0rd';
|
CREATE USER 'mycdc-producer'@'%' IDENTIFIED BY 'P4$$w0rd';
|
||||||
GRANT REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'mycdc-producer'@'%';
|
GRANT REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'mycdc-producer'@'%';
|
||||||
GRANT INSERT, DELETE ON `util`.* TO 'mycdc-producer'@'%';
|
GRANT INSERT, DELETE ON `util`.* TO 'mycdc-producer'@'%';
|
||||||
|
|
||||||
|
CREATE USER 'mycdc-producer'@'%' IDENTIFIED BY 'P4$$w0rd';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mycdc",
|
"name": "mycdc",
|
||||||
"version": "0.0.25",
|
"version": "0.0.24",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Asynchronous DB calculations reading the binary log",
|
"description": "Asynchronous DB calculations reading the binary log",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
query:
|
||||||
|
sale: CALL vn.sale_setWarningTicketWeekly(:id)
|
||||||
|
includeSchema:
|
||||||
|
vn:
|
||||||
|
saleCloned:
|
||||||
|
key: saleClonedFk
|
||||||
|
scope: sale
|
||||||
|
columns:
|
||||||
|
- saleClonedFk
|
|
@ -0,0 +1,16 @@
|
||||||
|
query:
|
||||||
|
sale: CALL vn.sale_setWarningDumping(:id)
|
||||||
|
includeSchema:
|
||||||
|
vn:
|
||||||
|
sale:
|
||||||
|
key: id
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
saleComponent:
|
||||||
|
key: saleFk
|
||||||
|
scope: sale
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- saleFk
|
||||||
|
- value
|
||||||
|
- componentFk
|
|
@ -0,0 +1,16 @@
|
||||||
|
query:
|
||||||
|
sale: CALL vn.sale_setWarningFragile(:id)
|
||||||
|
item: CALL vn.sale_setWarningFragileByItemFk(:id)
|
||||||
|
includeSchema:
|
||||||
|
vn:
|
||||||
|
sale:
|
||||||
|
key: id
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- itemFk
|
||||||
|
item:
|
||||||
|
key: id
|
||||||
|
scope: item
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- isFragile
|
|
@ -0,0 +1,16 @@
|
||||||
|
query:
|
||||||
|
sale: CALL vn.sale_setWarningToxic(:id)
|
||||||
|
item: CALL vn.sale_setWarningToxicByItemFk(:id)
|
||||||
|
includeSchema:
|
||||||
|
vn:
|
||||||
|
sale:
|
||||||
|
key: id
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- itemFk
|
||||||
|
item:
|
||||||
|
key: id
|
||||||
|
scope: item
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- isToxic
|
|
@ -1,81 +0,0 @@
|
||||||
query:
|
|
||||||
travel: CALL stock.buyOut_refreshBuy('travel', :id)
|
|
||||||
entry: CALL stock.buyOut_refreshBuy('entry', :id)
|
|
||||||
buy: CALL stock.buyOut_refreshBuy('lot', :id)
|
|
||||||
ticket: CALL stock.buyOut_refreshSale('ticket', :id)
|
|
||||||
sale: CALL stock.buyOut_refreshSale('lot', :id)
|
|
||||||
order: CALL stock.buyOut_refreshOrder('order', :id)
|
|
||||||
orderRow: CALL stock.buyOut_refreshOrder('lot', :id)
|
|
||||||
includeSchema:
|
|
||||||
vn:
|
|
||||||
travel:
|
|
||||||
key: id
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- landed
|
|
||||||
- shipped
|
|
||||||
- landingHour
|
|
||||||
- warehouseInFk
|
|
||||||
- warehouseOutFk
|
|
||||||
- isReceived
|
|
||||||
- isRaid
|
|
||||||
events:
|
|
||||||
- updaterows
|
|
||||||
entry:
|
|
||||||
key: id
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- travelFk
|
|
||||||
events:
|
|
||||||
- updaterows
|
|
||||||
buy:
|
|
||||||
key: lotFk
|
|
||||||
columns:
|
|
||||||
- lotFk
|
|
||||||
- entryFk
|
|
||||||
- itemFk
|
|
||||||
- quantity
|
|
||||||
- life
|
|
||||||
- isAlive
|
|
||||||
ticket:
|
|
||||||
key: id
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- warehouseFk
|
|
||||||
- shipped
|
|
||||||
- landed
|
|
||||||
- isAlive
|
|
||||||
events:
|
|
||||||
- updaterows
|
|
||||||
sale:
|
|
||||||
key: lotFk
|
|
||||||
columns:
|
|
||||||
- lotFk
|
|
||||||
- ticketFk
|
|
||||||
- itemFk
|
|
||||||
- quantity
|
|
||||||
- created
|
|
||||||
- isPicked
|
|
||||||
hedera:
|
|
||||||
order:
|
|
||||||
key: id
|
|
||||||
columns:
|
|
||||||
- id
|
|
||||||
- date_send
|
|
||||||
- address_id
|
|
||||||
- company_id
|
|
||||||
- customer_id
|
|
||||||
- confirmed
|
|
||||||
events:
|
|
||||||
- updaterows
|
|
||||||
orderRow:
|
|
||||||
key: lotFk
|
|
||||||
columns:
|
|
||||||
- lotFk
|
|
||||||
- orderFk
|
|
||||||
- itemFk
|
|
||||||
- warehouseFk
|
|
||||||
- shipment
|
|
||||||
- amount
|
|
||||||
- created
|
|
||||||
- isReserved
|
|
Loading…
Reference in New Issue