-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
64 lines (54 loc) · 1.63 KB
/
Jenkinsfile
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
pipeline {
environment {
registryCredential = 'dockerhub-jenkins'
dockerImage = ''
}
agent any
stages {
stage('Step 1: Git Pull') {
steps {
git url: 'https://github.com/akilalakshmanan/caffeine_confessions_frontend.git'
}
}
stage('Step 2: Npm build'){
steps{
script{
sh 'sudo npm install -g npm@8.9.0'
sh 'sudo npm install -g serve'
sh 'npm run build --force'
}
}
}
stage('Step 3: Testing'){
steps{
script{
sh 'npm test'
}
}
}
stage('Step 4: Build docker image')
{
steps{
script{
dockerImage = docker.build 'akila1811/react-image'
}
}
}
stage('Step 5: Push docker image')
{
steps{
script {
docker.withRegistry('',registryCredential) {
dockerImage.push()
}
}
}
}
stage('Step 6: Ansible deployment')
{
steps{
ansiblePlaybook colorized: true, disableHostKeyChecking: true, installation: 'Ansible', inventory: 'inventory', playbook: 'deployment-playbook.yml'
}
}
}
}