Update jenkinsfile using credentials
This commit is contained in:
16
Jenkinsfile
vendored
16
Jenkinsfile
vendored
@@ -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}
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user