-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (227 loc) · 8.12 KB
/
Copy pathvalidate.yml
File metadata and controls
247 lines (227 loc) · 8.12 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
247
name: reusable / validate
# Every composite-action reference below is pinned to the full
# owner/repo/path@ref form (portainer/github-actions/.github/actions/x@ref),
# never a local `./` path. Reusable-workflow steps run with the CALLING
# repository's context, so a local `./` reference here would resolve
# against whatever repo is consuming this workflow, not this one — that's
# true regardless of which repo hosts the workflow file, and it's the
# reason a dedicated shared-workflows repo doesn't get local paths "for
# free" just by existing. Only the pinned form is fetched deterministically.
#
# Those refs are pinned to the tag this repo is releasing as, never to
# develop — an internal reference can't be a SHA of its own commit, so the
# tag is what keeps a released workflow and the actions it calls in
# lockstep. scripts/pin-internal-refs.py bumps and verifies them; run
# `bump <tag>` to prepare the commit, then `verify <tag>` before pushing
# the tag.
#
# checkout-with-submodules performs its own real checkout of the calling
# repo (with a scoped GitHub App token, for submodule access) — no
# preparation checkout is needed before calling it, since a pinned action
# reference is fetched directly by the runner regardless of workspace
# content. The `secrets` and `helm` jobs below DO keep a plain checkout —
# not to make a local path resolvable, but because their own steps need the
# caller's real repo content (full git history for gitleaks, the actual
# chart/ directory for helm) that no composite action call in those jobs
# otherwise provides.
on:
workflow_call:
inputs:
runtime:
description: 'bun or node'
type: string
required: true
package-manager:
description: 'bun, pnpm, or npm'
type: string
required: true
bun-version:
type: string
required: false
default: '1.3.14'
node-version:
type: string
required: false
default: '24'
app-repositories:
description: 'Comma-separated repo list the checkout token is scoped to (this repo plus any private submodules), e.g. "my-app,my-private-submodule"'
type: string
required: true
submodules:
type: string
required: false
default: 'true'
run-format-check:
type: boolean
required: false
default: true
run-lint:
type: boolean
required: false
default: true
run-typecheck:
type: boolean
required: false
default: true
run-test:
type: boolean
required: false
default: true
run-build:
type: boolean
required: false
default: true
format-check-script:
type: string
required: false
default: 'format:check'
lint-script:
type: string
required: false
default: 'lint'
typecheck-script:
type: string
required: false
default: 'typecheck'
test-script:
type: string
required: false
default: 'test'
build-script:
type: string
required: false
default: 'build'
run-secrets-scan:
type: boolean
required: false
default: true
run-helm:
type: boolean
required: false
default: true
gitleaks-version:
type: string
required: false
default: '8.30.1'
gitleaks-sha256:
type: string
required: false
default: '551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb'
chart-path:
type: string
required: false
default: 'chart/'
enforce-no-secrets-guard:
description: >
Opt-in only — see chart-render-guard's own description. Charts that
legitimately render a Secret would fail CI/release with this on.
type: boolean
required: false
default: false
secrets:
app-id:
required: true
app-private-key:
required: true
jobs:
lint:
name: lint
if: inputs.run-format-check || inputs.run-lint || inputs.run-typecheck
runs-on: ubuntu-latest
steps:
- uses: portainer/github-actions/.github/actions/checkout-with-submodules@v1.0.0
with:
app-id: ${{ secrets.app-id }}
private-key: ${{ secrets.app-private-key }}
repositories: ${{ inputs.app-repositories }}
submodules: ${{ inputs.submodules }}
- uses: portainer/github-actions/.github/actions/setup-toolchain@v1.0.0
with:
runtime: ${{ inputs.runtime }}
package-manager: ${{ inputs.package-manager }}
bun-version: ${{ inputs.bun-version }}
node-version: ${{ inputs.node-version }}
- name: '[validation] check formatting'
if: inputs.run-format-check
shell: bash
run: ${{ inputs.package-manager }} run ${{ inputs.format-check-script }}
- name: '[validation] run lint'
if: inputs.run-lint
shell: bash
run: ${{ inputs.package-manager }} run ${{ inputs.lint-script }}
- name: '[validation] run typecheck'
if: inputs.run-typecheck
shell: bash
run: ${{ inputs.package-manager }} run ${{ inputs.typecheck-script }}
test:
name: test
if: inputs.run-test
runs-on: ubuntu-latest
steps:
- uses: portainer/github-actions/.github/actions/checkout-with-submodules@v1.0.0
with:
app-id: ${{ secrets.app-id }}
private-key: ${{ secrets.app-private-key }}
repositories: ${{ inputs.app-repositories }}
submodules: ${{ inputs.submodules }}
- uses: portainer/github-actions/.github/actions/setup-toolchain@v1.0.0
with:
runtime: ${{ inputs.runtime }}
package-manager: ${{ inputs.package-manager }}
bun-version: ${{ inputs.bun-version }}
node-version: ${{ inputs.node-version }}
- name: '[validation] run tests'
shell: bash
run: ${{ inputs.package-manager }} run ${{ inputs.test-script }}
build:
name: build
if: inputs.run-build
runs-on: ubuntu-latest
steps:
- uses: portainer/github-actions/.github/actions/checkout-with-submodules@v1.0.0
with:
app-id: ${{ secrets.app-id }}
private-key: ${{ secrets.app-private-key }}
repositories: ${{ inputs.app-repositories }}
submodules: ${{ inputs.submodules }}
- uses: portainer/github-actions/.github/actions/setup-toolchain@v1.0.0
with:
runtime: ${{ inputs.runtime }}
package-manager: ${{ inputs.package-manager }}
bun-version: ${{ inputs.bun-version }}
node-version: ${{ inputs.node-version }}
- name: '[validation] run build'
shell: bash
run: ${{ inputs.package-manager }} run ${{ inputs.build-script }}
secrets:
name: secrets
if: inputs.run-secrets-scan
runs-on: ubuntu-latest
steps:
- name: '[preparation] checkout (gitleaks needs real, full git history)'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: portainer/github-actions/.github/actions/install-and-run-gitleaks@v1.0.0
with:
gitleaks-version: ${{ inputs.gitleaks-version }}
gitleaks-sha256: ${{ inputs.gitleaks-sha256 }}
helm:
name: helm
if: inputs.run-helm
runs-on: ubuntu-latest
steps:
- name: '[preparation] checkout (need the real chart/ directory from the caller)'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: '[preparation] set up helm'
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1
- name: '[validation] lint chart'
shell: bash
run: helm lint ${{ inputs.chart-path }}
- name: '[validation] template chart (dry-run render)'
shell: bash
run: helm template release-check ${{ inputs.chart-path }} > /dev/null
- uses: portainer/github-actions/.github/actions/chart-render-guard@v1.0.0
if: inputs.enforce-no-secrets-guard
with:
chart-path: ${{ inputs.chart-path }}