forked from VSChina/odd-or-even-function
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsFile
28 lines (26 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
26
27
28
node {
withEnv(['AZURE_SUBSCRIPTION_ID=99999999-9999-9999-9999-999999999999',
'AZURE_TENANT_ID=99999999-9999-9999-9999-999999999999']) {
stage('Init') {
cleanWs()
checkout scm
}
stage('Build') {
sh 'mvn clean package'
}
stage('Publish') {
def RESOURCE_GROUP = '<resource_group>'
def FUNC_NAME = '<function_app>'
// login Azure
withCredentials([usernamePassword(credentialsId: 'azuresp', 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
'''
}
sh 'cd $PWD/target/azure-functions/odd-or-even-function-sample && zip -r ../../../archive.zip ./* && cd -'
sh "az functionapp deployment source config-zip -g $RESOURCE_GROUP -n $FUNC_NAME --src archive.zip"
sh 'az logout'
}
}
}