-
Notifications
You must be signed in to change notification settings - Fork 35
/
jenkins.yml
243 lines (243 loc) · 8.03 KB
/
jenkins.yml
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建Jenkins主从集群,通过容器服务部署,支持多语言环境,含ECS资源与网络配置。
en: Establish a Jenkins master-slave cluster, deployed via container services, accommodating
multi-language environments, inclusive of ECS resource allocation and network
configuration.
Parameters:
InstanceType:
Type: String
Label:
en: ECS Instance type
zh-cn: ECS实例规格
Description:
en: 'The ECS instance type, <a href=''https://help.aliyun.com/document_detail/25378.html''
target=''_blank''>View instance types</a>, please confirm the instance type
if in the specific zone in ECS console. '
zh-cn: ECS实例规格,详情请参见<a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'>实例规格族</a>,请在ECS控制台确认所选可用区下是否支持您选的规格。
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
ImageId:
Type: String
Label:
en: ECS Image Id
zh-cn: 镜像ID
Description:
en: Image Id, represents the image resource to startup one ECS instance, <a
href='https://help.aliyun.com/document_detail/100410.html' target='_blank'>View
image resources</a>.
zh-cn: 镜像ID,详情请参考<a href='https://help.aliyun.com/document_detail/100410.html'
target='_blank'>公共镜像</a>。
Default: ubuntu_16_04_64_20G_alibase_20190513.vhd
InstancePassword:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: '8~30 characters, consists of uppercase letter, lowercase letter, number
or special characters such as ( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ;
‘ < > , . ? / '
zh-cn: '长度为8~30个字符。必须同时包含三项(大、小写字母,数字和特殊符号)。<br>支持以下特殊字符:( ) ` ~ ! @ # $ % ^
& * - + = | { } [ ] : ; ‘ < > , . ? /。'
ConstraintDescription:
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers,
special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
AllowedPattern: '[0-9A-Za-z\_\-&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
MinLength: '8'
MaxLength: '30'
NoEcho: true
SystemDiskCategory:
Type: String
Label:
en: System Disk Category
zh-cn: 系统盘类别
Description:
en: 'System disk category, allowed values: cloud|cloud_efficiency|cloud_ssd.'
zh-cn: 系统盘类型,可选值:cloud:普通云盘,cloud_ssd:SSD云盘,cloud_efficiency:高效云盘。
Default: cloud_ssd
AllowedValues:
- cloud_auto
- cloud
- cloud_efficiency
- cloud_ssd
IoOptimized:
Type: Boolean
Label:
en: I/O Optimized
zh-cn: I/O优化实例
Description:
en: The 'optimized' instance can provide better I/O performance.
zh-cn: 是否创建I/O优化实例
Default: true
ClusterName:
Type: String
Label:
en: Cluster Name
zh-cn: 集群名称
Description:
en: Cluster name
zh-cn: Docker集群的名称
Default: jenkinsCluster
ClusterSize:
Type: Number
Label:
en: Cluster Size
zh-cn: 实例数量
Description:
en: The number of cluster nodes is among [1, 100]
zh-cn: 集群使用ECS实例数量
Default: 2
MinValue: 1
MaxValue: 100
SubnetCidr:
Type: String
Label:
en: Subnet CIDR
zh-cn: 子网网段
Description:
en: Subnet for containers. The range allowed is 172.17.XX.XX/24 - 172.31.XX.XX/24.
Make sure it's different from VPC and VSwitch.
zh-cn: 可选范围:172.17.XX.XX/24 - 172.31.XX.XX/24。<br>确保此网段不能和专有网络网段相同。
Default: 172.30.15.0/24
Resources:
VPC:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Fn::Select:
- '0'
- Fn::GetAZs:
Ref: ALIYUN::Region
VpcId:
Ref: VPC
CidrBlock: 192.168.10.0/24
DependsOn: VPC
MyCluster:
Type: ALIYUN::CS::Cluster
Properties:
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
ImageId:
Ref: ImageId
InstanceType:
Ref: InstanceType
IoOptimized:
Ref: IoOptimized
Name:
Ref: ClusterName
Password:
Ref: InstancePassword
Size:
Ref: ClusterSize
SubnetCidr:
Ref: SubnetCidr
SystemDiskCategory:
Ref: SystemDiskCategory
App:
Type: ALIYUN::CS::App
Properties:
Ca:
Fn::GetAtt:
- MyCluster
- Ca
Cert:
Fn::GetAtt:
- MyCluster
- Cert
ClusterId:
Fn::GetAtt:
- MyCluster
- ClusterId
Key:
Fn::GetAtt:
- MyCluster
- Key
MasterUrl:
Fn::GetAtt:
- MyCluster
- MasterUrl
Name: jenkins
Template: "jenkins:\n image: 'registry.aliyuncs.com/acs-sample/jenkins:2.32.1'\n\
\ volumes:\n - /var/lib/docker/jenkins:/var/jenkins_home\n privileged:\
\ true\n restart: always \n labels:\n aliyun.scale: '1'\n \
\ aliyun.probe.url: 'tcp://container:8080'\n aliyun.probe.initial_delay_seconds:\
\ '10'\n aliyun.routing.port_8080: jenkins\n links:\n - slave-golang\n\
\ - slave-java\n - slave-nodejs\n - slave-python\n \
\ - slave-php\nslave-golang:\n image: 'registry.aliyuncs.com/acs-sample/jenkins-slave-dind-golang'\n\
\ volumes:\n - /var/run/docker.sock:/var/run/docker.sock\n restart:\
\ always \n labels:\n aliyun.scale: '1'\nslave-java:\n image:\
\ 'registry.aliyuncs.com/acs-sample/jenkins-slave-dind-java'\n volumes:\n\
\ - /var/run/docker.sock:/var/run/docker.sock\n restart: always\
\ \n labels:\n aliyun.scale: '1' \nslave-nodejs:\n image:\
\ 'registry.aliyuncs.com/acs-sample/jenkins-slave-dind-nodejs'\n volumes:\n\
\ - /var/run/docker.sock:/var/run/docker.sock\n restart: always\
\ \n labels:\n aliyun.scale: '1'\nslave-python:\n image: 'registry.aliyuncs.com/acs-sample/jenkins-slave-dind-python'\n\
\ volumes:\n - /var/run/docker.sock:/var/run/docker.sock \n \
\ restart: always \n labels:\n aliyun.scale: '1'\nslave-php:\n\
\ image: 'registry.aliyuncs.com/acs-sample/jenkins-slave-dind-php'\n \
\ volumes:\n - /var/run/docker.sock:/var/run/docker.sock \n \
\ restart: always \n labels:\n aliyun.scale: '1'"
Outputs:
CaCert:
Description: CA cert of the cluster.
Value:
Fn::GetAtt:
- MyCluster
- Ca
ClientCert:
Description: Client cert of the cluster.
Value:
Fn::GetAtt:
- MyCluster
- Cert
ClientKey:
Description: Client key of the cluster.
Value:
Fn::GetAtt:
- MyCluster
- Key
ClusterId:
Description: Id of the cluster.
Value:
Fn::GetAtt:
- MyCluster
- ClusterId
Endpoints:
Description: Endpoints of the app.
Value:
Fn::GetAtt:
- App
- Endpoints
MasterUrl:
Description: Master url of the cluster.
Value:
Fn::GetAtt:
- MyCluster
- MasterUrl
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- InstanceType
- ImageId
- InstancePassword
- SystemDiskCategory
- IoOptimized
Label:
default: ECS
- Parameters:
- ClusterName
- ClusterSize
- SubnetCidr
Label:
default: CSCluster
TemplateTags:
- acs:example:容器:创建Jenkins容器服务集群