-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
83 lines (77 loc) · 2.59 KB
/
action.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: "Tetrate Config Analyzer"
description: "Validate and analyze Istio service mesh configurations for security, compliance, and best practices"
author: "Tetrate"
inputs:
tis-password:
description: "Tetrate Istio Subscription (TIS) password required for authentication. Store this as a secret"
required: true
local-only:
description: "Analyze configuration files locally without connecting to a Kubernetes cluster"
required: false
default: "false"
mesh-config:
description: |-
Path to the Istio configuration files.
Multiple files can be specified using either:
- Space-separated list: "./config1.yaml ./config2.yaml"
- Newline-separated list using YAML block scalar:
mesh-config: |-
./config1.yaml
./config2.yaml
required: false
default: ""
kube-config:
description: "Kubernetes config file content for cluster analysis. Not used in local-only mode"
required: false
default: ""
version:
description: "TCA version to use (e.g. 'v1.1.0'). Default is 'v1.2.0'"
required: false
default: "v1.2.0"
outputs:
result-file:
description: "Path to save TCA analysis output"
value: "${{ github.workspace }}/tca-output.txt"
runs:
using: "composite"
steps:
- name: Add action directory to path
shell: bash
run: |
echo "$GITHUB_ACTION_PATH" >> $GITHUB_PATH
- name: Get TCA binary
shell: bash
env:
TIS_PASS: ${{ inputs.tis-password }}
TCA_VERSION: ${{ inputs.version }}
run: |
${{ github.action_path }}/get-tca.sh
- name: Write Kubeconfig to File (if provided)
shell: bash
run: |
# Define debug function
function debug() {
if [[ "${RUNNER_DEBUG:-}" == "1" ]]; then
echo "$@"
fi
}
debug "Checking for kubeconfig presence..."
KUBE_CONFIG='${{ inputs.kube-config }}'
if [[ -n "$KUBE_CONFIG" ]]; then
debug "Kubeconfig is present"
mkdir -p /tmp
echo "$KUBE_CONFIG" > /tmp/kubeconfig.yaml
debug "Wrote kubeconfig to /tmp/kubeconfig.yaml"
debug "Kubeconfig file permissions: $(ls -l /tmp/kubeconfig.yaml)"
else
debug "No kubeconfig provided"
fi
- name: Run TCA analyzer
shell: bash
env:
TIS_PASS: ${{ inputs.tis-password }}
MESH_CONFIG: ${{ inputs.mesh-config }}
LOCAL_ONLY: ${{ inputs.local-only }}
KUBE_CONFIG: /tmp/kubeconfig.yaml
run: |
${{ github.action_path }}/run-tca.sh ${{ github.workspace }}/tca-output.txt