Update jenkinsfile using credentials

This commit is contained in:
2025-12-18 11:11:25 +01:00
parent d65a5d988a
commit 873db4f4e8

16
Jenkinsfile vendored
View File

@@ -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}
@@ -186,6 +201,7 @@ pipeline {
}
}
}
}
post {
always {