I want to create a Jenkins job which deploys Helm chart into Kubernetes cluster. Helm charts are stored into Bitbucket repository.
pipeline {
agent any
stages {
stage('Download Helm Charts') {
steps {
sh "echo 'Downloading Helm Charts from Bitbucket repository...'"
git checkout http://192.168.1.30:7990/scm/jen/helm.git
// not sure do I need ot point the root folder of the Helm repository or only the single chart
}
}
stage('Test Kubernetes version') {
steps {
sh "echo 'Checking Kubernetes version..'"
// How to do remote test of kubernetes version
}
}
stage('Push Helm Charts to Kubernetes') {
steps {
sh "echo 'building..'"
// push here helm chart from Jenkins server to Kubernetes cluster
}
}
stage('Build Image') {
steps {
sh "echo 'building..'"
git checkout http://192.168.1.30:7990/scm/jen/spring-boot-microservice.git
// execute Java -jar ... and build docker image
}
}
stage('Push Image into Nexus registry') {
steps {
sh "echo 'building..'"
// push compiled docker image into Nexus repository
}
}
stage('Deploy Image from Nexus registry into Kubernetes') {
steps {
sh "echo 'building..'"
}
}
stage('Test'){
steps {
sh "echo 'Testing...'"
// implement a check here is it deployed sucessfully
}
}
}
}
What configuration I need to add into this Jenkins file in order to download Heml chart repository from bitbucket and apply the configuration into Kubernetes cluster? Can you give me an example for such a Jenkins file?