Skip to content

Commit

Permalink
updated JJenkinsfile for enterprise use cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Amits64 committed Aug 20, 2024
1 parent fc24098 commit cc2da81
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@Library('shared-pipeline-lib') _

pipeline {
agent any

Expand All @@ -13,11 +11,21 @@ pipeline {
registry = 'amits64'
registryCredential = 'dockerhub'
image = 'crud-app'
tag = "${params.IMAGE_TAG}" // Use IMAGE_TAG parameter
tag = "v${env.BUILD_NUMBER}" // Use the Jenkins build number
kubeConfigPath = "/etc/kubernetes/${params.ENVIRONMENT}/config" // Adjusted for dynamic environment
}

stages {
stage('Verify Kubernetes Config') {
steps {
script {
// Debug steps to verify the Kubernetes configuration file
sh "ls -la /etc/kubernetes/${params.ENVIRONMENT}"
sh "cat /etc/kubernetes/${params.ENVIRONMENT}/config"
}
}
}

stage('Deploying Container to Kubernetes') {
steps {
script {
Expand All @@ -35,7 +43,7 @@ pipeline {
sh """
helm upgrade --install ${image} ./ \
--kubeconfig ${kubeConfigPath} \
--set appimage=${registry}/${image}:v${tag} \
--set appimage=${registry}/${image}:${tag} \
--namespace ${params.NAMESPACE}
"""
}
Expand Down

0 comments on commit cc2da81

Please sign in to comment.