Skip to content

Commit 7d2763b

Browse files
author
sharmayajush
committed
added seperate actions for install and report
update added flags and args fixes added branding fixes
1 parent d090df1 commit 7d2763b

File tree

3 files changed

+149
-48
lines changed

3 files changed

+149
-48
lines changed

action.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

actions/install-action/action.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: accuknox-install
2+
description: 'Install accuknox-cli, kubearmor and discovery engine '
3+
inputs:
4+
kubearmor-image:
5+
description: 'kubearmor image to be installed'
6+
required: true
7+
default: ""
8+
discovery-engine-image:
9+
description: 'discovery engine image to be installed'
10+
required: true
11+
default: ""
12+
workload-namespace:
13+
description: 'workload namespaces'
14+
required: false
15+
default: ""
16+
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Checkout accuknox-cli repo and install kubearmor and discovery engine
22+
uses: actions/checkout@v3
23+
with:
24+
repository: rajaSahil/accuknox-cli
25+
ref: feat-report
26+
path: accuknox-cli
27+
run: |
28+
cd accuknox-cli
29+
./accuknox-cli version
30+
31+
setupArgs=""
32+
if [ "${{ inputs.kubearmor-image }}" != "" ]; then
33+
setupArgs+= " -i ${{ inputs.kubearmor-image }}"
34+
fi
35+
if [ "${{ inputs.discovery-engine-image }}" != "" ];then
36+
setupArgs += " -di ${{ inputs.discovery-engine-image }}"
37+
fi
38+
if [ "${{ inputs.workload-namespace }}" != "" ];then
39+
setupArgs += " -n ${{ inputs.workload-namespace }}"
40+
fi
41+
42+
./accuknox-cli install $setupArgs
43+
shell: bash
44+
45+
branding:
46+
icon: 'check-circle'
47+
color: 'green'

actions/report-action/action.yaml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: accuknox-report
2+
description: 'Get reports using kubearmor and discovery engine'
3+
inputs:
4+
baseline-report-path:
5+
description: 'baseline report path'
6+
required: true
7+
default: "baseline/report.json"
8+
labels:
9+
description: 'labels. possible value: kubearmor-app: kubearmor-relay'
10+
required: false
11+
default: ""
12+
operation:
13+
description: 'operation. possible values: process, file, network, syscall'
14+
required: false
15+
default: ""
16+
container-name:
17+
description: 'container name'
18+
required: false
19+
default: ""
20+
namespaces:
21+
description: 'namespaces'
22+
required: false
23+
default: ""
24+
workloads:
25+
description: 'workloads. possible values: deployment/mysql, statefulsets/vault, deployment/*'
26+
required: false
27+
default: ""
28+
source:
29+
description: 'source'
30+
required: false
31+
default: ""
32+
process-ignore-paths:
33+
description: 'process ignore paths. possible value: /sbin '
34+
required: false
35+
default: ""
36+
file-ignore-paths:
37+
description: 'file ignore paths. possible value: /sbin '
38+
required: false
39+
default: ""
40+
ignore-return-code:
41+
description: 'ignore return code. possible values: true/false'
42+
required: false
43+
default: ""
44+
view:
45+
description: 'view type. possible value: tabular'
46+
required: false
47+
default: "tabular"
48+
49+
50+
runs:
51+
using: "composite"
52+
steps:
53+
- name: Generate report
54+
run: |
55+
setupArgs=""
56+
if [ "${{ inputs.baseline-report-path }}" != "" ]; then
57+
setupArgs+=" -b ${{ inputs.baseline-report-path }}"
58+
fi
59+
if [ "${{ inputs.labels }}" != "" ]; then
60+
setupArgs+=" -l ${{ inputs.labels }}"
61+
fi
62+
if [ "${{ inputs.operation }}" != "" ]; then
63+
setupArgs+=" -t ${{ inputs.operation }}"
64+
fi
65+
if [ "${{ inputs.container-name }}" != "" ]; then
66+
setupArgs+=" --container ${{ inputs.container-name }}"
67+
fi
68+
if [ "${{ inputs.namespaces }}" != "" ]; then
69+
setupArgs+=" -n ${{ inputs.namespaces }}"
70+
fi
71+
if [ "${{ inputs.source }}" != "" ]; then
72+
setupArgs+=" -s ${{ inputs.source }}"
73+
fi
74+
if [ "${{ inputs.file-ignore-paths }}" != "" ]; then
75+
setupArgs+=" -i ${{ inputs.file-ignore-paths }}"
76+
fi
77+
if [ "${{ inputs.process-ignore-paths }}" != "" ]; then
78+
setupArgs+=" -i ${{ inputs.process-ignore-paths }}"
79+
fi
80+
81+
./accuknox-cli report $setupArgs
82+
83+
mkdir downloads
84+
mv /tmp/report-*.json downloads/report.json
85+
mv /tmp/diff-report-*.json downloads/diff-report.json
86+
mv /tmp/diff-report-*.md downloads/diff-report.md
87+
shell: bash
88+
89+
- name: Upload artifacts
90+
uses: actions/upload-artifact@v2
91+
with:
92+
name: Baseline report
93+
path: downloads
94+
95+
- name: PR comment with file
96+
uses: thollander/actions-comment-pull-request@v2
97+
with:
98+
filePath: downloads/diff-report.md
99+
100+
branding:
101+
icon: 'check-circle'
102+
color: 'green'

0 commit comments

Comments
 (0)