2022-02-18 01:47:35 +00:00
|
|
|
name: cli
|
2023-01-05 09:37:41 +00:00
|
|
|
|
2022-02-18 01:47:35 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'release*'
|
|
|
|
paths-ignore:
|
|
|
|
- 'README.md'
|
|
|
|
- 'docs/**'
|
|
|
|
- '.github/config.yml'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'release*'
|
|
|
|
paths-ignore:
|
|
|
|
- 'README.md'
|
|
|
|
- '.github/config.yml'
|
|
|
|
|
2023-01-06 10:07:06 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-02-18 01:47:35 +00:00
|
|
|
jobs:
|
|
|
|
cli-test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-01-06 06:50:37 +00:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
2023-01-05 15:52:52 +00:00
|
|
|
- name: Setup build env
|
|
|
|
uses: ./.github/actions/setup-build-env
|
2022-02-18 01:47:35 +00:00
|
|
|
with:
|
2023-01-05 15:52:52 +00:00
|
|
|
build-cache-key: cli-test
|
2023-01-05 09:37:41 +00:00
|
|
|
- name: Setup TEST_GIT_BRANCH
|
2022-02-18 01:47:35 +00:00
|
|
|
run: |
|
|
|
|
if [[ ${{ github.event_name }} == "push" ]]
|
|
|
|
then
|
2022-02-24 15:34:12 +00:00
|
|
|
export TEST_GIT_BRANCH=${GITHUB_REF##*/}
|
2022-02-18 01:47:35 +00:00
|
|
|
elif [[ ${{ github.event_name }} == "pull_request" ]]
|
|
|
|
then
|
2022-02-24 15:34:12 +00:00
|
|
|
export TEST_GIT_BRANCH=${{ github.event.pull_request.base.ref }}
|
2022-02-18 01:47:35 +00:00
|
|
|
fi
|
2023-01-05 09:37:41 +00:00
|
|
|
- name: Test CLI
|
|
|
|
run: |
|
|
|
|
make test-cli
|
|
|
|
- name: Test CLI (failures)
|
|
|
|
run: |
|
2022-08-30 15:30:28 +00:00
|
|
|
CLI_PATH=$PWD/cmd/cli/kubectl-kyverno/kubectl-kyverno
|
2022-02-18 01:47:35 +00:00
|
|
|
$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
|