updated terraform files
This commit is contained in:
57
Jenkinsfile
vendored
Normal file
57
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
ACR_NAME = "demoacr"
|
||||
IMAGE_TAG = "${ACR_NAME}.azurecr.io/skennen:${env.BUILD_NUMBER}"
|
||||
RG_NAME = "Prod-Native-American-Empires"
|
||||
ACA_NAME = "skennen"
|
||||
AZ_SUB_ID = "1d363cb6-5669-42c2-98d3-5b9a1604b797"
|
||||
TENANT_ID = "your-tenant-id"
|
||||
CLIENT_ID = credentials('azure-sp-client-id')
|
||||
CLIENT_SECRET = credentials('azure-sp-client-secret')
|
||||
ACR_USERNAME = credentials('acr-username')
|
||||
ACR_PASSWORD = credentials('acr-password')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Image') {
|
||||
steps {
|
||||
sh "docker build -t ${IMAGE_TAG} ."
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push Image') {
|
||||
steps {
|
||||
sh '''
|
||||
echo ${ACR_PASSWORD} | docker login ${ACR_NAME}.azurecr.io --username ${ACR_USERNAME} --password-stdin
|
||||
docker push ${IMAGE_TAG}
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy to Azure Container App') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'azure-sp', passwordVariable: 'AZ_PASS', usernameVariable: 'AZ_USER')]) {
|
||||
sh '''
|
||||
az login --service-principal -u $CLIENT_ID -p $CLIENT_SECRET --tenant $TENANT_ID
|
||||
az account set --subscription $AZ_SUB_ID
|
||||
az containerapp update --name $ACA_NAME --resource-group $RG_NAME --image $IMAGE_TAG --revision-suffix build-${BUILD_NUMBER}
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user