forked from Azure-Samples/piggymetrics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
25 lines (25 loc) · 1.08 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
node {
stage('init') {
checkout scm
}
stage('build') {
sh 'mvn clean package'
}
stage('deploy') {
withCredentials([azureServicePrincipal('46955a07-4db2-4f3c-ba5c-1a0d7ab973ff')]) {
// login to Azure
sh '''
az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_CLIENT_SECRET -t $AZURE_TENANT_ID
az account set -s $AZURE_SUBSCRIPTION_ID
'''
// Set default resource group name and service name. Replace <resource group name> and <service name> with the right values
sh 'az configure --defaults group=springrg'
sh 'az configure --defaults spring-cloud=springservice'
// Deploy applications
sh 'az spring-cloud app deploy -n gateway --jar-path ./gateway/target/gateway.jar'
sh 'az spring-cloud app deploy -n account-service --jar-path ./account-service/target/account-service.jar'
sh 'az spring-cloud app deploy -n auth-service --jar-path ./auth-service/target/auth-service.jar'
sh 'az logout'
}
}
}