-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
258 lines (241 loc) · 9.45 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
# CEDA Backstage GitHub Public Python Library Template
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
# Basic Template Information
metadata:
name: ceda-github-python-library
title: CEDA GitHub Python Library
description: Create a Python library or client in the CEDADEV organisation
# Templated Information
spec:
owner: group:default/developers
type: library
parameters:
- title: Basic Library Information
description: Please enter the basic information about your new repository on GitHub/cedadev
required:
- name
- slug
- description
- visibility
properties:
name:
title: Software name
type: string
description: The name of the component in this software catalogue (i.e. "CEDA ServiceX Client).
ui:autofocus: true
ui:options:
rows: 1
slug:
title: Repository Slug (Name)
type: string
description: The slug for the repository, (i.e. "ceda-servicex-client"), containing only dashes as separators.
ui:options:
rows: 1
pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"
description:
title: Description
type: string
description: A brief description of the library.
ui:options:
rows: 5
visibility:
title: Visibility
type: string
description: The visibility of the repository
default: public
enum:
- public
- private
enumNames:
- Public (default)
- Private (visible only to CEDADEV organisational members on github)
- title: CEDA Ecosystem
description: Please describe how this new library fits into the CEDA software ecosystem
required:
- domains
properties:
domains:
title: CEDA Software Domain(s)
description: |
All CEDA software exists in one or more domains. Please select the domain(s) that this library
applies to. If a suitable domain doesn't exist yet please add it in the ceda-backstage-catalog repo in GitHub/cedadev.
type: array
items:
type: string
ui:field: MultiEntityPicker
ui:options:
catalogFilter:
- kind: Domain
- title: Software Quality Measures
required:
- testCoverage
- mccabeCodeQualityAverage
- mccabeCodeQualityModule
- mccabeCodeQualityBlock
- banditSkips
- dependencySkips
properties:
testCoverage:
title: Test Coverage
description: Uses the slider to define the minimum level of test coverage. The CI pipeline will fail if your code does not reach this level.
type: integer
minimum: 0
maximum: 100
multipleOf: 5
default: 100
ui:widget: range
mccabeCodeQualityAverage:
title: McCabe Code Quality (minimum average for entire project)
description: Set the minimum cyclomatic complexity score you consider valid for your entire codebase. A-C are considered to be "good, readable code".
type: string
enum: [ A, B, C, D, E, F ]
default: A
mccabeCodeQualityModule:
title: McCabe Code Quality (minimum value for any given file)
description: Set the minimum cyclomatic complexity score you consider valid for any given file in your codebase. A-C are considered to be "good, readable code".
type: string
enum: [ A, B, C, D, E, F ]
default: A
mccabeCodeQualityBlock:
title: McCabe Code Quality (minimum value for any given block of code)
description: Set the minimum cyclomatic complexity score you consider valid for any given block (function, method, class, etc.). A-C are considered to be "good, readable code".
type: string
enum: [ A, B, C, D, E, F ]
default: B
banditSkips:
title: Allowable Bandit Exemption Rules
type: array
description: Add any Bandit security check codes which may not be valid for your project (i.e. "B703" and "B308" are common false positives in Django applications)
items:
title: "Add error code to disable a Bandit check"
type: string
dependencySkips:
title: Allowable CVE Vulnerabilities
type: array
description: |
Add any CVE vulnerabilities that you know are false positives (for example,
"CVE-2019-8341" is a known vulnerability in Jinja2 that CANNOT occur outside of
web application frameworks), but is required by our build software.
It is included here by default.
items:
title: "Add known / allowable CVE issues for this library"
type: string
pattern: ^CVE-\d{4}-\d{4,7}$
default:
- CVE-2019-8341
linterRules:
title: Applied Ruff linter rules
type: array
description: |
Add any Ruff linter rules to be applied to your code. Buy default this template will apply
ALL rules, but this can be removed here. A less restrictive set of rules would be "F" and "E".
items:
title: "Add a Ruff linter rule"
type: string
default:
- "ALL"
linterIgnores:
title: Ignored Ruff linter rules
type: array
description: |
Add any Ruff linter rules which will be ignored (regardless of select "ALL" rules in the previous
section. The ignored rules here are selected because they contradict other rules.
items:
title: "Ignore a Ruff linter rule"
type: string
default:
- D200
- D212
- D400
- D401
- D415
strictTypeChecking:
title: Enable MyPy's Strict Mode
description: Strict Type Checking will greatly enhance your code's security and is strongly encouraged.
type: boolean
default: true
strictImportChecking:
title: Enable MyPy's strict import checking
description: |
Import checking will prevent you fomr using libraries which are not statically type annotated,
this is a powerful feature but it will break for many 3rd party libraries.
type: boolean
default: false
pythonVersions:
title: Supported Python Versions
description: Deselect the versions of python you do not wish to support
type: array
items:
title: Supported Python Version
type: string
pattern: ^3\.[0-9]{1,2}$
default:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
# Steps undertaken by backstage after completion of the template form
steps:
- id: fetch-base
name: Fetch Base
action: fetch:template
input:
url: ./github_content
targetPath: ./ghub
values:
name: ${{ parameters.name }}
author: ${{ user.entity }}
description: ${{ parameters.description }}
slug: ${{ parameters.slug }}
module: ${{ parameters.slug | replace("-", "_") }}
moduleLength: ${{ parameters.slug | length }}
gitAuthorName: ${{ user.entity.metadata.name }}
gitAuthorEmail: ${{ user.entity.spec.profile.email }}
domains: ${{ parameters.domains }}
testCoverage: ${{ parameters.testCoverage }}
mccabeCodeQualityAverage: ${{ parameters.mccabeCodeQualityAverage }}
mccabeCodeQualityModule: ${{ parameters.mccabeCodeQualityModule }}
mccabeCodeQualityBlock: ${{ parameters.mccabeCodeQualityBlock }}
banditSkips: ${{ parameters.banditSkips }}
dependencySkips: ${{ parameters.dependencySkips }}
linterRules: ${{ parameters.linterRules }}
linterIgnores: ${{ parameters.linterIgnores }}
strictTypeChecking: ${{ parameters.strictTypeChecking }}
ignoreStrictImportChecking: ${{ not parameters.strictImportChecking }}
pythonVersions: ${{ parameters.pythonVersions }}
- id: publish
name: Publish
action: publish:github
input:
sourcePath: ./ghub
gitAuthorName: ${{ user.entity.metadata.name }}
gitAuthorEmail: ${{ user.entity.spec.profile.email }}
allowedHosts:
- github.com
description: ${{ parameters.description }}
repoUrl: github.com?owner=cedadev&repo=${{ parameters.slug }}
repoVisibility: ${{ parameters.visibility }}
defaultBranch: main
homepage: https://cedadev.github.io/${{ parameters.slug }}/
- id: github-pages
name: Enable GitHub Pages
action: github:pages:enable
input:
repoUrl: github.com?owner=cedadev&repo=${{ parameters.slug }}
buildType: legacy
- id: register
name: Register
action: catalog:register
input:
repoContentsUrl: ${{ steps['publish'].output.repoContentsUrl }}
catalogInfoPath: '/catalog-info.yaml'
# some outputs which are saved along with the job for use in the frontend
output:
links:
- title: Repository
url: ${{ steps['publish'].output.remoteUrl }}
- title: Open in catalog
icon: catalog
entityRef: ${{ steps['register'].output.entityRef }}