From 6a113699ad791c16bcc4b95c57346ea9735c554e Mon Sep 17 00:00:00 2001 From: Amber Date: Sun, 4 Sep 2022 00:51:48 -0400 Subject: [PATCH] Fix --- Jenkinsfile | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 15b9dec..fbc058e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,18 +61,26 @@ pipeline { } } stage('Deploy') { - script { - withCredentials([usernamePassword( - credentialsId: env.CREDENTIALS_ID, - usernameVariable: 'API_TOKEN_USER', - passwordVariable: 'API_TOKEN_PASS' - )]) { - sh ''' - curl -H 'Authorization: Bearer $API_TOKEN_PASS' -H 'Content-Type: application/json' \ - -X POST 'https://api.digitalocean.com/v2/apps/$APP_ID/deployments' - -d '{ "force_build" : true }' - ''' + agent { + label 'main' + } + // when { + // branch 'main' + // } + steps { + script { + withCredentials([usernamePassword( + credentialsId: env.CREDENTIALS_ID, + usernameVariable: 'API_TOKEN_USER', + passwordVariable: 'API_TOKEN_PASS' + )]) { + sh ''' + curl -H 'Authorization: Bearer $API_TOKEN_PASS' -H 'Content-Type: application/json' \ + -X POST 'https://api.digitalocean.com/v2/apps/$APP_ID/deployments' + -d '{ "force_build" : true }' + ''' } + } } } }