-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtemplate.yaml
More file actions
200 lines (193 loc) · 7.39 KB
/
template.yaml
File metadata and controls
200 lines (193 loc) · 7.39 KB
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
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: quarkus-web-template
title: Quarkus Service
description: Create a simple microservice using Quarkus with Argo CD
tags:
- recommended
- java
- quarkus
- maven
spec:
owner: rhdh
type: service
parameters:
- title: Provide Information for Application
required:
- component_id
- java_package_name
properties:
component_id:
title: Name
type: string
description: Unique name of the component
default: my-quarkus-app
ui:field: EntityNamePicker
maxLength: 18
group_id:
title: Group Id
type: string
default: com.redhat.rhdh
description: Maven Group Id
artifact_id:
title: Artifact Id
type: string
default: quarkus-app
description: Maven Artifact Id
java_package_name:
title: Java Package Name
default: com.redhat.rhdh
type: string
description: Name for the java package. eg (com.redhat.blah)
description:
title: Description
type: string
description: Help others understand what this website is for.
default: A cool quarkus app
- title: Provide Image Registry Information
required:
- image_registry
properties:
image_registry:
title: Image Registry
type: string
enum:
- OpenShift
- Quay
dependencies:
image_registry:
oneOf:
- properties:
image_registry:
enum:
- OpenShift
image_host:
title: Image Host
type: string
description: Host for storing image
default: image-registry.openshift-image-registry.svc:5000
image_tag:
title: Image Tag
default: latest
type: string
description: Build Image tag
- properties:
image_registry:
enum:
- Quay
image_host:
title: Image Host
type: string
description: Host for storing image
default: {{ quay_host }}
image_password:
title: Password
type: string
description: Your Quay password
ui:field: Secret
image_tag:
title: Image Tag
default: latest
type: string
description: Build Image tag
- title: Application repository Information
required:
- repo
properties:
repo:
title: Repository Location
type: object
properties:
host:
title: Repo Host
type: string
description: Your SCM host
default: {{ gitlab_host }}
enum:
- {{ gitlab_host }}
steps:
- id: template
name: Fetch Skeleton + Template
action: fetch:template
input:
url: ./skeleton
values:
component_id: {{ '${{ parameters.component_id }}' }}
description: {{ '${{ parameters.description }}' }}
namespace: {{ '${{ parameters.component_id }}' }}-dev
group_id: {{ '${{ parameters.group_id }}' }}
artifact_id: {{ '${{ parameters.artifact_id }}' }}
java_package_name: {{ '${{ parameters.java_package_name }}' }}
owner: {{ '${{ user.entity.metadata.name }}' }}
cluster: {{ cluster_subdomain }}
host: {{ '${{ parameters.repo.host }}' }}
destination: {{ '${{ user.entity.metadata.name }}' }}/{{ '${{ parameters.component_id }}' }}
port: 8080
gitops_namespace: {{ rhdh_gitops_namespace }}
targetPath: {{ './${{ user.entity.metadata.name }}-${{parameters.component_id}}' }}
- id: publish
name: Publish
action: publish:gitlab
input:
repoUrl: "{{ '${{ parameters.repo.host }}' }}?owner={{ '${{ user.entity.metadata.name }}' }}&repo={{ '${{parameters.component_id}}' }}"
repoVisibility: public
defaultBranch: main
sourcePath: {{ './${{ user.entity.metadata.name }}-${{parameters.component_id}}' }}
- id: register
name: Register
action: catalog:register
input:
repoContentsUrl: {{ '${{ steps.publish.output.repoContentsUrl }}' }}
catalogInfoPath: "/catalog-info.yaml"
- id: template-gitops-deployment
name: Generating Deployment Resources
action: fetch:template
input:
url: ./manifests
copyWithoutTemplating: []
values:
component_id: {{ '${{ parameters.component_id }}' }}
source_repository_gitops: https://{{ '${{ parameters.repo.host }}' }}/{{ '${{ user.entity.metadata.name }}' }}/{{ '${{parameters.component_id}}' }}-gitops.git
source_repository: https://{{ '${{ parameters.repo.host }}' }}/{{ '${{ user.entity.metadata.name }}' }}/{{ '${{parameters.component_id}}' }}.git
owner: {{ '${{ user.entity.metadata.name }}' }}
namespace: {{ '${{ user.entity.metadata.name }}-${{ parameters.component_id }}' }}-dev
image_registry: {{ '${{ parameters.image_registry }}' }}
image_host: {{ '${{ parameters.image_host }}' }}
image_organization: {{ '${{ user.entity.metadata.name }}' }}
image_password: {{ '${{ secrets.image_password }}' }}
image_name: {{ '${{ parameters.component_id }}' }}
image_tag: {{ '${{ parameters.image_tag }}' }}
gitops_namespace: {{ rhdh_gitops_namespace }}
gitops_project: {{ rhdh_gitops_project }}
port: 8080
cluster_subdomain: {{ cluster_subdomain }}
repository_host: {{ '${{ parameters.repo.host }}' }}
targetPath: {{ './${{ user.entity.metadata.name }}-${{parameters.component_id}}-gitops' }}
- id: publish-gitops
name: Publishing to Resource Repository
action: publish:gitlab
input:
repoUrl: "{{ '${{ parameters.repo.host }}' }}?owner={{ '${{ user.entity.metadata.name }}' }}&repo={{ '${{parameters.component_id}}' }}-gitops"
repoVisibility: public
defaultBranch: main
# Causing error with RHDH 1.8 - not valid inputs to the plugin
# title: gitops resources for {{ '${{ parameters.component_id }}' }}
# description: gitops resources for {{ '${{ parameters.component_id }}' }}
sourcePath: {{ './${{ user.entity.metadata.name }}-${{parameters.component_id}}-gitops' }}
- id: create-argocd-resources
name: Create Argo CD Resources
action: argocd:create-resources
input:
appName: {{ '${{ user.entity.metadata.name }}-${{ parameters.component_id }}' }}-bootstrap
argoInstance: main
namespace: {{ rhdh_gitops_namespace }}
repoUrl: https://{{ '${{ parameters.repo.host }}' }}/{{ '${{ user.entity.metadata.name }}' }}/{{ '${{ parameters.component_id }}' }}-gitops.git
path: 'argocd/'
output:
links:
- title: Source Code Repository
url: {{ '${{ steps.publish.output.remoteUrl }}' }}
- title: Open Component in catalog
icon: catalog
entityRef: {{ '${{ steps.register.output.entityRef }}' }}