-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
122 lines (120 loc) · 3.73 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
pipeline {
agent any
parameters{
string(name: 'tag', defaultValue: 'main', description: 'Image Tag')
booleanParam(name: 'buildAgent', defaultValue: false, description: 'Build B2B Agents')
booleanParam(name: 'buildAgentWatcher', defaultValue: false, description: 'Build B2B Agent Watcher')
booleanParam(name: 'cleanBuild', defaultValue: false, description: 'Clean Build')
booleanParam(name: 'pushToS3', defaultValue: false, description: 'Push to S3')
booleanParam(name: 'deploy', defaultValue: true, description: 'Deploy in machine')
booleanParam(name: 'dockerHub', defaultValue: false, description: 'Push to Docker Hub')
}
stages {
stage('Create Tag') {
steps {
sh "chmod 777 ./scripts/create_tag.sh"
sh "./scripts/create_tag.sh"
}
}
stage('SCM') {
steps {
git branch: "$BRANCH_NAME", url: 'https://github.com/appveen/ds-b2b-manager.git'
}
}
stage('SCM B2B Base Image') {
steps {
dir('ds-b2b-base') {
git branch: "$BRANCH_NAME", url: 'https://github.com/appveen/ds-b2b-base.git'
}
}
}
stage('SCM FaaS Base Image') {
steps {
dir('ds-faas') {
git branch: "$BRANCH_NAME", url: 'https://github.com/appveen/ds-faas.git'
}
}
}
stage('SCM Agent') {
when {
expression {
params.buildAgent == true
}
}
steps {
dir('ds-agent') {
git branch: "$BRANCH_NAME", url: 'https://github.com/appveen/ds-agent.git'
}
}
}
stage('SCM Agent Watcher') {
when {
expression {
params.buildAgentWatcher == true
}
}
steps {
dir('ds-agent-watcher') {
git branch: "$BRANCH_NAME", url: 'https://github.com/appveen/ds-agent-watcher.git'
}
}
}
stage('Build') {
steps {
sh "chmod 777 ./scripts/build.sh"
sh "./scripts/build.sh"
}
}
stage('Prepare YAML') {
steps {
sh "chmod 777 ./scripts/prepare_yaml.sh"
sh "./scripts/prepare_yaml.sh"
}
}
stage('Push to ECR') {
steps {
sh "chmod 777 ./scripts/push_ecr.sh"
sh "./scripts/push_ecr.sh"
}
}
stage('Push to Docker Hub') {
when {
expression {
params.dockerHub == true
}
}
steps {
sh "chmod 777 ./scripts/push_hub.sh"
sh "./scripts/push_hub.sh"
}
}
stage('Save to S3') {
when {
expression {
params.pushToS3 == true || params.dockerHub == true
}
}
steps {
sh "chmod 777 ./scripts/push_s3.sh"
sh "./scripts/push_s3.sh"
}
}
stage('Deploy') {
when {
expression {
params.deploy == true
}
}
steps {
sh "chmod 777 ./scripts/deploy.sh"
sh "./scripts/deploy.sh"
}
}
stage('Clean Up') {
steps {
sh "chmod 777 ./scripts/cleanup.sh"
sh "./scripts/cleanup.sh"
}
}
}
}