-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.yaml
141 lines (139 loc) · 4.68 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
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: rhel9-vm-large-template
title: RHEL9 VM Large Template
description: creates a RHEL9 VM Large
tags:
- rhel9-large
- vm
- workshop
spec:
owner: legacy-java-team
type: VM
parameters:
- title: Provide information about the GitLab location
required:
- group
- host
properties:
host:
title: Repo Host
type: string
description: Your SCM host
default: gitlab-gitlab.apps.cluster-xxxxx.xxxxx.sandboxXXX.opentlc.com
group:
title: Repo Group
type: string
description: Your SCM host organization/group
default: rhdhub
- title: Provide information about the new component
required:
- cluster_id
- namespace
- owner
properties:
cluster_id:
title: Cluster Id
type: string
description: Id of the cluster
default: .apps.cluster-xxxxx.xxxxx.sandboxxx.opentlc.com
namespace:
title: Namespace
type: string
description: Namespace
default: rhdhub-user1
owner:
title: Owner
type: string
description: Owner of the component
ui:field: EntityPicker
ui:options:
catalogFilter:
kind: [User]
- title: Provide Build Information
required:
- component_id
properties:
component_id:
title: Component ID
default: app-legacy
type: string
description: Comp Id
steps:
- id: templateSource
name: Generating the source code component
action: fetch:template
input:
url: ./skeleton
targetPath: ./source
values:
group: ${{parameters.group}}
owner: default/${{parameters.owner}}
cluster_id: ${{parameters.cluster_id}}
namespace: ${{parameters.namespace}}
component_id: ${{parameters.component_id}}
host: ${{ parameters.host }}
repoName: ${{parameters.component_id}}
user_id: ${{parameters.owner}}
- id: publishSource
name: Publishing to Source Code Repository
action: publish:gitlab
input:
sourcePath: ./source
description: ${{parameters.description}}
repoUrl: ${{ parameters.host }}?owner=${{ parameters.group }}&repo=${{parameters.component_id}}
defaultBranch: main
protectDefaultBranch: false
repoVisibility: public
- id: registerSource
name: Registering the Source Code Component
action: catalog:register
input:
repoContentsUrl: ${{steps.publishSource.output.repoContentsUrl}}
catalogInfoPath: /catalog-info.yaml
- id: templateGitops
name: Generating the deployment resources and artefacts
action: fetch:template
input:
url: ./manifests
copyWithoutTemplating: []
values:
component_id: ${{parameters.component_id}}
description: ${{parameters.description}}
destination: https://${{ parameters.host }}/${{ parameters.group }}/${{parameters.component_id}}-gitops.git
source_repository: https://${{ parameters.host }}/${{ parameters.group }}/${{parameters.component_id}}.git
repository_name: ${{parameters.component_id}}
git_host: ${{ parameters.host }}
org: ${{parameters.group}}
cluster: ${{parameters.cluster_id}}
namespace: ${{parameters.namespace}}
user_id: ${{parameters.owner}}
targetPath: ./tenant-gitops
- id: publishGitops
name: Publishing to Deployment Resource Repository
action: publish:gitlab
input:
repoUrl: ${{ parameters.host }}?owner=${{ parameters.group }}&repo=${{parameters.component_id}}-gitops
title: gitops resources for ${{parameters.namespace}}-gitops
description: gitops resources for ${{parameters.namespace}}-gitops
sourcePath: ./tenant-gitops
defaultBranch: main
protectDefaultBranch: false
repoVisibility: public
- id: createArgoResources
name: Create ArgoCD Resources
action: argocd:create-resources
input:
appName: ${{parameters.component_id}}-gitops
argoInstance: main
namespace: rhdhub
repoUrl: https://${{ parameters.host }}/${{ parameters.group }}/${{parameters.component_id}}-gitops.git
path: 'argocd/'
output:
links:
- title: Source Code Repository
url: ${{steps.publishSource.output.remoteUrl}}
- title: Open Component in catalog
icon: catalog
entityRef: ${{steps.registerSource.output.entityRef}}