-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
60 lines (57 loc) · 2.35 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
59
60
name: 'K8s NetworkPolicy Diff'
description: 'Produce a network-connectivity diff between two versions of a your K8s app'
author: 'NP-Guard project'
branding:
icon: shield
color: green
inputs:
old-path:
description: The path in the GitHub Workspace where the old version was checked-out
required: true
new-path:
description: The path in the GitHub Workspace where the new version was checked-out
required: true
output-format:
description: Diff format (either "md", "yaml" or "txt")
required: false
default: md
outputs:
diff-results-artifact:
description: The name of the artifact containing the diff report
value: ${{ steps.output-results.outputs.diff-results-artifact }}
diff-results-file:
description: The name of the actual file in the artifact, which contains the diff report
value: ${{ steps.output-results.outputs.diff-results-file-name }}
runs:
using: 'composite'
steps:
- name: Prepare output directory
shell: bash
run: |
mkdir -p ${{ github.workspace }}/netpol-diff-gh-action-output
chmod a+rw ${{ github.workspace }}/netpol-diff-gh-action-output
- name: Connectivity diff
uses: docker://ghcr.io/np-guard/nca:1.2.0
with:
args: >
--semantic_diff /github/workspace/${{ inputs.new-path }}
--base_np_list /github/workspace/${{ inputs.old-path }}
--pod_list /github/workspace/${{ inputs.new-path }}
--base_pod_list /github/workspace/${{ inputs.old-path }}
--ns_list /github/workspace/${{ inputs.new-path }}
--base_ns_list /github/workspace/${{ inputs.old-path }}
--output_format ${{ inputs.output-format }}
--file_out /github/workspace/netpol-diff-gh-action-output/diff_report.${{ inputs.output-format }}
--return_0
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: connectivity-diff-results
path: ${{ github.workspace }}/netpol-diff-gh-action-output/diff_report.${{ inputs.output-format }}
- name: Set outputs and clean
id: output-results
shell: bash
run: |
echo "::set-output name=diff-results-artifact::connectivity-diff-results"
echo "::set-output name=diff-results-file-name::diff_report.${{ inputs.output-format }}"
rm -r ${{ github.workspace }}/netpol-diff-gh-action-output