Update firmador intern services

This commit is contained in:
Duvan Rondon 2025-02-24 16:28:02 -05:00
parent 5a4868b397
commit 531c3c11e8
4 changed files with 118 additions and 18 deletions

89
Jenkinsfile firm int Normal file
View File

@ -0,0 +1,89 @@
pipeline {
agent any
environment {
CLOUDSDK_CORE_PROJECT = 'siman-448015'
REGION = "us-central1"
CLIENT_EMAIL = 'svfe-api-firmador@siman-448015.iam.gserviceaccount.com'
GCLOUD_CREDS = credentials('gcloud-creds')
CLOUD_RUN_FIRMADOR = 'http://localhost:8013'
}
stages {
stage('Clonar Repositorio') {
steps {
git credentialsId: 'token_gitea',
url: 'https://gitea.grupoconsiti.com/duvan_andres/prueba.git',
branch: 'main'
}
}
stage('Authenticate') {
steps {
withCredentials([file(credentialsId: 'gcloud-creds', variable: 'GCLOUD_CREDS')]) {
sh 'gcloud auth activate-service-account --key-file="$GCLOUD_CREDS"'
}
}
}
stage('Envs about Firmador') {
steps {
sh '''
sed -i "s|SERVICE_FIRMADOR_URL|${CLOUD_RUN_FIRMADOR}|g" **.yml
cat service-nest.yml
'''
}
}
stage('Deploy to Cloud Run Nest and Spring') {
steps {
script {
def outputNest = sh(script: "gcloud run services replace service-nest.yml --platform=managed --region=${REGION} 2>&1", returnStdout: true).trim()
def outputSpring = sh(script: "gcloud run services replace service-spring.yml --platform=managed --region=${REGION} 2>&1", returnStdout: true).trim()
def cloudRunUrlMatchNest = outputNest =~ /URL:\s+(https:\/\/[^\s]+)/
def cloudRunUrlMatchLotes = outputSpring =~ /URL:\s+(https:\/\/[^\s]+)/
if (cloudRunUrlMatchNest) {
env.CLOUD_RUN_NEST = cloudRunUrlMatchNest[0][1]
}
if (cloudRunUrlMatchLotes) {
env.CLOUD_RUN_LOTES = cloudRunUrlMatchLotes[0][1]
}
}
}
}
stage('Envs about Nest and Spring') {
steps {
sh '''
sed -i "s|SERVICE_NEST_URL|${CLOUD_RUN_NEST}|g" **.yml
sed -i "s|SERVICE_LOTES_URL|${CLOUD_RUN_LOTES}|g" **.yml
cat service-api-gateway.yml
'''
}
}
stage('Deploy Api Gateway') {
steps {
sh '''
gcloud run services replace service-api-gateway.yml --platform='managed' --region='us-central1'
'''
}
}
stage('Allow allUsers') {
steps {
sh '''
gcloud run services add-iam-policy-binding cbii-apigateway-jenkins --region='us-central1' --member='allUsers' --role='roles/run.invoker'
'''
}
}
}
post {
always {
sh 'gcloud auth revoke $CLIENT_EMAIL'
}
}
}

View File

@ -101,12 +101,29 @@ spec:
key: '1'
name: ENVIRONMENT
volumeMounts:
- name: templates_cbii
mountPath: /app/src/templates
volumes:
- name: templates_cbii
csi:
driver: gcsfuse.run.googleapis.com
readOnly: true
volumeAttributes:
bucketName: templates_cbii
mountPath: /app/src/templates
- name: svfe-api-firmador-1
image: svfe/svfe-api-firmador:v20230109
resources:
limits:
cpu: 500m
memory: 256Mi
volumeMounts:
- name: certifados
mountPath: /uploads
volumes:
- name: certifados
csi:
driver: gcsfuse.run.googleapis.com
readOnly: true
volumeAttributes:
bucketName: certifados_prod
- name: templates_cbii
csi:
driver: gcsfuse.run.googleapis.com
readOnly: true
volumeAttributes:
bucketName: templates_cbii

View File

@ -60,12 +60,13 @@ spec:
secretKeyRef:
key: '1'
name: CRYPTO_NEST_DEV
- name: svfe-api-firmador-1
image: svfe/svfe-api-firmador:v20230109
resources:
limits:
cpu: 1000m
memory: 512Mi
cpu: 500m
memory: 256Mi
volumeMounts:
- name: certifados
mountPath: /uploads
@ -75,11 +76,4 @@ spec:
driver: gcsfuse.run.googleapis.com
readOnly: true
volumeAttributes:
bucketName: certifados_prod
- name: templates
csi:
driver: gcsfuse.run.googleapis.com
readOnly: true
volumeAttributes:
bucketName: templates
bucketName: certifados_prod