forked from forj-oss/forjj-jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generated-yaml-structs.go
377 lines (327 loc) · 17.9 KB
/
generated-yaml-structs.go
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
// This file is autogenerated by "go generate". Do not modify it.
// It has been generated from your 'jenkins.yaml' file.
// To update those structure, update the 'jenkins.yaml' and run 'go generate'
package main
// Object app groups structure
// Groups structure
type DeployStruct struct {
PublicServiceUrl string `json:"deploy-public-service-url"` // External public Jenkins service url. Set this flag if Jenkins is proxied from a proxy out of your Software Factory.
ServiceAddr string `json:"deploy-service-addr"` // Exposed service CNAME or IP address of the expected jenkins instance. By default, it uses localhost.
ServicePort string `json:"deploy-service-port"` // Expected jenkins instance port number.
To string `json:"deploy-to"` // Deployment name used to deploy jenkins.
}
type DockerfileStruct struct {
FromImage string `json:"dockerfile-from-image"` // Base Docker image tag name to use in Dockerfile. Must respect [server/repo/]name.
FromImageVersion string `json:"dockerfile-from-image-version"` // Base Docker image tag version to use in Dockerfile. By default, it uses 'latest'.
Maintainer string `json:"dockerfile-maintainer"` // Jenkins image maintainer
}
type FinalImageStruct struct {
Name string `json:"final-image-name"` // Docker image name for your final generated Jenkins Image. Do not set the Server or Repo name. Use final-docker-registry-server and final-docker-repo-name.
RegistryRepoName string `json:"final-image-registry-repo-name"` // Docker Repository Name where your image will be pushed. If not set, no push will be done.
RegistryServer string `json:"final-image-registry-server"` // Docker registry server name where your image will be pushed. If not set, no push will be done.
Version string `json:"final-image-version"` // Docker image tag version for your generated Jenkins Image.
}
type GithubUserStruct struct {
Password string `json:"github-user-password"` // github user password. Recommended. Stored as github-user credential in jenkins.
Username string `json:"github-user-username"` // github user name. Recommended. Stored as github-user credential in jenkins.
}
type SeedJobStruct struct {
DefaultPath string `json:"seed-job-default-path"` // Default DSL repository relative path. Relative to Deploy repository for the instance. ie: <DeployRepoPath>/<DeployName>
DefaultRepo string `json:"seed-job-default-repo"` // Default DSL deployment repository url.
Path string `json:"seed-job-path"` // Relative path in cloned repository where jobdsl groovy files are found. By default relative path is <ApplicationName>/jobs-dsl. Note if you change the default value, forjj-jenkins won't generate groovy files for you.
Repo string `json:"seed-job-repo"` // Url to the seed job repository to clone. By default, it uses the deployment repository remote url. Note if you change the default value, forjj-jenkins won't generate groovy files for you.
}
type SslStruct struct {
Certificate string `json:"ssl-certificate"` // SSL Certificate file to certify your jenkins instance. To use this, set ssl-method to 'manual'.
Method string `json:"ssl-method"` // How SSL is managed for this Jenkins service. By default, SSL is disabled (none)
PrivateKey string `json:"ssl-private-key"` // SSL private key to use to use the ssh certificate in jenkins. To use this, set ssl-method to 'manual'.
}
// Object Instance structures
type AppInstanceStruct struct {
AdminPwd string `json:"admin-pwd"` // To replace the default simple security admin password
JenkinsfilePath string `json:"jenkinsfile-path"` // Define Default Jenkinsfile PATH used by JobDSL to generate all code project pipeline with a different Jenkinsfile Path. Note that by default, Jenkins uses 'Jenkinsfile'.
ProDeployment string `json:"pro-deployment"` // true if current deployment is production one
RegistryAuth string `json:"registry-auth"` // List of Docker registry servers authentication separated by coma. One registry server auth string is build as <server>:<token>[:<email>]
SourceTemplates string `json:"source-templates"` // Path to local source template to build Jenkins deployment. Usually, 'templates/<myTemplates>'. If not set, it uses internal forjj template.
// Groups
DeployStruct
DockerfileStruct
FinalImageStruct
GithubUserStruct
SeedJobStruct
SslStruct
Extent map[string]string `json:",omitempty"`
}
// Object features groups structure
// Groups structure
// Object Instance structures
type FeaturesInstanceStruct struct {
Name string `json:"name"` // name of the jenkins feature
Options string `json:"options"` // List of feature option to use
Extent map[string]string `json:",omitempty"`
}
// Object projects groups structure
// Groups structure
type GitStruct struct {
RemoteUrl string `json:"git-remote-url"` // with remote-type = 'git', Remote repository url.
}
type GithubStruct struct {
ApiUrl string `json:"github-api-url"` // with remote-type = 'github', Github API Url. By default, it uses public github API.
Repo string `json:"github-repo"` // with remote-type = 'github', Repository name.
RepoOwner string `json:"github-repo-owner"` // with remote-type = 'github', Repository owner. Can be a user or an organization.
}
// Object Instance structures
type ProjectsInstanceStruct struct {
JenkinsfilePath string `json:"jenkinsfile-path"` // Define Jenkinsfile PATH used by JobDSL to generate the project pipeline with a different Jenkinsfile Path. Note that by default, Jenkins uses 'Jenkinsfile'.
Name string `json:"name"` // Project name
RemoteType string `json:"remote-type"` // Define remote source type. 'github' is used by default. Support 'git', 'github'.
RepoDeployHosted string `json:"repo-deploy-hosted"` // true if the repository is managed in the current deployment context
RepoRole string `json:"repo-role"` // Role of the repository. Can be infra, deploy or code
// Groups
GitStruct
GithubStruct
Extent map[string]string `json:",omitempty"`
}
// ************************
// Create request structure
// ************************
type ForjCommonStruct struct {
ForjjDeploymentEnv string `json:"deployment-env"` // Deployment environment name
ForjjDeploymentType string `json:"deployment-type"` // Deployment environment type
Debug string `json:"debug"`
ForjjDeployMount string `json:"forjj-deploy-mount"`
ForjjInfra string `json:"forjj-infra"`
ForjjInfraUpstream string `json:"forjj-infra-upstream"`
ForjjInstanceName string `json:"forjj-instance-name"`
ForjjOrganization string `json:"forjj-organization"`
ForjjSourceMount string `json:"forjj-source-mount"`
ForjjUsername string `json:"forjj-username"`
}
type CreateReq struct {
Forj struct {
ForjCommonStruct
}
ForjExtent map[string]string `json:",omitempty"`
Objects CreateArgReq
Creds map[string]string
}
type CreateArgReq struct {
App map[string]AppInstanceStruct `json:"app"` // Object details
Features map[string]FeaturesInstanceStruct `json:"features"` // Object details
Projects map[string]ProjectsInstanceStruct `json:"projects"` // Object details
}
// ************************
// Update request structure
// ************************
type UpdateReq struct {
Forj struct {
ForjCommonStruct
RunTasks string `json:"run-tasks"`
}
ForjExtent map[string]string `json:",omitempty"`
Objects UpdateArgReq
Creds map[string]string
}
type UpdateArgReq struct {
App map[string]AppInstanceStruct `json:"app"` // Object details
Features map[string]FeaturesInstanceStruct `json:"features"` // Object details
Projects map[string]ProjectsInstanceStruct `json:"projects"` // Object details
}
// **************************
// Maintain request structure
// **************************
type MaintainReq struct {
Forj struct {
ForjCommonStruct
DeployTo string `json:"deploy-to"`
ForjjUsername string `json:"forjj-username"`
}
ForjExtent map[string]string `json:",omitempty"`
Objects MaintainArgReq
Creds map[string]string
}
type MaintainArgReq struct {
App map[string]AppMaintainStruct `json:"app"` // Object details
}
type AppMaintainStruct struct {
AdminPwd string `json:"admin-pwd"` // To replace the default simple security admin password
RegistryAuth string `json:"registry-auth"` // List of Docker registry servers authentication separated by coma. One registry server auth string is build as <server>:<token>[:<email>]
GithubUserPassword string `json:"github-user-password"` // github user password. Recommended. Stored as github-user credential in jenkins.
SslPrivateKey string `json:"ssl-private-key"` // SSL private key to use to use the ssh certificate in jenkins. To use this, set ssl-method to 'manual'.
}
// YamlDesc has been created from your 'jenkins.yaml' file.
const YamlDesc = "---\n" +
"plugin: \"jenkins\"\n" +
"version: \"0.2\"\n" +
"description: \"CI jenkins plugin for FORJJ.\"\n" +
"runtime:\n" +
" docker:\n" +
" image: \"forjdevops/forjj-jenkins\"\n" +
" dood: true\n" +
" service_type: \"REST API\"\n" +
" service:\n" +
" #socket: \"jenkins.sock\"\n" +
" parameters: [ \"service\", \"start\", \"--templates\", \"/templates\"]\n" +
"created_flag_file: \"{{ .InstanceName }}/forjj-{{ .Name }}.yaml\"\n" +
"extend_relative_path: \"{{ if .Application.Get \\\"source-templates\\\" }}templates/{{ .Application.Get \\\"source-templates\\\" }}{{ end }}\"\n" +
"task_flags:\n" +
" common:\n" +
" forjj-infra-upstream:\n" +
" help: \"address of the infra repository upstream\"\n" +
" forjj-infra:\n" +
" help: \"Name of the Infra repository to use\"\n" +
" forjj-instance-name:\n" +
" forjj-deploy-mount:\n" +
" forjj-organization:\n" +
" debug:\n" +
" help: \"To activate jenkins debug information\"\n" +
" forjj-source-mount:\n" +
" help: \"Where the source dir is located for jenkins plugin.\"\n" +
" forjj-username:\n" +
" help: \"User name running forjj\"\n" +
" update:\n" +
" run-tasks:\n" +
" help: Define the list of forjj-jenkins supported tasks as defined by the templates.yaml\n" +
" maintain:\n" +
" deploy-to:\n" +
" default: docker\n" +
" help: \"Where jenkins will be published.\"\n" +
" forjj-username:\n" +
" help: \"User name running forjj\"\n" +
"objects:\n" +
" app:\n" +
" default-actions: [\"add\", \"change\"]\n" +
" groups:\n" +
" dockerfile:\n" +
" flags:\n" +
" # Information we can define for the Dockerfile.\n" +
" from-image:\n" +
" help: \"Base Docker image tag name to use in Dockerfile. Must respect [server/repo/]name.\"\n" +
" default: forjdevops/jenkins\n" +
" from-image-version:\n" +
" help: \"Base Docker image tag version to use in Dockerfile. By default, it uses 'latest'.\"\n" +
" maintainer:\n" +
" help: \"Jenkins image maintainer\"\n" +
" final-image:\n" +
" flags:\n" +
" name:\n" +
" help: \"Docker image name for your final generated Jenkins Image. Do not set the Server or Repo name. Use final-docker-registry-server and final-docker-repo-name.\"\n" +
" default: \"{{ .Forjfile.ForjSettings.Organization | ToLower }}-jenkins\"\n" +
" version:\n" +
" help: \"Docker image tag version for your generated Jenkins Image.\"\n" +
" registry-server:\n" +
" help: \"Docker registry server name where your image will be pushed. If not set, no push will be done.\"\n" +
" default: hub.docker.com\n" +
" registry-repo-name:\n" +
" help: \"Docker Repository Name where your image will be pushed. If not set, no push will be done.\"\n" +
" default: \"{{ .Forjfile.ForjSettings.Organization | ToLower }}\"\n" +
" deploy:\n" +
" flags:\n" +
" to:\n" +
" help: \"Deployment name used to deploy jenkins.\"\n" +
" default: \"docker\"\n" +
" service-addr:\n" +
" help: \"Exposed service CNAME or IP address of the expected jenkins instance. By default, it uses localhost.\"\n" +
" default: localhost\n" +
" service-port:\n" +
" default: 8080\n" +
" help: \"Expected jenkins instance port number.\"\n" +
" public-service-url:\n" +
" help: External public Jenkins service url. Set this flag if Jenkins is proxied from a proxy out of your Software Factory.\n" +
" ssl:\n" +
" flags:\n" +
" method:\n" +
" help: \"How SSL is managed for this Jenkins service. By default, SSL is disabled (none)\"\n" +
" default: none\n" +
" private-key:\n" +
" help: SSL private key to use to use the ssh certificate in jenkins. To use this, set ssl-method to 'manual'.\n" +
" secure: true\n" +
" cli-exported-to-actions: [\"maintain\"]\n" +
" certificate:\n" +
" help: SSL Certificate file to certify your jenkins instance. To use this, set ssl-method to 'manual'.\n" +
" github-user:\n" +
" flags:\n" +
" username:\n" +
" help: github user name. Recommended. Stored as github-user credential in jenkins.\n" +
" password:\n" +
" help: github user password. Recommended. Stored as github-user credential in jenkins.\n" +
" secure: true\n" +
" envar: \"USER_PASS\"\n" +
" cli-exported-to-actions: [\"maintain\"]\n" +
" seed-job:\n" +
" flags:\n" +
" repo:\n" +
" help: \"Url to the seed job repository to clone. By default, it uses the deployment repository remote url. Note if you change the default value, forjj-jenkins won't generate groovy files for you.\"\n" +
" path:\n" +
" help: \"Relative path in cloned repository where jobdsl groovy files are found. By default relative path is <ApplicationName>/jobs-dsl. Note if you change the default value, forjj-jenkins won't generate groovy files for you.\"\n" +
" default-repo:\n" +
" internal: true\n" +
" help: Default DSL deployment repository url.\n" +
" default: \"{{ .Forjfile.Deploy.RemoteUrl }}\"\n" +
" default-path:\n" +
" internal: true\n" +
" help: \"Default DSL repository relative path. Relative to Deploy repository for the instance. ie: <DeployRepoPath>/<DeployName>\"\n" +
" default: \"{{ .Current.Name}}/jobs-dsl\"\n" +
" flags:\n" +
" registry-auth:\n" +
" help: \"List of Docker registry servers authentication separated by coma. One registry server auth string is build as <server>:<token>[:<email>]\"\n" +
" secure: true\n" +
" envar: \"REGISTRY_AUTH\"\n" +
" cli-exported-to-actions: [\"create\", \"update\", \"maintain\"]\n" +
" admin-pwd:\n" +
" help: \"To replace the default simple security admin password\"\n" +
" secure: true\n" +
" cli-exported-to-actions: [\"maintain\"]\n" +
" source-templates:\n" +
" help: \"Path to local source template to build Jenkins deployment. Usually, 'templates/<myTemplates>'. If not set, it uses internal forjj template.\"\n" +
" pro-deployment:\n" +
" help: true if current deployment is production one\n" +
" default: \"{{ if (eq (.Deployments.Get .Current.Deployment).Type \\\"PRO\\\") }}true{{ else }}false{{ end }}\"\n" +
" jenkinsfile-path:\n" +
" help: \"Define Default Jenkinsfile PATH used by JobDSL to generate all code project pipeline with a different Jenkinsfile Path. Note that by default, Jenkins uses 'Jenkinsfile'.\"\n" +
" features:\n" +
" default-actions: [\"add\", \"change\", \"remove\"]\n" +
" identified_by_flag: name\n" +
" flags:\n" +
" name:\n" +
" help: \"name of the jenkins feature\"\n" +
" required: true\n" +
" options:\n" +
" help: \"List of feature option to use\"\n" +
" projects:\n" +
" default-actions: [\"add\", \"change\", \"remove\"]\n" +
" identified_by_flag: name\n" +
" flags:\n" +
" name:\n" +
" help: \"Project name\"\n" +
" required: true\n" +
" remote-type:\n" +
" default: \"{{ (index .Forjfile.Repos .Current.Name).RemoteType }}\"\n" +
" help: \"Define remote source type. 'github' is used by default. Support 'git', 'github'.\"\n" +
" repo-role:\n" +
" internal: true\n" +
" help: Role of the repository. Can be infra, deploy or code\n" +
" default: \"{{ (index .Forjfile.Repos .Current.Name).Role }}\"\n" +
" repo-deploy-hosted:\n" +
" internal: true\n" +
" help: true if the repository is managed in the current deployment context\n" +
" default: \"{{ if (index .Forjfile.Repos .Current.Name).IsDeployable }}true{{ end }}\"\n" +
" jenkinsfile-path:\n" +
" help: \"Define Jenkinsfile PATH used by JobDSL to generate the project pipeline with a different Jenkinsfile Path. Note that by default, Jenkins uses 'Jenkinsfile'.\"\n" +
" groups:\n" +
" github:\n" +
" flags:\n" +
" api-url:\n" +
" default: \"{{ (index .Forjfile.Repos .Current.Name).UpstreamAPIUrl }}\"\n" +
" help: \"with remote-type = 'github', Github API Url. By default, it uses public github API.\"\n" +
" repo-owner:\n" +
" default: \"{{ (index .Forjfile.Repos .Current.Name).Owner }}\"\n" +
" help: \"with remote-type = 'github', Repository owner. Can be a user or an organization.\"\n" +
" repo:\n" +
" default: \"{{ .Current.Name }}\"\n" +
" help: \"with remote-type = 'github', Repository name.\"\n" +
" git:\n" +
" flags:\n" +
" remote-url:\n" +
" help: \"with remote-type = 'git', Remote repository url.\"\n" +
""