forked from challadevops1/InsureMe-03May
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBabufile
49 lines (47 loc) · 1.79 KB
/
Babufile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
pipeline {
agent any
tools{
maven 'M2_HOME'
}
stages {
stage('Git checkout') {
steps {
echo 'This is for cloning the gitrepo'
git branch: 'main', url: 'https://github.com/cbabu85/InsureMe-20Mar.git'
}
}
stage('Create a Package') {
steps {
echo 'This will create a package using maven'
sh 'mvn package'
}
}
stage('Publish the HTML Reports') {
steps {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: '/var/lib/jenkins/workspace/Insure-Project/target/surefire-reports', reportFiles: 'index.html', reportName: 'HTML Report', reportTitles: '', useWrapperFileDirectly: true])
}
}
stage('Create a Docker image from the Package Insure-Me.jar file') {
steps {
sh 'docker build -t cbabu85/insure-me-app:4.0 .'
}
}
stage('Login to Dockerhub') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerlogin', passwordVariable: 'dockerpass', usernameVariable: 'dockeruser')]) {
sh 'docker login -u ${dockeruser} -p ${dockerpass}'
}
}
}
stage('Push the Docker image') {
steps {
sh 'docker push cbabu85/insure-me-app:4.0'
}
}
stage('Ansbile config and Deployment') {
steps {
ansiblePlaybook credentialsId: 'ansible-ssh', disableHostKeyChecking: true, installation: 'ansible', inventory: '/etc/ansible/hosts', playbook: 'ansible.yml', vaultTmpPath: ''
}
}
}
}