Skip to content

Instantly share code, notes, and snippets.

@afaniuolo
Created February 25, 2021 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save afaniuolo/89df71ba4129341fdf3654b73e754a32 to your computer and use it in GitHub Desktop.
Save afaniuolo/89df71ba4129341fdf3654b73e754a32 to your computer and use it in GitHub Desktop.
Jenkins Build Pipeline for Sitecore 10 on AKS
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