Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created July 1, 2020 15:04
Show Gist options
  • Save velotiotech/c5372679bbc8555ca1bd747603030b31 to your computer and use it in GitHub Desktop.
Save velotiotech/c5372679bbc8555ca1bd747603030b31 to your computer and use it in GitHub Desktop.
node {      
// Mark the code checkout 'stage'....        
stage('Checkout the dockefile from GitHub') {            
git branch: 'docker-file', credentialsId: 'git_credentials', url: 'https://gitlab.com/demo.git'        
}        
// Build and Deploy to ACR 'stage'...        
stage('Build the Image and Push to Azure Container Registry') {                
app = docker.build('testacr.azurecr.io/demo')                
withDockerRegistry([credentialsId: 'acr_credentials', url: 'https://testacr.azurecr.io']) {                
app.push("${env.BUILD_NUMBER}")                
app.push('latest')                
}        
}        
stage('Build the Kubernetes YAML Files for New App') {
<The code here will differ depending on the YAMLs used for the application>        
}        
stage('Delpoying the App on Azure Kubernetes Service') {            
app = docker.image('testacr.azurecr.io/demo:latest')            
withDockerRegistry([credentialsId: 'acr_credentials', url: 'https://testacr.azurecr.io']) {            
app.pull()            
sh "kubectl create -f ."            
}      
}    
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment