2022-02-18 01:47:35 +00:00
|
|
|
name: cli
|
2023-01-05 10:37:41 +01:00
|
|
|
|
2022-02-18 01:47:35 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-02-09 15:17:23 +01:00
|
|
|
- '*'
|
2022-02-18 01:47:35 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'release*'
|
|
|
|
|
2023-01-06 16:24:55 +01:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-01-06 11:07:06 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-02-18 01:47:35 +00:00
|
|
|
jobs:
|
|
|
|
cli-test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-03-24 09:26:01 +00:00
|
|
|
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
|
2023-01-05 16:52:52 +01:00
|
|
|
- name: Setup build env
|
|
|
|
uses: ./.github/actions/setup-build-env
|
2022-02-18 01:47:35 +00:00
|
|
|
with:
|
2023-01-05 16:52:52 +01:00
|
|
|
build-cache-key: cli-test
|
2023-01-05 10:37:41 +01: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 10:37:41 +01:00
|
|
|
- name: Test CLI
|
|
|
|
run: |
|
|
|
|
make test-cli
|
|
|
|
- name: Test CLI (failures)
|
|
|
|
run: |
|
2022-08-30 17:30:28 +02: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
|