From 8ee98f6e5cd5a3a20af9abe683186592d06b4baf Mon Sep 17 00:00:00 2001 From: Manoj Nagarale Date: Mon, 7 Aug 2023 10:26:11 +0000 Subject: [PATCH 1/3] test --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93676f58..76f0cb07 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ This application is java spring boot web application -build tool is ** gradle ** +build tool is *** gradle ** when we build the code using command ```./gradlew build ``` it will generate war file. that war can be placed in tomcat server to see application web page code is integrated with sonarqube plugin which help us in static code analysis -``` ./gradlew sonarqube ``` \ No newline at end of file +``` ./gradlew sonarqube ``` From 059cd91b31162dd1f645a81472bb28d940b5af90 Mon Sep 17 00:00:00 2001 From: Manoj Nagarale Date: Mon, 7 Aug 2023 10:29:07 +0000 Subject: [PATCH 2/3] test --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 76f0cb07..0c5a43e8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This application is java spring boot web application -build tool is *** gradle ** +build tool is *** gradle *** when we build the code using command ```./gradlew build ``` it will generate war file. that war can be placed in tomcat server to see application web page From 060c5d4afa270a6bc5a5d8b79524d23258e42a65 Mon Sep 17 00:00:00 2001 From: Manoj Nagarale Date: Mon, 7 Aug 2023 10:40:17 +0000 Subject: [PATCH 3/3] wq! --- Jenkinsfile | 112 ---------------------------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index a2df42b1..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,112 +0,0 @@ -pipeline{ - agent any - environment{ - VERSION = "${env.BUILD_ID}" - } - stages{ - stage("sonar quality check"){ - agent { - docker { - image 'openjdk:11' - } - } - steps{ - script{ - withSonarQubeEnv(credentialsId: 'sonar-token') { - sh 'chmod +x gradlew' - sh './gradlew sonarqube' - } - - timeout(time: 1, unit: 'HOURS') { - def qg = waitForQualityGate() - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - } - - } - } - } - stage("docker build & docker push"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - sh ''' - docker build -t 34.125.214.226:8083/springapp:${VERSION} . - docker login -u admin -p $docker_password 34.125.214.226:8083 - docker push 34.125.214.226:8083/springapp:${VERSION} - docker rmi 34.125.214.226:8083/springapp:${VERSION} - ''' - } - } - } - } - stage('indentifying misconfigs using datree in helm charts'){ - steps{ - script{ - - dir('kubernetes/') { - withEnv(['DATREE_TOKEN=GJdx2cP2TCDyUY3EhQKgTc']) { - sh 'helm datree test myapp/' - } - } - } - } - } - stage("pushing the helm charts to nexus"){ - steps{ - script{ - withCredentials([string(credentialsId: 'docker_pass', variable: 'docker_password')]) { - dir('kubernetes/') { - sh ''' - helmversion=$( helm show chart myapp | grep version | cut -d: -f 2 | tr -d ' ') - tar -czvf myapp-${helmversion}.tgz myapp/ - curl -u admin:$docker_password http://34.125.214.226:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v - ''' - } - } - } - } - } - - stage('manual approval'){ - steps{ - script{ - timeout(10) { - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
Go to build url and approve the deployment request
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "deekshith.snsep@gmail.com"; - input(id: "Deploy Gate", message: "Deploy ${params.project_name}?", ok: 'Deploy') - } - } - } - } - - stage('Deploying application on k8s cluster') { - steps { - script{ - withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { - dir('kubernetes/') { - sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ ' - } - } - } - } - } - - stage('verifying app deployment'){ - steps{ - script{ - withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) { - sh 'kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080' - - } - } - } - } - } - - post { - always { - mail bcc: '', body: "
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "${currentBuild.result} CI: Project name -> ${env.JOB_NAME}", to: "deekshith.snsep@gmail.com"; - } - } -}