name: cli 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' permissions: contents: read jobs: cli-test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.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 export TEST_GIT_BRANCH=${GITHUB_REF##*/} elif [[ ${{ github.event_name }} == "pull_request" ]] then export TEST_GIT_BRANCH=${{ github.event.pull_request.base.ref }} fi - name: Test CLI run: | 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