forked from metal3-io/cluster-api-provider-metal3
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (57 loc) · 1.96 KB
/
kubesec.yml
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
name: Kubesec
on:
push:
branches: [ main ]
schedule:
- cron: '30 7 * * 3'
permissions:
contents: read
jobs:
setup:
# This workflow is only of value to the metal3-io/cluster-api-provider-metal3 repository and
# would always fail in forks
if: github.repository == 'metal3-io/cluster-api-provider-metal3'
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Collect all yaml
id: list_yaml
run: |
LIST_YAML="$(find * -type f -name '*.yaml' ! -name "clusterctl-cluster.yaml")"
echo "::set-output name=value::$(IFS=$','; echo $LIST_YAML | jq -cnR '[inputs | select(length>0)]'; IFS=$'\n')"
outputs:
matrix: ${{ steps.list_yaml.outputs.value }}
lint:
needs: [ setup ]
name: Kubesec
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write
strategy:
matrix:
value: ${{ fromJson(needs.setup.outputs.matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Run kubesec scanner
uses: controlplaneio/kubesec-action@43d0ddff5ffee89a6bb9f29b64cd865411137b14
with:
input: ${{ matrix.value }}
format: template
template: template/sarif.tpl
output: ${{ matrix.value }}.sarif
exit-code: "0"
- name: Save result into a variable
id: save_result
run: echo "::set-output name=result::$(cat ${{ matrix.value }}.sarif | jq -c '.runs')"
- name: Upload Kubesec scan results to GitHub Security tab
if: ${{ steps.save_result.outputs.result != '[]' }}
uses: github/codeql-action/upload-sarif@f6e388ebf0efc915c6c5b165b019ee61a6746a38 # v2.20.1
with:
sarif_file: ${{ matrix.value }}.sarif