Skip to content

Commit

Permalink
feat(kustomize): stop kustomize run, if there is nothing to process (#…
Browse files Browse the repository at this point in the history
…3681)

* stop kustomize run, if there is nothing to process

* remove pip upgrade
  • Loading branch information
gruebel authored Oct 18, 2022
1 parent 4f1baed commit abe6ae2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ jobs:
- name: Build & install checkov package
run: |
pipenv --python ${{ matrix.python }}
pipenv run pip install --upgrade pip
pipenv run pip install pytest pytest-xdist
pipenv run python setup.py sdist bdist_wheel
bash -c 'pipenv run pip install dist/checkov-*.whl'
Expand Down
9 changes: 9 additions & 0 deletions checkov/kustomize/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ def run_kustomize_to_k8s(
self, root_folder: str | None, files: list[str] | None, runner_filter: RunnerFilter
) -> None:
kustomize_dirs = find_kustomize_directories(root_folder, files, runner_filter.excluded_paths)
if not kustomize_dirs:
# nothing to process
return

for kustomize_dir in kustomize_dirs:
self.kustomizeProcessedFolderAndMeta[kustomize_dir] = self._parseKustomization(kustomize_dir)
self.target_folder_path = tempfile.mkdtemp()
Expand Down Expand Up @@ -474,6 +478,11 @@ def run(

self.run_kustomize_to_k8s(root_folder, files, runner_filter)
report = Report(self.check_type)

if not self.kustomizeProcessedFolderAndMeta:
# nothing to process
return report

target_dir = ""
try:
k8s_runner = K8sKustomizeRunner()
Expand Down

0 comments on commit abe6ae2

Please sign in to comment.