-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
58 lines (55 loc) · 2.23 KB
/
action.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
name: 'K8s NetworkPolicy Connectivity Report'
description: 'Produce a network-connectivity report of your K8s application'
author: 'shift-left-netconfig project'
branding:
icon: shield
color: green
inputs:
deployment-path:
description: The path in the repository where deployment yamls are
required: false
default: .
netpol-path:
description: The path in the repository where NetworkPolicy yamls are
required: false
default: .
output-format:
description: Connectivity report format (either "md", "yaml", "csv", "dot" or "txt")
required: false
default: md
outputs:
conn-results-artifact:
description: The name of the artifact containing the connectivity report
value: ${{ steps.output-results.outputs.conn-results-artifact }}
conn-results-file:
description: The name of the actual file in the artifact, which contains the connectivity report
value: ${{ steps.output-results.outputs.conn-results-file-name }}
runs:
using: 'composite'
steps:
- name: Prepare output directory
shell: bash
run: |
mkdir -p ${{ github.workspace }}/netpol-reports-gh-action-output
chmod a+rw ${{ github.workspace }}/netpol-reports-gh-action-output
- name: Connectivity map
uses: docker://ghcr.io/np-guard/nca:1.2.0
with:
args: >
--connectivity /github/workspace/${{ inputs.netpol-path }}
--pod_list /github/workspace/${{ inputs.deployment-path }}
--ns_list /github/workspace/${{ inputs.deployment-path }}
--output_format ${{ inputs.output-format }}
--file_out /github/workspace/netpol-reports-gh-action-output/connectivity_report.${{ inputs.output-format }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: connectivity-report
path: ${{ github.workspace }}/netpol-reports-gh-action-output/connectivity_report.${{ inputs.output-format }}
- name: Set outputs and clean
id: output-results
shell: bash
run: |
echo "::set-output name=conn-results-artifact::connectivity-report"
echo "::set-output name=conn-results-file-name::connectivity_report.${{ inputs.output-format }}"
rm -r ${{ github.workspace }}/netpol-reports-gh-action-output