diff --git a/Jenkinsfile b/Jenkinsfile index bb4b4b52..eff84472 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,8 +8,8 @@ def getFtpPublishProfile(def publishProfilesJson) { } node { - withEnv(['AZURE_SUBSCRIPTION_ID=', - 'AZURE_TENANT_ID=']) { + withEnv(['AZURE_SUBSCRIPTION_ID=1e17107d-712a-4330-96e3-1e7913623cd6', + 'AZURE_TENANT_ID=37a284fe-ec11-47ca-9bc3-e4bcd2546f28']) { stage('init') { checkout scm } @@ -19,10 +19,10 @@ node { } stage('deploy') { - def resourceGroup = '' - def webAppName = '' + def resourceGroup = 'jenkins-get-started-rg’' + def webAppName = 'Peiwen' // login Azure - withCredentials([usernamePassword(credentialsId: '', passwordVariable: 'AZURE_CLIENT_SECRET', usernameVariable: 'AZURE_CLIENT_ID')]) { + withCredentials([usernamePassword(credentialsId: 'AzureServicePrincipal', passwordVariable: 'AZURE_CLIENT_SECRET', usernameVariable: 'AZURE_CLIENT_ID')]) { sh ''' az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_CLIENT_SECRET -t $AZURE_TENANT_ID az account set -s $AZURE_SUBSCRIPTION_ID @@ -32,7 +32,7 @@ node { def pubProfilesJson = sh script: "az webapp deployment list-publishing-profiles -g $resourceGroup -n $webAppName", returnStdout: true def ftpProfile = getFtpPublishProfile pubProfilesJson // upload package - sh "curl -T target/calculator-1.0.war $ftpProfile.url/webapps/ROOT.war -u '$ftpProfile.username:$ftpProfile.password'" + sh “az webapp deploy --resource-group jenkins-get-started-rg --name Peiwen --src-path target/calculator-1.0.war --type war” // log out sh 'az logout' }