Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a347937
Update ci.yml
DeekshithSN Nov 10, 2021
8ee5a1c
Update ci.yml
DeekshithSN Nov 10, 2021
c00b73e
Update ci.yml
DeekshithSN Nov 10, 2021
b4918f2
Create cicd.yaml
DeekshithSN Nov 11, 2021
47a7623
Delete cicd.yaml
DeekshithSN Nov 11, 2021
bb61be5
Create cicd.yml
DeekshithSN Nov 11, 2021
d8a7eb8
Update cicd.yml
DeekshithSN Nov 11, 2021
f538b9e
Update cicd.yml
DeekshithSN Nov 11, 2021
f82bb4c
Update cicd.yml
DeekshithSN Nov 11, 2021
5e96dd1
Update cicd.yml
DeekshithSN Nov 11, 2021
f3a0b91
Update cicd.yml
DeekshithSN Nov 11, 2021
80811c3
Update index.html
DeekshithSN Nov 11, 2021
f8c6a85
Merge pull request #9 from DeekshithSN/ui-page-change
DeekshithSN Nov 11, 2021
0abfbd8
Create JenkinsfileFilter
DeekshithSN Jan 9, 2022
b90adda
Update JenkinsfileFilter
DeekshithSN Jan 9, 2022
1116da7
Update JenkinsfileFilter
DeekshithSN Jan 9, 2022
54b2dac
Update JenkinsfileFilter
DeekshithSN Jan 9, 2022
90b584d
Update JenkinsfileFilter
DeekshithSN Jan 9, 2022
fbc2102
Create JenkinsfileSharedLibrary
DeekshithSN Jan 9, 2022
790abff
Update JenkinsfileSharedLibrary
DeekshithSN Jan 9, 2022
24540ab
Update JenkinsfileSharedLibrary
DeekshithSN Jan 9, 2022
182c34b
Update JenkinsfileFilter
DeekshithSN Jan 9, 2022
7e06c4f
Update JenkinsfileSharedLibrary
DeekshithSN Jan 9, 2022
c23240b
Update build.gradle
DeekshithSN Feb 21, 2022
a73124d
Create Jenkinsfile_demo
DeekshithSN Feb 21, 2022
0e48b55
Update Jenkinsfile_demo
DeekshithSN Feb 21, 2022
e138499
Update Jenkinsfile_demo
DeekshithSN Feb 21, 2022
b1ed917
Update index.html
DeekshithSN Feb 21, 2022
603a877
Update Jenkinsfile_demo
DeekshithSN Feb 22, 2022
8c617f8
Update Jenkinsfile_demo
DeekshithSN Feb 22, 2022
f584c8f
Update Jenkinsfile_demo
DeekshithSN Feb 22, 2022
07ffff3
Update Jenkinsfile_demo
DeekshithSN Feb 22, 2022
fc5eea6
Update Jenkinsfile_demo
DeekshithSN Feb 23, 2022
1c901c6
Update Jenkinsfile_demo
DeekshithSN Feb 23, 2022
393651f
Update Jenkinsfile_demo
DeekshithSN Feb 23, 2022
aeb8d97
Update Jenkinsfile_demo
DeekshithSN Feb 23, 2022
f0527aa
Create healthcheck.sh
DeekshithSN Feb 23, 2022
ba8bdbf
Update Jenkinsfile_demo
DeekshithSN Feb 23, 2022
638e768
Delete .github/workflows directory
devops-max Mar 14, 2022
1d9d79e
Create ci.yml
devops-max Mar 14, 2022
831c437
Update kube.yaml
devops-max Mar 14, 2022
f2b2730
Update kube.yaml
devops-max Mar 14, 2022
014c333
Update ci.yml
devops-max Mar 14, 2022
9b5792e
Update kube.yaml
devops-max Mar 14, 2022
bb90cf7
Merge branch 'main' into worflow-test
devops-max Mar 14, 2022
0215888
Update kube.yaml
devops-max Mar 14, 2022
d5ee620
Update kube.yaml
devops-max Mar 14, 2022
c0f4583
Update kube.yaml
devops-max Mar 14, 2022
4c5353c
Update README.md
devops-max Mar 16, 2022
e017594
Update kube.yaml
devops-max Mar 16, 2022
344664d
Update kube.yaml
devops-max Mar 16, 2022
ba40180
Update kube.yaml
devops-max Mar 16, 2022
4ad2d62
Update kube.yaml
devops-max Mar 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build

