forked from kyverno/kyverno
-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (43 loc) · 1.33 KB
/
cli.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
name: cli
on:
push:
branches:
- 'main'
- 'release*'
pull_request:
branches:
- 'main'
- 'release*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
cli-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: Setup build env
uses: ./.github/actions/setup-build-env
with:
build-cache-key: cli-test
- name: Setup TEST_GIT_BRANCH
run: |
if [[ ${{ github.event_name }} == "push" ]]
then
echo "TEST_GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
elif [[ ${{ github.event_name }} == "pull_request" ]]
then
echo "TEST_GIT_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
fi
- name: Test CLI
run: |
VERSION=${{ github.ref_name }} make test-cli
- name: Test CLI (failures)
run: |
CLI_PATH=$PWD/cmd/cli/kubectl-kyverno/kubectl-kyverno
$CLI_PATH test ./test/cli/test-fail/missing-policy && exit 1 || exit 0
$CLI_PATH test ./test/cli/test-fail/missing-rule && exit 1 || exit 0
$CLI_PATH test ./test/cli/test-fail/missing-resource && exit 1 || exit 0