-
Notifications
You must be signed in to change notification settings - Fork 9
/
template.yaml
328 lines (328 loc) · 13.2 KB
/
template.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
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: basic-workflow-bootstrap
title: Basic workflow bootstrap project
description: Bootstrap project for basic serverless workflows
tags:
- orchestrator
- built-in
links:
- url: https://openshift-knative.github.io/docs/docs/latest/serverless-logic/about.html
title: About OpenShift Serverless Logic
icon: techdocs
- url: https://kiegroup.github.io/kogito-docs/serverlessworkflow/latest/index.html
title: SonataFlow Guides
icon: techdocs
- url: https://www.parodos.dev/docs/core-concepts/workflow-types/
title: Workflow Types
icon: techdocs
spec:
owner: janus-orchestrator
type: basic-workflow-bootstrap
parameters:
- title: Provide information about the workflow software project
description: Configure the github repository where the Maven software project is located
required:
- orgName
- repoName
- workflowId
- owner
- system
properties:
orgName:
title: Organization Name
type: string
ui:autofocus: true
description: Github Organization Name
repoName:
title: Repository Name
type: string
description: Github repository name
default: onboarding
description:
title: Description
type: string
description: Description added to the README file
default: A workflow for onboarding applications to OCP cluster
workflowId:
title: Workflow ID
type: string
pattern: "^([a-zA-Z][a-zA-Z0-9]*)([-.]?[a-zA-Z0-9]+)*$"
description: Unique identifier of the workflow in SonataFlow
default: onboarding
owner:
title: Owner
type: string
ui:field: EntityPicker
ui:options:
catalogFilter:
kind:
- Group
- User
default: user:guest
system:
title: System
type: string
ui:field: EntityPicker
ui:options:
catalogFilter:
kind:
- System
- title: Provide information about the workflow type
description: Select the workflow type. For an assessment, provide an infrastructure workflow option, which should already be set up in your environment
required:
- workflowType
properties:
workflowType:
title: Workflow Type
type: string
description: Annotation to be added to the workflow in SonataFlow to specify its type
ui:widget: radio
enum:
- infrastructure
- assessment
enumNames:
- Infrastructure
- Assessment
default: infrastructure
dependencies:
workflowType:
oneOf:
- properties:
workflowType:
const: infrastructure
- properties:
workflowType:
const: assessment
infrastructureWorkflowId:
title: Infrastructure Workflow ID
type: string
pattern: "^([a-zA-Z][a-zA-Z0-9]*)([.][a-zA-Z0-9]+)*$"
description: Workflow ID, the unique identifier of the infrastructure worklow available in the environment
required:
- infrastructureWorkflowId
- title: Provide information about the build environment
required:
- CI
properties:
CI:
title: Select a CI/CD method
type: string
description: This action will create a CI pipeline for your application based on chosen method
default: tekton_argocd
enum:
- none
- tekton_argocd
enumNames:
- None
- Tekton with ArgoCD
# See: https://github.com/redhat-developer/red-hat-developer-hub-software-templates/blob/3019e781b988e0548eb987eed3e522854ed8c52f/templates/github/quarkus-backend/template.yaml#L101
dependencies:
CI:
oneOf:
- properties:
CI:
const: none
- properties:
CI:
const: tekton_argocd
namespace:
title: Workflow Namespace
type: string
default: sonataflow-infra
description: Deployment namespace for workflow applications
argocdNamespace:
title: GitOps Namespace
type: string
default: orchestrator-gitops
description: Deployment namespace for ArgoCD and Tekton resources
quayOrgName:
title: Quay Organization Name
type: string
description: The Quay Organization Name of the published workflow
quayRepoName:
title: Quay Repository Name
type: string
description: The Quay Repository Name of the published workflow. The repository must exist before deploying the gitops.
persistencePSQLSecretName:
title: PostgreSQL Secret Name
type: string
default: sonataflow-psql-postgresql
description: Name of the secret in which the PostgreSQL secrets are stored. Shall be in the same namespace as the workflow.
persistencePSQLUserKey:
title: PostgreSQL User key from secret
type: string
description: The key name in which the PostgreSQL user is stored.
default: postgres-username
persistencePSQLPasswordKey:
title: PostgreSQL Password key from secret
type: string
description: The key name in which the PostgreSQL password is stored.
default: postgres-password
persistencePSQLServiceName:
title: PostgreSQL K8s Service Name
type: string
default: sonataflow-psql-postgresql
description: Name of the service running the PostgreSQL instance.
persistencePSQLServicePort:
title: PostgreSQL Port
type: integer
default: 5432
description: Port on which the PostgreSQL instance is running.
persistencePSQLDatabaseName:
title: PostgreSQL Database Name
type: string
description: Name of the database to use for persistence.
default: sonataflow
required:
- namespace
- argocdNamespace
- quayOrgName
- quayRepoName
- persistencePSQLSecretName
- persistencePSQLUserKey
- persistencePSQLPasswordKey
- persistencePSQLServiceName
- persistencePSQLServicePort
- persistencePSQLDatabaseName
steps:
- id: workflowCodeTemplate
name: Generating the Workflow Source Code and Catalog Info Component
action: fetch:template
input:
# "Relative path is not allowed to refer to a directory outside its parent"
url: ./skeleton
values:
namespace: ${{ parameters.namespace }}
argocdNamespace: ${{ parameters.argocdNamespace }}
orgName: ${{ parameters.orgName }}
repoName: ${{ parameters.repoName }}
owner: ${{ parameters.owner }}
system: ${{ parameters.system }}
description: ${{ parameters.description }}
groupId: io.janus.workflow
artifactId: ${{ parameters.workflowId }}
version: 1.0.0-SNAPSHOT
workflowId: ${{ parameters.workflowId }}
workflowType: ${{ parameters.workflowType }}
infrastructureWorkflowId: ${{ parameters.infrastructureWorkflowId }}
sourceControl: github.com
applicationType: workflow-project
lifecycle: development
quayOrgName: ${{ parameters.quayOrgName }}
quayRepoName: ${{ parameters.quayRepoName }}
targetPath: workflow
- id: renameFiles
action: fs:rename
name: Rename files
input:
files:
- from: workflow/src/main/resources/${{ parameters.workflowType }}-template.sw.yaml
to: workflow/src/main/resources/${{ parameters.workflowId }}.sw.yaml
overwrite: false
- id: deleteFiles
action: fs:delete
name: Delete files
input:
files:
- workflow/src/main/resources/assessment-template.sw.yaml
- workflow/src/main/resources/infrastructure-template.sw.yaml
- id: buildCodeTemplate
name: Generating the Build Code for the Workflow
action: fetch:template
if: ${{ parameters.CI == 'tekton_argocd' }}
input:
url: ../build
copyWithoutTemplating:
- .github/workflows/update_pipelinerun.yaml
values:
namespace: ${{ parameters.namespace }}
argocdNamespace: ${{ parameters.argocdNamespace }}
orgName: ${{ parameters.orgName }}
workflowId: ${{ parameters.workflowId }}
gitUrl: git@github.com:${{ parameters.orgName }}/${{ parameters.repoName }}.git
gitOpsUrl: git@github.com:${{ parameters.orgName }}/${{ parameters.repoName }}-gitops.git
quayOrgName: ${{ parameters.quayOrgName }}
quayRepoName: ${{ parameters.quayRepoName }}
targetPath: workflow
- id: publishWorkflow
name: Publishing to the Workflow Repository
action: publish:github
input:
allowedHosts: ["github.com"]
description: ${{ parameters.description }}
repoUrl: github.com?owner=${{ parameters.orgName }}&repo=${{ parameters.repoName }}
defaultBranch: main
sourcePath: workflow
- id: register
name: Registering the Catalog Info Component
action: catalog:register
input:
repoContentsUrl: ${{ steps.publishWorkflow.output.repoContentsUrl }}
catalogInfoPath: /catalog-info.yaml
- id: gitopsCodeTemplate
name: Generating the GitOps Component and Catalog Info Component
action: fetch:template
if: ${{ parameters.CI == 'tekton_argocd' }}
input:
url: ../gitops
values:
workflowId: ${{ parameters.workflowId }}
namespace: ${{ parameters.namespace }}
argocdNamespace: ${{ parameters.argocdNamespace }}
orgName: ${{ parameters.orgName }}
repoName: ${{ parameters.repoName }}-gitops
owner: ${{ parameters.owner }}
system: ${{ parameters.system }}
applicationType: workflow-project
description: ${{ parameters.description }}
sourceControl: github.com
lifecycle: development
gitUrl: git@github.com:${{ parameters.orgName }}/${{ parameters.repoName }}.git
gitOpsUrl: git@github.com:${{ parameters.orgName }}/${{ parameters.repoName }}-gitops.git
persistencePSQLSecretName: ${{ parameters.persistencePSQLSecretName }}
persistencePSQLUserKey: ${{ parameters.persistencePSQLUserKey }}
persistencePSQLPasswordKey: ${{ parameters.persistencePSQLPasswordKey }}
persistencePSQLServiceName: ${{ parameters.persistencePSQLServiceName }}
persistencePSQLServicePort: ${{ parameters.persistencePSQLServicePort }}
persistencePSQLDatabaseName: ${{ parameters.persistencePSQLDatabaseName }}
persistencePSQLDatabaseSchema: ${{ parameters.workflowId }}
quayOrgName: ${{ parameters.quayOrgName }}
quayRepoName: ${{ parameters.quayRepoName }}
targetPath: gitops
- id: renameFilesForPersistence
action: fs:rename
name: Rename files for persistence
input:
files:
- from: gitops/kustomize/base/sonataflow-patch-persistence.yaml
to: gitops/kustomize/base/sonataflow-patch.yaml
overwrite: true
- id: publishGitOps
if: ${{ parameters.CI == 'tekton_argocd' }}
name: Publishing to the GitOps Code Repository
action: publish:github
input:
allowedHosts: ["github.com"]
description: Configuration repository for ${{ parameters.orgName }}/${{ parameters.repoName }}
repoUrl: github.com?owner=${{ parameters.orgName }}&repo=${{ parameters.repoName }}-gitops
defaultBranch: main
sourcePath: gitops
- id: registerGitOps
if: ${{ parameters.CI == 'tekton_argocd' }}
name: Registering the GitOps Catalog Info Component
action: catalog:register
input:
repoContentsUrl: ${{ steps.publishGitOps.output.repoContentsUrl }}
catalogInfoPath: /catalog-info.yaml
output:
links:
- if: ${{ parameters.CI == 'tekton_argocd' }}
title: Bootstrap the GitOps Resources
url: https://github.com/${{ parameters.orgName }}/${{ parameters.repoName }}-gitops/tree/main/bootstrap
- title: Open the Source Code Repository
url: ${{ steps.publishWorkflow.output.remoteUrl }}
- title: Open the Catalog Info Component
icon: catalog
entityRef: ${{ steps.register.output.entityRef }}