-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
92 lines (81 loc) · 1.59 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
pipeline
{
agent any
stages
{
stage('BUILD')
{
steps
{
sh 'mvn package'
sh 'docker build -t mvscharan9/spectrum_website:webimg .'
sh 'docker build -t mvscharan9/spectrum_website:mysqlimg -f mysql.Dockerfile .'
}
}
stage('TEST')
{
parallel
{
stage('TEST - Setting up Test')
{
steps
{
sh 'docker-compose up'
}
}
stage("TEST - Running Test")
{
steps
{
script
{
sh 'sleep 60'
sh 'npm install'
try
{
sh 'npm run api-tests-production'
currentBuild.result = 'SUCCESS'
sh 'docker-compose stop'
}
catch(Exception ex)
{
currentBuild.result = 'ABORTED'
sh 'docker-compose stop'
error('Test Cases Failed')
}
}
}
}
}
}
stage('PUBLISH to DockerHub')
{
steps
{
withDockerRegistry([ credentialsId: "dockerHub", url: "" ])
{
sh 'docker push mvscharan9/spectrum_website:webimg'
sh 'docker push mvscharan9/spectrum_website:mysqlimg'
}
}
}
}
post
{
always
{
sh 'echo "Pipeline Finished"'
}
success
{
sh 'chmod +x aws_script/sample.sh'
sh 'aws_script/./sample.sh'
sh 'sleep 15'
sh 'curl --location --request POST "http://localhost:4440/api/21/job/a6521c89-c162-4c3a-99c0-7f13cb08e391/run" \
--header "Accept: application/json" \
--header "X-Rundeck-Auth-Token: qIC6nrPc8Z0lObKmzcfA0OmKu8rmP4fI" \
--header "Content-Type: application/json" \
--data ""'
}
}
}