-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (61 loc) · 2.68 KB
/
pluto-workflow-kustomize.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
61
62
63
64
65
66
67
name: Pluto Workflow
on:
workflow_call:
inputs:
service_name:
required: true
type: string
template_dir:
required: false
type: string
default: ""
description: "(For Kustomize deployment method) a path to a directory containing 'kustomization.yaml'"
values_base:
required: false
type: string
default: ""
description: "(For Helm chart deployment method) Specify a path of base values.yaml (or equivalent)"
values_overlay:
required: false
type: string
default: ""
description: "(For Helm chart deployment method) Specify a path of overlay values.yaml (or equivalent)"
chart_name:
required: false
type: string
default: ""
description: "(For Helm chart deployment method) Use this to manually set chart name. For example, corebook is using edgebook chart."
jobs:
review-k8s-api:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check out repository code (Casino)
if: ${{ inputs.service_name == 'casino' }}
run:
git fetch && git checkout origin/non-prod -- values
- name: Download Pluto
uses: FairwindsOps/pluto/[email protected]
- name: Install all-in-one Kubernetes tools in a package.
uses: yokawasa/[email protected]
with:
kubectl: '1.26.13'
- name: Run Pluto to scan K8S Manifest and send a report to OpsLevel
shell: bash
env:
UNENCRYPTED_TARGET_VERSION: ${{ secrets.TARGET_K8S_VERSION }}
UNENCRYPTED_OPSLEVEL_PLUTO_INTEGRATION_WEBHOOK_URL: ${{ secrets.OPSLEVEL_PLUTO_INTEGRATION_WEBHOOK_URL }}
run: |
MANIFEST_FILE=manifest.yaml
# Generate a manifest file
## Kustomize
if [[ -n "${{ inputs.template_dir }}" ]]; then
kubectl kustomize "${{ inputs.template_dir }}" --output="$MANIFEST_FILE"
## Helm
else
# if an user wishes to customize a Helm chart to use
CHART_NAME=$([ -n "${{ inputs.chart_name }}" ] && echo "${{ inputs.chart_name }}" || echo "${{ inputs.service_name }}")
helm template "charts/$CHART_NAME" --values "${{ inputs.values_base }}" --values "${{ inputs.values_overlay }}" > "$MANIFEST_FILE"
fi
pluto detect - --target-versions "k8s=$UNENCRYPTED_TARGET_VERSION" --ignore-deprecations --ignore-removals --output json < "$MANIFEST_FILE" | curl -i -s -X POST "$UNENCRYPTED_OPSLEVEL_PLUTO_INTEGRATION_WEBHOOK_URL?alias=${{ inputs.service_name }}" -H 'content-type: application/json' --data-binary @-