From e384b72c574781bbf659d99df836b79ec46f463a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20V=C3=A1squez?= Date: Mon, 6 Oct 2025 17:20:24 -0300 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e0b3275..495c959 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,26 +2,44 @@ pipeline { agent any environment { - IMAGE_NAME = 'test-img' - DOCKERHUB_USER = 'ramonvasquezliesa' - DOCKERHUB_REPO = "${DOCKERHUB_USER}/${IMAGE_NAME}" - TAG = 'latest' + IMAGE_NAME = 'rd.jenkins' + AWS_USER = 'liesa' + AWS_REPO = "${AWS_USER}/${IMAGE_NAME}" + AWS_URL = '231670719202.dkr.ecr.sa-east-1.amazonaws.com' + TAG = 'latest' } stages { + stage('Checkout (with submodules)') { + steps { + checkout(scmGit( + branches: [[name: '*/main']], + userRemoteConfigs: [[ + url: 'https://stalked-noegenetic-amari.ngrok-free.dev/hermes/pl-1.git', + credentialsId: 'hermes-forgejo-local' + ]] + )) + } + } + stage('Build Image') { steps { script { - docker.build("${DOCKERHUB_REPO}:${TAG}", '-f Dockerfile .') + docker.build("${AWS_REPO}:${TAG}", '-f Dockerfile .') } } } stage('Push Image') { steps { + sh ''' + set -eu pipefail + aws ecr get-login-password --region sa-east-1 | docker login --username AWS --password-stdin $AWS_URL + ''' + script { - docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-credentials') { - docker.image("${DOCKERHUB_REPO}:${TAG}").push() + docker.withRegistry("http://${AWS_URL}", 'ecr:sa-east-1:aws-prod') { + docker.image("${AWS_REPO}:${TAG}").push() } } }