Compare commits

...

15 Commits

Author SHA1 Message Date
Juan Ferrer 00b6f8cc6e Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/mycdc into dev
gitea/mycdc/pipeline/head This commit looks good Details
2025-02-26 18:38:16 +01:00
Juan Ferrer 9a45cf3baf refs #4685 Jenkinsfile empty line removed 2025-02-26 18:35:04 +01:00
Juan Ferrer 8b64744e73 Merge pull request 'test' (!9) from test into dev
gitea/mycdc/pipeline/head This commit looks good Details
Reviewed-on: #9
2025-02-26 17:19:27 +00:00
Juan Ferrer 19489da545 Merge pull request 'refs #4685 Jenkinsfile deploy branch fix' (!8) from master into test
gitea/mycdc/pipeline/head This commit looks good Details
gitea/mycdc/pipeline/pr-dev Build started... Details
Reviewed-on: #8
2025-02-26 17:19:02 +00:00
Juan Ferrer 893c099ea2 refs #4685 Jenkinsfile deploy branch fix
gitea/mycdc/pipeline/head This commit looks good Details
gitea/mycdc/pipeline/pr-test Build queued... Details
2025-02-26 18:18:32 +01:00
Juan Ferrer 9c3cdd8ccc refs #4685 Jenkinsfile kubernetes ns fix
gitea/mycdc/pipeline/head This commit looks good Details
2025-02-26 17:56:00 +01:00
Juan Ferrer 25aec35f0c refs #4685 Jenkinsfile variable fix
gitea/mycdc/pipeline/head This commit looks good Details
2025-02-26 17:13:39 +01:00
Juan Ferrer a1bdcf4fae Merge pull request 'feat: refs #4409 Available by lot using CDC' (!7) from 4685-available into master
gitea/mycdc/pipeline/head There was a failure building this commit Details
Reviewed-on: #7
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2025-02-26 16:08:13 +00:00
Juan Ferrer 04f256a936 Merge branch 'master' into 4685-available
gitea/mycdc/pipeline/pr-master This commit looks good Details
2025-02-26 17:07:24 +01:00
Juan Ferrer 7a8a7fe4d1 refs #4685 Jenkinsfile improved for branch deploy
gitea/mycdc/pipeline/pr-master There was a failure building this commit Details
2025-02-26 17:06:54 +01:00
Juan Ferrer 6e8ea95e53 refs #4685 Added ticket.isAlive, orderRow.isReserved
gitea/mycdc/pipeline/pr-master There was a failure building this commit Details
2025-02-25 18:08:07 +01:00
Juan Ferrer 831305ad30 refs #4685 Version increased
gitea/mycdc/pipeline/pr-master There was a failure building this commit Details
2025-02-25 13:30:35 +01:00
Juan Ferrer 2ed53e5ea0 refs #4685 Column fixes
gitea/mycdc/pipeline/pr-master There was a failure building this commit Details
2025-02-25 09:39:09 +01:00
Juan Ferrer deeaeb058a refs #4685 Alpha version
gitea/mycdc/pipeline/pr-master There was a failure building this commit Details
2025-02-24 18:51:10 +01:00
Juan Ferrer 9f960c2820 refs #4685 First working version 2024-08-12 11:55:15 +02:00
5 changed files with 159 additions and 16 deletions

96
Jenkinsfile vendored
View File

@ -1,33 +1,80 @@
#!/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 {
agent any
options {
disableConcurrentBuilds()
}
stages {
stage('Version') {
when {
expression { PROTECTED_BRANCH }
}
steps {
script {
def packageJson = readJSON file: 'package.json'
def version = "${packageJson.version}-build${env.BUILD_ID}"
writeFile(file: 'VERSION.txt', text: version)
echo "VERSION: ${version}"
}
}
}
stage('Build') {
when {branch 'master'}
steps {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
when {
expression { PROTECTED_BRANCH }
}
sh 'docker-compose build --build-arg BUILD_ID=$BUILD_ID --parallel'
}
}
stage('Push') {
when {branch 'master'}
environment {
CREDENTIALS = credentials('docker-registry')
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 {
script {
def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version
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'
}
}
}
@ -38,3 +85,20 @@ 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')
}
}

View File

@ -9,5 +9,3 @@ CREATE TABLE `util`.`binlogQueue`(
CREATE USER 'mycdc-producer'@'%' IDENTIFIED BY 'P4$$w0rd';
GRANT REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON *.* TO 'mycdc-producer'@'%';
GRANT INSERT, DELETE ON `util`.* TO 'mycdc-producer'@'%';
CREATE USER 'mycdc-producer'@'%' IDENTIFIED BY 'P4$$w0rd';

View File

@ -1,6 +1,6 @@
{
"name": "mycdc",
"version": "0.0.24",
"version": "0.0.25",
"author": "Verdnatura Levante SL",
"description": "Asynchronous DB calculations reading the binary log",
"license": "GPL-3.0",

81
queues/stock.yml Normal file
View File

@ -0,0 +1,81 @@
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