From 755a5bf2d0480253378f4c55838611a9ab0c7ea4 Mon Sep 17 00:00:00 2001 From: jose-rZM <100773386+jose-rZM@users.noreply.github.com> Date: Thu, 18 Dec 2025 11:11:25 +0100 Subject: [PATCH] Update jenkinsfile using credentials --- Jenkinsfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index eda257a..11c0851 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -164,7 +164,18 @@ pipeline { stage('Deploy frontend & backend') { agent any + environment { + JENKINS_BASE_URL = 'http://jenkins:8080' + JENKINS_JOB_NAME = 'Espetos' + } steps { + withCredentials([ + usernamePassword( + cretentialsId: 'jenkins-api-token', + usernameVariable: 'JENKINS_USER', + passwordVariable: 'JENKINS_TOKEN' + ) + ]) { sh ''' set -e @@ -175,6 +186,10 @@ pipeline { docker run -d \ --name cafeteria-backend \ + -e JENKINS_BASE_URL \ + -e JENKINS_JOB_NAME \ + -e JENKINS_USER \ + -e JENKINS_TOKEN \ -p 8000:8000 \ cafeteria-backend:${BUILD_NUMBER} @@ -184,6 +199,7 @@ pipeline { cafeteria-frontend:${BUILD_NUMBER} ''' } + } } }