Skip to content

Commit

Permalink
platform(general): remove obsolete run config fallback API call (#5404)
Browse files Browse the repository at this point in the history
* remove obsolete run config fallback API call

* change kustomize test to override image tag instead of name

* Revert "change kustomize test to override image tag instead of name"

This reverts commit 128ab52.

* xfail IR kustomize test on Python 3.9
  • Loading branch information
gruebel committed Aug 2, 2023
1 parent 25c7a99 commit efc2dc3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 3 additions & 11 deletions checkov/common/bridgecrew/platform_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def setup_api_urls(self) -> None:
self.integrations_api_url = f"{self.api_url}/api/v1/integrations/types/checkov"
self.onboarding_url = f"{self.api_url}/api/v1/signup/checkov"
self.platform_run_config_url = f"{self.api_url}/api/v2/checkov/runConfiguration"
self.platform_run_config_url_backoff = f"{self.api_url}/api/v1/checkov/runConfiguration"

def is_prisma_integration(self) -> bool:
if self.bc_api_key and not self.is_bc_token(self.bc_api_key):
Expand Down Expand Up @@ -661,9 +660,6 @@ def _get_run_config_query_params(self) -> str:
def get_run_config_url(self) -> str:
return f'{self.platform_run_config_url}?{self._get_run_config_query_params()}'

def get_run_config_url_backoff(self) -> str:
return f'{self.platform_run_config_url_backoff}?{self._get_run_config_query_params()}'

def get_customer_run_config(self) -> None:
if self.skip_download is True:
logging.debug("Skipping customer run config API call")
Expand Down Expand Up @@ -693,13 +689,9 @@ def get_customer_run_config(self) -> None:
logging.debug(f'Platform run config URL: {url}')
request = self.http.request("GET", url, headers=headers) # type:ignore[no-untyped-call]
if request.status != 200:
url = self.get_run_config_url_backoff()
logging.debug(f'Platform run config URL: {url}')
request = self.http.request("GET", url, headers=headers) # type:ignore[no-untyped-call]
if request.status != 200:
error_message = get_auth_error_message(request.status, self.is_prisma_integration(), False)
logging.error(error_message)
raise BridgecrewAuthError(error_message)
error_message = get_auth_error_message(request.status, self.is_prisma_integration(), False)
logging.error(error_message)
raise BridgecrewAuthError(error_message)
self.customer_run_config_response = json.loads(request.data.decode("utf8"))

logging.debug(f"Got customer run config from {platform_type} platform")
Expand Down
2 changes: 2 additions & 0 deletions tests/kustomize/test_runner_image_referencer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
import sys
from pathlib import Path

import mock
Expand All @@ -20,6 +21,7 @@
RESOURCES_PATH = Path(__file__).parent / "runner/resources"


@pytest.mark.xfail(sys.version_info.minor == 9, reason="for some reason this test is flaky on Python 3.9")
@pytest.mark.skipif(os.name == "nt" or not kustomize_exists(), reason="kustomize not installed or Windows OS")
@pytest.mark.parametrize("allow_kustomize_file_edits, code_lines", [
(True, "18-34"),
Expand Down

0 comments on commit efc2dc3

Please sign in to comment.