-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
246 lines (234 loc) · 8.17 KB
/
template.yaml
File metadata and controls
246 lines (234 loc) · 8.17 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
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
---
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: aws-sam-nodejs-crud
title: AWS Serverless CRUD API (NodeJS/Typescript)
description: |
Create a NodeJS / Typescript AWS serverless CRUD backend API.
This template provides the following for the newly created Component
* AWS API Gateway
* Lambda functions for CRUD operations
* With starter code
* With starter tests
* With starter mock data and schemas
* A DynamoDB table
* GitHub Actions build and deploy workflows
* Starter OpenAPI spec file
tags:
- aws
- serverless
- nodejs
- typescript
- api
spec:
owner: group:00gjdgxs1ur6lsu
type: component
parameters:
- title: Component Info
required:
- lifecycle
- namespace
- github_org
- component_name
- description
- owner
- system
- domain
- account_id
properties:
lifecycle:
title: Lifecycle
type: string
description: Lifecycle for the component
default: production
ui:widget: hidden
namespace:
title: Namespace
type: string
description: Namespace for the component
default: default
ui:widget: hidden
github_org:
title: GitHub Org
type: string
description: GitHub organization to publish to
default: ServerlessOpsIO
ui:widget: hidden
component_name:
title: Name
type: string
description: Unique name of the component
ui:field: EntityNamePicker
description:
title: Description
type: string
description: Short description of the component
owner:
title: Owner
type: string
description: |
Owning group of entity.
ui:field: MyGroupsPicker
ui:options:
allowArbitraryValues: false
domain:
title: Domain
type: string
description: Domain the component belongs to.
ui:field: SoContextualEntityPicker
ui:options:
allowArbitraryValues: false
catalogFilter:
- kind: Domain
defaultKind: Domain
system:
title: System
type: string
description: System the component belongs to.
ui:field: SoContextualEntityPicker
ui:options:
allowArbitraryValues: false
catalogFilter:
- kind: System
relations.partOf: "{{ parameters.domain }}"
defaultKind: System
account_id:
title: Account ID
type: string
description: Cloud account to deploy to
ui:field: SoContextualEntityPicker
ui:options:
allowArbitraryValues: false
catalogFilter:
- kind: Resource
relations.partOf: "{{ parameters.system }}"
spec.type: cloud-account
defaultKind: System
- title: Software configuration
required:
- hostname
- collection_name
- api_description
- nodejs_version
properties:
hostname:
title: Hostname
type: string
description: Site FQDN; ex. api.app.serverlessops.io
url_path_prefix:
title: Path Prefix (without collection name)
type: string
description: Path prefix for API; ex. /v1
default: '/v1'
collection_name:
title: Collection Name
type: string
description: Name of API collection; eg. <path_prefix>/<collection_name> -> /v1/thing
api_description:
title: API Description
type: string
description: Description of the API
'ui:widget': 'textarea'
nodejs_version:
title: NodeJS Version
type: string
description: NodeJS version to use
default: '20'
enum:
- '20'
- '22'
steps:
- id: fetch
name: Fetch Entity References
action: catalog:fetch
input:
entityRefs:
- ${{ parameters.owner }}
- ${{ parameters.domain }}
- ${{ parameters.system }}
- ${{ parameters.account_id }}
- id: create-skeleton
name: Create project skeleton
action: fetch:template
input:
url: ./skeleton/base
values:
domain_name: ${{ parameters.domain | parseEntityRef | pick('name') }}
system_name: ${{ parameters.system | parseEntityRef | pick('name') }}
component_name: ${{ parameters.component_name }}
owner_name: ${{ parameters.system | parseEntityRef | pick('name') }}
description: ${{ parameters.description }}
api_description: ${{ parameters.api_description }}
hostname: ${{ parameters.hostname }}
collection_name: ${{ parameters.collection_name }}
collection_name_cap: ${{ parameters.collection_name | capitalize }}
github_org: ${{ parameters.github_org }}
lifecycle: ${{ parameters.lifecycle }}
nodejs_version: ${{ parameters.nodejs_version }}
- id: add-crud-skeleton
name: Add API project skeleton
action: fetch:template
input:
url: ./skeleton/crud
values:
domain_name: ${{ parameters.domain | parseEntityRef | pick('name') }}
system_name: ${{ parameters.system | parseEntityRef | pick('name') }}
component_name: ${{ parameters.component_name }}
owner_name: ${{ parameters.system | parseEntityRef | pick('name') }}
description: ${{ parameters.description }}
api_description: ${{ parameters.api_description }}
hostname: ${{ parameters.hostname }}
collection_name: ${{ parameters.collection_name }}
collection_name_cap: ${{ parameters.collection_name | capitalize }}
github_org: ${{ parameters.github_org }}
lifecycle: ${{ parameters.lifecycle }}
nodejs_version: ${{ parameters.nodejs_version }}
url_path_prefix: ${{ parameters.url_path_prefix }}
- id: create-functions
name: Create project functions
action: fetch:template
input:
url: ./functions/crud
values:
domain_name: ${{ parameters.domain | parseEntityRef | pick('name') }}
system_name: ${{ parameters.system | parseEntityRef | pick('name') }}
component_name: ${{ parameters.component_name }}
description: ${{ parameters.description }}
collection_name: ${{ parameters.collection_name | capitalize }}
collection_name_cap: ${{ parameters.collection_name | capitalize }}
url_path_prefix: ${{ parameters.url_path_prefix }}
- id: cluster-pipeline
name: Create CI/CD pipeline
action: fetch:template
input:
url: ./pipeline
values:
domain_name: ${{ parameters.domain | parseEntityRef | pick('name') }}
system_name: ${{ parameters.system | parseEntityRef | pick('name') }}
nodejs_version: ${{ parameters.nodejs_version }}
- id: publish
name: Publish to GitHub
action: publish:github
input:
owner: tmclaugh
repoUrl: github.com?repo=${{ parameters.component_name }}&owner=${{ parameters.github_org }}
repoVisibility: public
protectDefaultBranch: false
requiredApprovingReviewCount: 0
description: ${{ parameters.description }}
gitAuthorName: ${{ user.entity.spec.profile.displayName }}
gitAuthorEmail: ${{ user.entity.spec.profile.email }}
gitCommitMessage: "Initial commit via Backstage"
defaultBranch: main
secrets:
DEPLOYMENT_ACCOUNT_ID: ${{ steps.fetch.output.entities[3].metadata.title }}
topics:
- "domain:${{ parameters.domain | parseEntityRef | pick('name') }}"
- "system:${{ parameters.system | parseEntityRef | pick('name') }}"
- id: register
name: Register in Backstage
action: catalog:register
input:
repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
catalogInfoPath: "/catalog-info.yaml"