Jenkins Build Pipeline for Sitecore 10 on AKS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
parameters { | |
string(name: 'Environment', defaultValue: 'develop', description: 'Environment/Branch name') | |
} | |
environment { | |
REGISTRY = 'myacrregistry.azurecr.io/' | |
GIT_REPO_URL = 'https://github.com/afaniuolo/docker-examples.git' | |
VERSION = "${env.BUILD_NUMBER}-${params.Environment}" | |
COMPOSE_PROJECT_NAME = "mycustomsolution" | |
PRINCIPAL_SERVICE_CREDENTIAL_ID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | |
} | |
stages { | |
stage('Checkout') { | |
steps { | |
checkout([$class: 'GitSCM', branches: [[name: '*/' + params.Environment]], extensions: [], userRemoteConfigs: [[url: GIT_REPO_URL]]]) | |
} | |
} | |
stage('Build Images') { | |
steps { | |
script { | |
dir('custom-images') { | |
bat "docker-compose -f .\\docker-compose.xm1.yml -f .\\docker-compose.xm1.override.yml build" | |
} | |
} | |
} | |
} | |
stage('Push Images to ACR') { | |
steps { | |
script { | |
dir('custom-images') { | |
azureCLI commands: [[exportVariablesString: '', script: 'az acr login --name ' + REGISTRY]], principalCredentialId: PRINCIPAL_SERVICE_CREDENTIAL_ID | |
bat "docker-compose -f .\\docker-compose.xm1.yml -f .\\docker-compose.xm1.override.yml push" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment