From 3dfafbd10375d1e1c55e8d0fc12b7c678e3b8f82 Mon Sep 17 00:00:00 2001 From: Vinay Bommana Date: Fri, 7 Jun 2024 08:12:37 +0530 Subject: [PATCH 1/3] added github actions for guardrail policies --- .github/workflows/ci-guardrailpolicies.yml | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/ci-guardrailpolicies.yml diff --git a/.github/workflows/ci-guardrailpolicies.yml b/.github/workflows/ci-guardrailpolicies.yml new file mode 100644 index 00000000000..892c5f5cb5f --- /dev/null +++ b/.github/workflows/ci-guardrailpolicies.yml @@ -0,0 +1,31 @@ +name: ci-guardrailpolicies + +on: + push: + tags: + - v* + branches: + - master + pull_request: + +permissions: + contents: read + +jobs: + opa-guardrail-policies-check: + name: opa-guardrail-policies-check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: install gator cli & opa binaries + run: | + go install github.com/open-policy-agent/gatekeeper/v3/cmd/gator@master + curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64 + chmod 755 opa; cp opa /usr/local/bin/ + + - name: run opa & guardrails policies test.sh + run: | + export PATH=$PATH:/home/runner/go/bin; cd ${GITHUB_WORKSPACE}/pkg/operator/controllers/guardrails/policies; bash ./scripts/test.sh + shell: bash From 121b140e3d41aa9e6b661c66849553708aa96d92 Mon Sep 17 00:00:00 2001 From: Vinay Bommana Date: Fri, 7 Jun 2024 14:17:05 +0530 Subject: [PATCH 2/3] seperated gatorcli and opa install steps --- .github/workflows/ci-guardrailpolicies.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-guardrailpolicies.yml b/.github/workflows/ci-guardrailpolicies.yml index 892c5f5cb5f..0195cb45172 100644 --- a/.github/workflows/ci-guardrailpolicies.yml +++ b/.github/workflows/ci-guardrailpolicies.yml @@ -19,12 +19,15 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: install gator cli & opa binaries + - name: Install opa binary run: | - go install github.com/open-policy-agent/gatekeeper/v3/cmd/gator@master curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64 chmod 755 opa; cp opa /usr/local/bin/ + - name: Install gator cli + run: | + go install github.com/open-policy-agent/gatekeeper/v3/cmd/gator@master + - name: run opa & guardrails policies test.sh run: | export PATH=$PATH:/home/runner/go/bin; cd ${GITHUB_WORKSPACE}/pkg/operator/controllers/guardrails/policies; bash ./scripts/test.sh From ba7566fb069020489f5c52eb99355b5aa85dc3a2 Mon Sep 17 00:00:00 2001 From: Vinay Bommana Date: Fri, 7 Jun 2024 14:34:43 +0530 Subject: [PATCH 3/3] splitting oneliner --- .github/workflows/ci-guardrailpolicies.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-guardrailpolicies.yml b/.github/workflows/ci-guardrailpolicies.yml index 0195cb45172..5679df06a7f 100644 --- a/.github/workflows/ci-guardrailpolicies.yml +++ b/.github/workflows/ci-guardrailpolicies.yml @@ -30,5 +30,7 @@ jobs: - name: run opa & guardrails policies test.sh run: | - export PATH=$PATH:/home/runner/go/bin; cd ${GITHUB_WORKSPACE}/pkg/operator/controllers/guardrails/policies; bash ./scripts/test.sh + export PATH=$PATH:/home/runner/go/bin + cd ${GITHUB_WORKSPACE}/pkg/operator/controllers/guardrails/policies + bash ./scripts/test.sh shell: bash