Skip to content

Commit 3288d51

Browse files
authored
Merge pull request #58 from therealmitchconnors/stefan
Add analyze workflow on pull_request, push
2 parents 8f82310 + ec8d26c commit 3288d51

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/analyze-istio.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: analyze-istio
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
8+
jobs:
9+
check-istio:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: Get Istioctl
15+
run: |
16+
ISTIO_VERSION=$(yq eval '. | select(.kind == "Deployment") | .spec.template.spec.containers[0].image | split(":") | .[1]' ./istio/operator/manifests.yaml)
17+
echo "ISTIO_VERSION=$ISTIO_VERSION" >> $GITHUB_ENV
18+
# downloadIstio will now retrieve the currently installed binary, instead of latest
19+
echo "Downloading Istio (v${ISTIO_VERSION})"
20+
curl -sL https://istio.io/downloadIstio | ISTIO_VERSION=$ISTIO_VERSION sh -
21+
- name: Istioctl Analyze
22+
run: |
23+
# this command will exit(1) if an error is found in any yaml
24+
# istio/operator/manifests.yaml contains an empty yaml doc, which
25+
# throws off analyze, so pass it in separately
26+
MANIFESTS=$(yq eval '. | select(. | has("kind"))' ./istio/operator/manifests.yaml)
27+
28+
ISTIO_VERSION=${{ env.ISTIO_VERSION }}
29+
30+
./istio-${ISTIO_VERSION}/bin/istioctl analyze -A --use-kube=false \
31+
--failure-threshold ERROR $(find . -not -path "*/istio-$ISTIO_VERSION/*" \
32+
-not -path "*/.git*/*" -not -path "*/clusters/*" -name "*.yaml" \
33+
-not -path "*/istio/operator/manifests.yaml" -type f) -<<<"$MANIFESTS"

0 commit comments

Comments
 (0)