Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1e54f41
Delete Jenkinsfile
DeekshithSN Apr 5, 2020
f3b3eba
Rename Jenkisnfile1 to Jenkisnfile
DeekshithSN Apr 5, 2020
adf2fce
Update Jenkisnfile
DeekshithSN Apr 5, 2020
c272310
Update Jenkisnfile
DeekshithSN Apr 5, 2020
fd7625e
Rename Jenkisnfile to Jenkinsfile
DeekshithSN Apr 5, 2020
5cb2f0a
Update deployment.yaml
DeekshithSN Apr 5, 2020
1873295
Update README.md
DeekshithSN Apr 5, 2020
595afd3
Update README.md
DeekshithSN Apr 5, 2020
b76da8d
Update README.md
DeekshithSN Apr 5, 2020
35371d4
Update hosts
DeekshithSN Apr 5, 2020
8f5e84c
Update README.md
DeekshithSN Apr 5, 2020
4d40217
Update README.md
DeekshithSN Apr 5, 2020
543b467
Update Jenkinsfile
DeekshithSN Apr 5, 2020
53d6676
Update index.jsp
DeekshithSN Apr 5, 2020
95591eb
Update README.md
DeekshithSN May 17, 2020
76bc997
Update README.md
DeekshithSN Jun 19, 2020
36e1ba8
Merge pull request #2 from DeekshithSN/pr-test
DeekshithSN Jun 19, 2020
1fb473b
Update README.md
DeekshithSN Jun 19, 2020
e65eb42
Merge pull request #3 from DeekshithSN/pr-del-test
DeekshithSN Jun 19, 2020
6161850
Update hosts
DeekshithSN Jun 24, 2020
fae19cd
Merge pull request #4 from DeekshithSN/featureansible-sonar
DeekshithSN Jun 24, 2020
aedd9aa
Update README.md
DeekshithSN Jul 13, 2020
15fa326
Update README.md
DeekshithSN Jul 13, 2020
1615d6c
Update README.md
DeekshithSN Jul 13, 2020
53cbe64
Update README.md
DeekshithSN Jul 23, 2020
701977d
Update README.md
DeekshithSN Jul 23, 2020
d6951e0
Update README.md
DeekshithSN Jul 23, 2020
1ed1e22
Update README.md
DeekshithSN Jul 23, 2020
000c64e
Update README.md
DeekshithSN Jul 23, 2020
61d10f3
test file
DeekshithSN Aug 29, 2020
aa02723
Update test
DeekshithSN Aug 29, 2020
d3a5558
Update test
DeekshithSN Aug 29, 2020
4acb991
Update test
DeekshithSN Aug 29, 2020
67b6002
conflict
DeekshithSN Aug 29, 2020
d725ac3
Update test
DeekshithSN Aug 29, 2020
25041df
gfgf
DeekshithSN Aug 29, 2020
9cc7a2d
fgf
DeekshithSN Aug 29, 2020
65f6361
Update test
DeekshithSN Sep 16, 2020
838ce56
Update test
DeekshithSN Sep 16, 2020
dc99632
Update test
DeekshithSN Sep 16, 2020
8e8f584
Update test
DeekshithSN Sep 16, 2020
9bf3086
Create test1
DeekshithSN Sep 16, 2020
de4d66c
Update test
DeekshithSN Sep 16, 2020
c36f06f
Update README.md
Hemraj0007 Oct 1, 2020
ace900a
Merge pull request #5 from Hemraj0007/ansible-sonar
DeekshithSN Oct 1, 2020
56d1c8f
Update test
DeekshithSN Feb 5, 2021
e07982e
Update test
DeekshithSN Feb 5, 2021
90f7d12
Delete test1
DeekshithSN Mar 14, 2021
d2af914
Update test
DeekshithSN Jun 9, 2021
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
114 changes: 71 additions & 43 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,79 @@
currentBuild.displayName = "Devops-Training"+currentBuild.number
currentBuild.displayName = "Final_Demo # "+currentBuild.number

pipeline{
def getDockerTag(){
def tag = sh script: 'git rev-parse HEAD', returnStdout: true
return tag
}


agent {
docker {
image 'maven'
args '-v $HOME/.m2:/root/.m2'
pipeline{
agent any
environment{
Docker_tag = getDockerTag()
}
}

stages{
stage('sonar')
{
steps{
script{
withSonarQubeEnv('sonarserver') {
sh "mvn sonar:sonar"
}
stages{


stage('Quality Gate Statuc Check'){

agent {
docker {
image 'maven'
args '-v $HOME/.m2:/root/.m2'
}
}
}


stage('Quality Gate Statuc Check'){
steps{
script{
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
steps{
script{
withSonarQubeEnv('sonarserver') {
sh "mvn sonar:sonar"
}
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
sh "mvn clean install"
}
}
}
}
}
}
}



stage('build')
{
steps{
script{
sh 'mvn clean deploy'
}
}
}




stage('build')
{
steps{
script{
sh 'cp -r ../devops-training@2/target .'
sh 'docker build . -t deekshithsn/devops-training:$Docker_tag'
withCredentials([string(credentialsId: 'docker_password', variable: 'docker_password')]) {

sh 'docker login -u deekshithsn -p $docker_password'
sh 'docker push deekshithsn/devops-training:$Docker_tag'
}
}
}
}

stage('ansible playbook'){
steps{
script{
sh '''final_tag=$(echo $Docker_tag | tr -d ' ')
echo ${final_tag}test
sed -i "s/docker_tag/$final_tag/g" deployment.yaml
'''
ansiblePlaybook become: true, installation: 'ansible', inventory: 'hosts', playbook: 'ansible.yaml'
}
}
}



}





}
}
83 changes: 0 additions & 83 deletions Jenkisnfile1

This file was deleted.

14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
This is a sample Web Application to use during Continuous Integration demos.

#Build Instruction

# Build Instruction


```
mvn3 clean package
mvn clean package
and build the instruction .
```

#Deploy instruction
# Deploy instruction

Deploy ```target/WebApp.war``` on Tomcat properly for better experience.

Deploy ```target/WebApp.war``` on Tomcat

1 change: 1 addition & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ spec:
type: NodePort
ports:
- port: 8080
nodePort: 31884
protocol: TCP
name: http
selector:
Expand Down
2 changes: 1 addition & 1 deletion hosts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[test]
104.198.135.119
Host_ip
4 changes: 2 additions & 2 deletions src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
<p>Maven is a build automation tool used primarily for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
<div class="col-md-4">
<!-- <div class="col-md-4">
<h2>Docker</h2>
<p>Docker is a set of platform as a service products that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div>
</div> -->
</div>

<hr>
Expand Down
2 changes: 2 additions & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
My changes
A B