-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjhipster-pyhipster-generator-pipeline.yaml
371 lines (371 loc) · 15.5 KB
/
jhipster-pyhipster-generator-pipeline.yaml
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
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: workspace
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 2Gi
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: cleanup-workspace
spec:
steps:
- args:
- '-c'
- rm -rf $(workspaces.source.path)/
command:
- /bin/bash
- '-c'
computeResources: {}
image: 'registry.access.redhat.com/ubi8-micro:8.8-1'
name: cleanup-workspace
workingDir: $(workspaces.source.path)
workspaces:
- mountPath: /workspace/source
name: source
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: pyhipster-generator
spec:
description: |-
Generate JDL from JDL_CONTENTS params.
Generate PyHipster project from JDL file.
Generate GitLab Repository whit the result of a project. (required GitLab Access Token).
Added devfile.yaml to the project.
params:
- default: $(params.JDL_CONTENTS)
description: |
Contents of the JDL file to create. https://www.jhipster.tech/jdl/getting-started
name: JDL_CONTENTS
type: string
- default: $(params.APP_NAME)
description: |
app name. delivery by default
name: APP_NAME
type: string
- default: $(params.JHIPSTER_IMAGE_VERSION)
description: |
pyhipster docker image version. By default docker.io./pyhipster/pyhipster:0.0.9
name: JHIPSTER_IMAGE_VERSION
type: string
- default: $(params.GITLAB_REPO)
description: |
The output repository to use for the git push step.
name: GITLAB_REPO
type: string
- default: $(params.GITLAB_EMAIL)
description: |
GitLab User account.
name: GITLAB_EMAIL
type: string
- default: $(params.GITLAB_USERNAME)
description: |
GitLab User account.
name: GITLAB_USERNAME
type: string
- default: $(params.GITLAB_ACCESSTOKEN)
description: |
Access token Gitlab. Generate in https://gitlab.com/-/user_settings/personal_access_tokens
name: GITLAB_ACCESSTOKEN
type: string
steps:
- computeResources: {}
env:
- name: JDL_CONTENTS
value: $(params.JDL_CONTENTS)
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
image: $(params.JHIPSTER_IMAGE_VERSION)
name: generate-jdl
script: |
#!/bin/sh
printf '%s' "$(params.JDL_CONTENTS)" > "$(workspaces.source.path)/model.jdl"
cat $(workspaces.source.path)/model.jdl
workingDir: $(workspaces.source.path)
- computeResources: {}
env:
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
- name: GITLAB_EMAIL
value: $(params.GITLAB_EMAIL)
- name: GITLAB_USERNAME
value: $(params.GITLAB_USERNAME)
image: $(params.JHIPSTER_IMAGE_VERSION)
name: generate-jhipster-from-jdl
script: |
#!/bin/sh
wget https://raw.githubusercontent.com/maximilianoPizarro/pyhipster-devspace/main/devfile.yaml
git config --global --add safe.directory $(workspaces.source.path)
git config --global user.email $(params.GITLAB_EMAIL)
git config --global user.name $(params.GITLAB_USERNAME)
git init
pyhipster jdl $(workspaces.source.path)/model.jdl --no-insight
workingDir: $(workspaces.source.path)
- computeResources: {}
env:
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
- name: GITLAB_EMAIL
value: $(params.GITLAB_EMAIL)
- name: GITLAB_USERNAME
value: $(params.GITLAB_USERNAME)
- name: GITLAB_REPO
value: $(params.GITLAB_REPO)
- name: GITLAB_ACCESSTOKEN
value: $(params.GITLAB_ACCESSTOKEN)
image: $(params.JHIPSTER_IMAGE_VERSION)
name: commit-and-push-repo
script: |
#!/bin/sh
rm -r $(workspaces.source.path)/.git/*
git config --global --add safe.directory $(workspaces.source.path)
git config --global user.email $(params.GITLAB_EMAIL)
git config --global user.name $(params.GITLAB_USERNAME)
git init
git remote add origin https://$(params.GITLAB_USERNAME):$(params.GITLAB_ACCESSTOKEN)@$(params.GITLAB_REPO)
git checkout -b main
git add .
git commit -m "Jhipster Tekton pipeline autogenerate project"
git push --set-upstream origin main
workingDir: $(workspaces.source.path)
workspaces:
- description: Workspace app generate.
mountPath: /home/pyhipster/app
name: source
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: jhipster-generator
spec:
description: |-
Generate JDL from JDL_CONTENTS params.
Generate JHipster project from JDL file.
Generate GitLab Repository when a project result. (required GitLab Access Token).
params:
- default: $(params.JDL_CONTENTS)
description: |
Contents of the JDL file to create. https://www.jhipster.tech/jdl/getting-started
name: JDL_CONTENTS
type: string
- default: $(params.APP_NAME)
description: |
app name. delivery by default
name: APP_NAME
type: string
- default: $(params.JHIPSTER_IMAGE_VERSION)
description: |
jhipster docker image version. By default docker.io./jhipster/jhipster:v8.1.0
name: JHIPSTER_IMAGE_VERSION
type: string
- default: $(params.GITLAB_REPO)
name: GITLAB_REPO
type: string
description: |
The output repository to use for the git push step.
- default: $(params.GITLAB_EMAIL)
name: GITLAB_EMAIL
type: string
description: |
GitLab User account.
- default: $(params.GITLAB_USERNAME)
name: GITLAB_USERNAME
type: string
description: |
GitLab User account.
- default: $(params.GITLAB_ACCESSTOKEN)
name: GITLAB_ACCESSTOKEN
type: string
description: |
Access token Gitlab. Generate in https://gitlab.com/-/user_settings/personal_access_tokens
steps:
- computeResources: {}
env:
- name: JDL_CONTENTS
value: $(params.JDL_CONTENTS)
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
image: $(params.JHIPSTER_IMAGE_VERSION)
name: generate-jdl
script: |
#!/bin/sh
printf '%s' "$(params.JDL_CONTENTS)" > "$(workspaces.source.path)/model.jdl"
cat $(workspaces.source.path)/model.jdl
workingDir: $(workspaces.source.path)
- computeResources: {}
name: generate-jhipster-from-jdl
image: $(params.JHIPSTER_IMAGE_VERSION)
env:
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
- name: GITLAB_EMAIL
value: $(params.GITLAB_EMAIL)
- name: GITLAB_USERNAME
value: $(params.GITLAB_USERNAME)
script: |
#!/bin/sh
wget https://raw.githubusercontent.com/maximilianoPizarro/jhipster-devspace/master/devfile.yaml
git config --global --add safe.directory $(workspaces.source.path)
git config --global user.email $(params.GITLAB_EMAIL)
git config --global user.name $(params.GITLAB_USERNAME)
git init
jhipster jdl $(workspaces.source.path)/model.jdl --no-insight
./mvnw clean verify -Pprod -Dmaven.test.skip=true
workingDir: $(workspaces.source.path)
- computeResources: {}
name: commit-and-push-repo
image: $(params.JHIPSTER_IMAGE_VERSION)
env:
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
- name: GITLAB_EMAIL
value: $(params.GITLAB_EMAIL)
- name: GITLAB_USERNAME
value: $(params.GITLAB_USERNAME)
- name: GITLAB_REPO
value: $(params.GITLAB_REPO)
- name: GITLAB_ACCESSTOKEN
value: $(params.GITLAB_ACCESSTOKEN)
script: |
#!/bin/sh
rm -r $(workspaces.source.path)/.git/*
git config --global --add safe.directory $(workspaces.source.path)
git config --global user.email $(params.GITLAB_EMAIL)
git config --global user.name $(params.GITLAB_USERNAME)
git init
git remote add origin https://$(params.GITLAB_USERNAME):$(params.GITLAB_ACCESSTOKEN)@$(params.GITLAB_REPO)
git checkout -b main
git add .
git commit -m "Jhipster Tekton pipeline autogenerate project"
git push --set-upstream origin main
workingDir: $(workspaces.source.path)
workspaces:
- description: Workspace app generate.
mountPath: /home/jhipster/app
name: source
- description: .m2 cache.
mountPath: /home/jhipster/.m2
name: m2
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: jhipster-pyhipster-generator-pipeline
spec:
finally:
- name: cleanup-workspace
taskRef:
kind: Task
name: cleanup-workspace
workspaces:
- name: source
workspace: workspace
params:
- default: jhipster
description: Genrate with JHipster or PyHipster?. jhipster | pyhipster
name: GENERATOR
type: string
- default: 'docker.io/jhipster/jhipster:v8.1.0'
description: |
JHipster: docker.io/jhipster/jhipster:v8.1.0 | PyHipster: docker.io./pyhipster/pyhipster:0.0.9
name: JHIPSTER_IMAGE_VERSION
type: string
- default: delivery
description: |
app name.
name: APP_NAME
type: string
- default: "application { config { \tapplicationType monolith baseName delivery packageName com.delivery.app authenticationType jwt prodDatabaseType mariadb databaseType sql devDatabaseType h2Memory buildTool maven clientFramework vue clientTheme solar clientThemeVariant dark enableTranslation true nativeLanguage es languages [en, nl] } entities * } entity Region { \tregionName String } entity Country { \tcountryName String } // an ignored comment /** not an ignored comment */ entity Location { \tstreetAddress String \tpostalCode String \tcity String \tstateProvince String } entity Department { \tdepartmentName String required } /** * Task entity. * @author The JHipster team. */ entity Task { \ttitle String \tdescription String } /** * The Employee entity. */ entity Employee { \t/** \t* The firstname attribute. \t*/ \tfirstName String \tlastName String \temail String \tphoneNumber String \thireDate Instant \tsalary Long \tcommissionPct Long } entity Job { \tjobTitle String \tminSalary Long \tmaxSalary Long } entity JobHistory { \tstartDate Instant \tendDate Instant \tlanguage Language } enum Language { FRENCH, ENGLISH, SPANISH } relationship OneToOne { \tCountry{region} to Region } relationship OneToOne { \tLocation{country} to Country } relationship OneToOne { \tDepartment{location} to Location } relationship ManyToMany { \tJob{task(title)} to Task{job} } // defining multiple OneToMany relationships with comments relationship OneToMany { \tEmployee to Job{employee} \t/** \t* A relationship \t*/ \tDepartment to \t/** \t* Another side of the same relationship \t*/ \tEmployee{department} } relationship ManyToOne { \tEmployee{manager} to Employee } // defining multiple oneToOne relationships relationship OneToOne { \tJobHistory{job} to Job \tJobHistory{department} to Department \tJobHistory{employee} to Employee } // Set pagination options paginate JobHistory, Employee with infinite-scroll paginate Job with pagination // Use Data Transfer Objects (DTO) // dto * with mapstruct // Set service options to all except few service all with serviceImpl except Employee, Job"
description: |
Contents of the JDL file to create. https://www.jhipster.tech/jdl/getting-started
name: JDL_CONTENTS
type: string
- default: gitlab.com/maximilianoPizarro/app.git
description: |
The output repository to use for the git push step.
name: GITLAB_REPO
type: string
- default: maximiliano.pizarro.5@gmail.com
description: |
GitLab User account.
name: GITLAB_EMAIL
type: string
- default: maximilianoPizarro
description: |
GitLab User account.
name: GITLAB_USERNAME
type: string
- default: <your-access-token-value>
description: |
Access token Gitlab. Generate in https://gitlab.com/-/user_settings/personal_access_tokens
name: GITLAB_ACCESSTOKEN
type: string
tasks:
- name: jhipster-generator
params:
- name: contents
value: "application { config { \tapplicationType monolith baseName delivery packageName com.delivery.app authenticationType jwt prodDatabaseType mariadb databaseType sql devDatabaseType h2Memory buildTool maven clientFramework vue clientTheme solar clientThemeVariant dark enableTranslation true nativeLanguage es languages [en, nl] } entities * } enum CategoryStatus { AVAILABLE, RESTRICTED, DISABLED } entity Category { description String required, sortOrder Integer, dateAdded LocalDate, dateModified LocalDate, status CategoryStatus } entity Product { title String required, keywords String, description String, rating Integer, dateAdded LocalDate, dateModified LocalDate } entity Customer { \tfirstName String, lastName String, email String, telephone String } entity Address { address1 String, address2 String, city String, postcode String required maxlength(10), country String required maxlength(2) } entity WishList { \ttitle String required, restricted Boolean } relationship OneToMany { Customer{wishList(title)} to WishList{customer}, WishList{product(title)} to Product{wishList}, Customer{address} to Address{customer} } relationship ManyToOne { \tCategory{parent} to Category } relationship ManyToMany { \tCategory{product(title)} to Product{category} } paginate Customer, Product, Category with pagination paginate Address with pagination paginate Product with infinite-scroll service Category with serviceClass"
- name: APP_NAME
value: $(params.APP_NAME)
- name: JDL_CONTENTS
value: $(params.JDL_CONTENTS)
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
- name: GITLAB_REPO
value: $(params.GITLAB_REPO)
- name: GITLAB_EMAIL
value: $(params.GITLAB_EMAIL)
- name: GITLAB_USERNAME
value: $(params.GITLAB_USERNAME)
- name: GITLAB_ACCESSTOKEN
value: $(params.GITLAB_ACCESSTOKEN)
taskRef:
kind: Task
name: jhipster-generator
when:
- input: $(params.GENERATOR)
operator: in
values:
- jhipster
workspaces:
- name: source
workspace: workspace
- name: m2
workspace: workspace
- name: pyhipster-generator
params:
- name: JDL_CONTENTS
value: $(params.JDL_CONTENTS)
- name: APP_NAME
value: $(params.APP_NAME)
- name: JHIPSTER_IMAGE_VERSION
value: $(params.JHIPSTER_IMAGE_VERSION)
- name: GITLAB_REPO
value: $(params.GITLAB_REPO)
- name: GITLAB_EMAIL
value: $(params.GITLAB_EMAIL)
- name: GITLAB_USERNAME
value: $(params.GITLAB_USERNAME)
- name: GITLAB_ACCESSTOKEN
value: $(params.GITLAB_ACCESSTOKEN)
taskRef:
kind: Task
name: pyhipster-generator
when:
- input: $(params.GENERATOR)
operator: in
values:
- pyhipster
workspaces:
- name: source
workspace: workspace
workspaces:
- name: workspace