Skip to content

Commit 3f133a7

Browse files
authored
Create jenkinsfile
1 parent d8c6860 commit 3f133a7

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

CICD pipeline/jenkinsfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
pipeline{
2+
3+
tools{
4+
jdk 'myjava'
5+
maven 'mymaven'
6+
}
7+
8+
agent any
9+
10+
stages{
11+
12+
stage('build code')
13+
{
14+
steps{
15+
git 'https://github.com/Sonal0409/DevOpsClassCodes.git'
16+
sh 'mvn package'
17+
}
18+
post {
19+
success {
20+
sshPublisher(publishers: [sshPublisherDesc(configName: 'ansibleServer', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '//opt//27JanCICD', remoteDirectorySDF: false, removePrefix: 'target', sourceFiles: 'target/*.war')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)])
21+
}
22+
}
23+
}
24+
stage('build Dockerfile')
25+
{
26+
steps
27+
{
28+
git 'https://github.com/Sonal0409/DevOpsClassCodes.git'
29+
}
30+
post
31+
{
32+
success{
33+
sshPublisher(publishers: [sshPublisherDesc(configName: 'ansibleServer', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'ansible-playbook -i /opt/27JanCICD/hosts /opt/27JanCICD/playbook1.yml', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)])
34+
}
35+
}
36+
}
37+
}
38+
39+
}

0 commit comments

Comments
 (0)