- name: Install Datree
run: curl https://get.datree.io | /bin/bash
- name: Run Datree's policy check
run: datree test kube.yaml
23 changes: 23 additions & 0 deletions JenkinsfileFilter
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pipeline {
agent {
docker {
image 'openjdk:11'
}
}

stages {
stage('Building') {
steps {
sh 'chmod +x gradlew'
sh "./gradlew build | tee output.log"
}
}
stage('Monitoring the logs') {
steps {
script {
sh '! grep "Task" output.log'
}
}
}
}
}
26 changes: 26 additions & 0 deletions JenkinsfileSharedLibrary
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env groovy

@Library('shared-library@master') _ //master or whatever branch


pipeline {
agent {
docker {
image 'openjdk:11'
}
}

stages {
stage('Building') {
steps {
sh 'chmod +x gradlew'
sh "./gradlew build "
}
}
stage ('Check logs') {
steps {
filterLogs ('Task', 15)
}
}
}
}
96 changes: 96 additions & 0 deletions Jenkinsfile_demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
pipeline{
agent any
environment{
VERSION = "${env.BUILD_ID}"
}
stages{
stage("sonar qube analysis"){
agent{
docker {
image 'openjdk:11'
}
}
steps{
script{
withSonarQubeEnv(credentialsId: 'sonar-token-test') {
sh '''
chmod +x gradlew
./gradlew sonarqube
'''
}

timeout(5) {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
}

stage("building docker image and pushing it to nexus"){
steps{
script{

withCredentials([string(credentialsId: 'nexus_pass', variable: 'docker_pass')]) {
sh '''

docker build -t 34.125.203.155:8083/springapp:${VERSION} .
docker login -u admin -p $docker_pass 34.125.203.155:8083
docker push 34.125.203.155:8083/springapp:${VERSION}
docker rmi 34.125.203.155:8083/springapp:${VERSION}
docker image prune -f
'''
}
}
}
}


stage('manual approval'){
steps{
script{
timeout(10) {
mail bcc: '', body: "<br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> Go to build url and approve the deployment request <br> 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.203.155:8083/springapp" --set image.tag="${VERSION}" myjavaapp myapp/ '
}
}
}
}
}


stage('verifying app deployment'){
steps{
script{
withCredentials([kubeconfigFile(credentialsId: 'kubernetes-config', variable: 'KUBECONFIG')]) {
sh '''

chmod +x healthcheck.sh
./healthcheck.sh
'''

}
}
}
}


}

}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ 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
code is integrated with sonarqube plugin which help us in static code analysis

``` ./gradlew sonarqube ```
``` ./gradlew sonarqube ```
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test {

sonarqube {
properties {
property 'sonar.host.url', 'http://34.125.75.197:9000'
property 'sonar.host.url', 'http://34.125.201.58:9000'
property 'sonar.login', '******'
}
}
10 changes: 10 additions & 0 deletions healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
echo "executing health check it might take a while"
sleep 120
kubectl run curl --image=curlimages/curl -i --rm --restart=Never -- curl myjavaapp-myapp:8080

if [ $? -eq 0 ]
then
echo "The Deployment is success...Application Health is Good"
else
helm rollback myjavaapp
fi
4 changes: 2 additions & 2 deletions kube.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# This is kube.yml notes
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -47,7 +47,7 @@ spec:
- name: registry-secret
containers:
- name: myapp
image: nginx:1.0
image: nginx:3.0
command: ["/bin/sh"]
args: ["-c","sh /usr/local/tomcat/bin/startup.sh;while true; do echo hello; sleep 10;done"]
imagePullPolicy: IfNotPresent
Expand Down
Loading