diff --git a/Jenkinsfile b/Jenkinsfile
index a2df42b1..eb728f42 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,30 +1,29 @@
pipeline{
- agent any
- environment{
+ agent any
+ environment {
VERSION = "${env.BUILD_ID}"
}
stages{
stage("sonar quality check"){
agent {
- docker {
+ docker{
image 'openjdk:11'
}
}
steps{
script{
withSonarQubeEnv(credentialsId: 'sonar-token') {
- sh 'chmod +x gradlew'
- sh './gradlew sonarqube'
+ 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}"
- }
+ timeout(7) {
+ def qg = waitForQualityGate()
+ if(qg.status != 'OK'){
+ error "Pipeline aborted due to quality gate failure: ${qg.status}"
+ }
}
+ }
- }
}
}
stage("docker build & docker push"){
@@ -32,27 +31,27 @@ pipeline{
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}
+ docker build -t 34.125.93.147:8083/springapp:${VERSION} .
+ docker login -u admin -p $docker_password 34.125.93.147:8083
+ docker push 34.125.93.147:8083/springapp:${VERSION}
+ docker rmi 34.125.93.147:8083/springapp:${VERSION}
'''
}
}
}
}
- stage('indentifying misconfigs using datree in helm charts'){
+ stage("indentifying misconfigs using datree in helm charts"){
steps{
script{
-
- dir('kubernetes/') {
- withEnv(['DATREE_TOKEN=GJdx2cP2TCDyUY3EhQKgTc']) {
+ dir('kubernetes/') {
+ withEnv(['DATREE_TOKEN=abd14242-b27a-4b93-b288-628a22413751']) {
sh 'helm datree test myapp/'
}
}
}
}
}
+
stage("pushing the helm charts to nexus"){
steps{
script{
@@ -61,7 +60,7 @@ pipeline{
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
+ curl -u admin:$docker_password http://34.125.93.147:8081/repository/helm-hosted/ --upload-file myapp-${helmversion}.tgz -v
'''
}
}
@@ -73,19 +72,19 @@ pipeline{
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')
+ 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: "tamagni2002@yahoo.fr";
+ input(message: "Deploy ${params.project_name}?", ok: "Deploy")
}
}
}
}
- stage('Deploying application on k8s cluster') {
+ stage('Deploying application xxx on k8s cluster') {
steps {
script{
- withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) {
+ withCredentials([kubeconfigContent(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG_CONTENT')]) {
dir('kubernetes/') {
- sh 'helm upgrade --install --set image.repository="34.125.214.226:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ '
+ sh 'helm upgrade --install --set image.repository="34.125.93.147:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ '
}
}
}
@@ -102,11 +101,11 @@ pipeline{
}
}
}
- }
-
+ }
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";
- }
- }
+ 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: "tamagni2021@gmail.com";
+ }
+ }
}
+
diff --git a/Jenkinsfile1 b/Jenkinsfile1
new file mode 100644
index 00000000..30480d89
--- /dev/null
+++ b/Jenkinsfile1
@@ -0,0 +1,112 @@
+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.93.147: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";
+ }
+ }
+}
diff --git a/bin/main/application.properties b/bin/main/application.properties
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/bin/main/application.properties
@@ -0,0 +1 @@
+
diff --git a/bin/main/com/example/controller/HomeController.class b/bin/main/com/example/controller/HomeController.class
new file mode 100644
index 00000000..f89b6354
Binary files /dev/null and b/bin/main/com/example/controller/HomeController.class differ
diff --git a/bin/main/com/example/demo/SampleWebApplication.class b/bin/main/com/example/demo/SampleWebApplication.class
new file mode 100644
index 00000000..ae4f25be
Binary files /dev/null and b/bin/main/com/example/demo/SampleWebApplication.class differ
diff --git a/bin/main/com/example/demo/ServletInitializer.class b/bin/main/com/example/demo/ServletInitializer.class
new file mode 100644
index 00000000..4699b6ae
Binary files /dev/null and b/bin/main/com/example/demo/ServletInitializer.class differ
diff --git a/bin/main/templates/index.html b/bin/main/templates/index.html
new file mode 100644
index 00000000..414eacf6
--- /dev/null
+++ b/bin/main/templates/index.html
@@ -0,0 +1,243 @@
+
+
+