From c8387224e713aff61d59bb543790a214e808b577 Mon Sep 17 00:00:00 2001 From: "christianpfarher@finitestate.io" Date: Fri, 19 Apr 2024 16:03:27 -0300 Subject: [PATCH 1/4] upgrade sdk --- DEV_README.md | 2 +- README.md | 6 +++--- dist/python/requirements.txt | 2 +- dist/python/upload_test_results.py | 1 + src/python/.python-version | 1 + src/python/requirements.txt | 2 +- src/python/upload_test_results.py | 1 + 7 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 src/python/.python-version diff --git a/DEV_README.md b/DEV_README.md index a6b5a0b..b69b08a 100644 --- a/DEV_README.md +++ b/DEV_README.md @@ -133,7 +133,7 @@ hash. steps: - name: Finite State Binary Scan id: binary_scan - uses: FiniteStateInc/binary-scan@v2.0.0 + uses: FiniteStateInc/binary-scan@v2.0.1 with: finite-state-client-id: ${{ secrets.CLIENT_ID }} diff --git a/README.md b/README.md index cdc2b26..444ef77 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ and Created By User. If you need to change these, you can provide IDs for them. > > To avoid issues, consider using a GitHub-hosted runner image like > 'ubuntu-latest' or 'microsoft-latest' that comes pre-installed with both -> Node.js and Python. +> Node.js and Python required versions. @@ -113,7 +113,7 @@ optional fields. **Example:** ```yaml -uses: FiniteStateInc/third-party-upload@v2.0.0 +uses: FiniteStateInc/third-party-upload@v2.0.1 with: finite-state-client-id: ${{ secrets.CLIENT_ID }} finite-state-secret: ${{ secrets.CLIENT_SECRET }} @@ -212,7 +212,7 @@ jobs: path: # The path to the scan results generated in the previous step - name: SBOM analysis - uses: FiniteStateInc/third-party-upload@v2.0.0 + uses: FiniteStateInc/third-party-upload@v2.0.1 id: third_party_upload with: finite-state-client-id: ${{ secrets.CLIENT_ID }} diff --git a/dist/python/requirements.txt b/dist/python/requirements.txt index 5721ae1..7340472 100644 --- a/dist/python/requirements.txt +++ b/dist/python/requirements.txt @@ -1 +1 @@ -finite-state-sdk==0.1.2 \ No newline at end of file +finite-state-sdk==0.1.6 \ No newline at end of file diff --git a/dist/python/upload_test_results.py b/dist/python/upload_test_results.py index 0921033..6b0221d 100644 --- a/dist/python/upload_test_results.py +++ b/dist/python/upload_test_results.py @@ -98,6 +98,7 @@ def create_and_upload_test_results(): product_id=INPUT_PRODUCT_ID, artifact_description=INPUT_ARTIFACT_DESCRIPTION, test_type=INPUT_TEST_TYPE, + upload_method=finite_state_sdk.UploadMethod.GITHUB_INTEGRATION, ) ) set_multiline_output("response", response) diff --git a/src/python/.python-version b/src/python/.python-version new file mode 100644 index 0000000..6c6f512 --- /dev/null +++ b/src/python/.python-version @@ -0,0 +1 @@ +3.8.18 \ No newline at end of file diff --git a/src/python/requirements.txt b/src/python/requirements.txt index 5721ae1..7340472 100644 --- a/src/python/requirements.txt +++ b/src/python/requirements.txt @@ -1 +1 @@ -finite-state-sdk==0.1.2 \ No newline at end of file +finite-state-sdk==0.1.6 \ No newline at end of file diff --git a/src/python/upload_test_results.py b/src/python/upload_test_results.py index 0921033..6b0221d 100644 --- a/src/python/upload_test_results.py +++ b/src/python/upload_test_results.py @@ -98,6 +98,7 @@ def create_and_upload_test_results(): product_id=INPUT_PRODUCT_ID, artifact_description=INPUT_ARTIFACT_DESCRIPTION, test_type=INPUT_TEST_TYPE, + upload_method=finite_state_sdk.UploadMethod.GITHUB_INTEGRATION, ) ) set_multiline_output("response", response) From 9eb33c60ec433f4dc2436836d5fbde0d53a5a838 Mon Sep 17 00:00:00 2001 From: "christianpfarher@finitestate.io" Date: Fri, 19 Apr 2024 16:23:38 -0300 Subject: [PATCH 2/4] fixes --- src/python/upload_test_results.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/python/upload_test_results.py b/src/python/upload_test_results.py index 6b0221d..8056833 100644 --- a/src/python/upload_test_results.py +++ b/src/python/upload_test_results.py @@ -53,25 +53,24 @@ def create_and_upload_test_results(): INPUT_PRODUCT_ID = os.environ.get("INPUT_PRODUCT_ID") INPUT_ARTIFACT_DESCRIPTION = os.environ.get("INPUT_ARTIFACT_DESCRIPTION") except KeyError: - msg = f"Required inputs not available. Please, check required inputs definition" + msg = "Required inputs not available. Please, check required inputs definition" error = msg logger.error(msg) raise error = None asset_version = "" - logger.info(f"Starting - Create new asset version and upload test results") + logger.info("Starting - Create new asset version and upload test results") if not INPUT_GITHUB_TOKEN and INPUT_AUTOMATIC_COMMENT: - msg = f"Caught an exception. The [Github Token] input is required when [Automatic comment] is enabled." + msg = "Caught an exception. The [Github Token] input is required when [Automatic comment] is enabled." error = msg logger.error(msg) - logger.debug(e) if error == None: # Authenticate try: - logger.info(f"Starting - Authentication") + logger.info("Starting - Authentication") token = finite_state_sdk.get_auth_token( INPUT_FINITE_STATE_CLIENT_ID, INPUT_FINITE_STATE_SECRET ) @@ -122,7 +121,7 @@ def create_and_upload_test_results(): logger.debug(e) if error == None: - logger.info(f"File uploaded - Extracting asset version") + logger.info("File uploaded - Extracting asset version") set_multiline_output("response", json.dumps(response, indent=4)) asset_version_url = "https://platform.finitestate.io/artifacts/{asset_id}/versions/{version}".format( asset_id=INPUT_ASSET_ID, version=asset_version @@ -130,14 +129,14 @@ def create_and_upload_test_results(): set_output("asset-version-url", asset_version_url) logger.info(f"Asset version URL: {asset_version_url}") if not INPUT_AUTOMATIC_COMMENT: - logger.info(f"Automatic comment disabled") + logger.info("Automatic comment disabled") else: if is_pull_request(): - logger.info(f"Automatic comment enabled. Generating comment...") + logger.info("Automatic comment enabled. Generating comment...") generate_comment(INPUT_GITHUB_TOKEN, asset_version_url, logger) else: logger.info( - f"Automatic comment enabled. But this isn't a pull request. Skip generating comment..." + "Automatic comment enabled. But this isn't a pull request. Skip generating comment..." ) else: set_multiline_output("error", error) From 189119ed5cd5d4fc8c8340ba025fab60effdb748 Mon Sep 17 00:00:00 2001 From: "christianpfarher@finitestate.io" Date: Fri, 19 Apr 2024 16:23:56 -0300 Subject: [PATCH 3/4] fixes --- src/python/upload_test_results.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/upload_test_results.py b/src/python/upload_test_results.py index 8056833..70ddb37 100644 --- a/src/python/upload_test_results.py +++ b/src/python/upload_test_results.py @@ -67,7 +67,7 @@ def create_and_upload_test_results(): error = msg logger.error(msg) - if error == None: + if error is None: # Authenticate try: logger.info("Starting - Authentication") @@ -83,7 +83,7 @@ def create_and_upload_test_results(): logger.debug(e) # Create new asset version an upload test results: - if error == None: + if error is None: try: response = ( finite_state_sdk.create_new_asset_version_and_upload_test_results( @@ -120,7 +120,7 @@ def create_and_upload_test_results(): logger.error(msg) logger.debug(e) - if error == None: + if error is None: logger.info("File uploaded - Extracting asset version") set_multiline_output("response", json.dumps(response, indent=4)) asset_version_url = "https://platform.finitestate.io/artifacts/{asset_id}/versions/{version}".format( From 6074d9352a20411c57febc42911bd951c822ea8a Mon Sep 17 00:00:00 2001 From: "christianpfarher@finitestate.io" Date: Tue, 30 Apr 2024 16:41:11 -0300 Subject: [PATCH 4/4] upgrade sdk --- dist/python/requirements.txt | 2 +- dist/python/upload_test_results.py | 23 +++++++++++------------ src/python/requirements.txt | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/dist/python/requirements.txt b/dist/python/requirements.txt index 7340472..6b8deda 100644 --- a/dist/python/requirements.txt +++ b/dist/python/requirements.txt @@ -1 +1 @@ -finite-state-sdk==0.1.6 \ No newline at end of file +finite-state-sdk==0.1.9 diff --git a/dist/python/upload_test_results.py b/dist/python/upload_test_results.py index 6b0221d..70ddb37 100644 --- a/dist/python/upload_test_results.py +++ b/dist/python/upload_test_results.py @@ -53,25 +53,24 @@ def create_and_upload_test_results(): INPUT_PRODUCT_ID = os.environ.get("INPUT_PRODUCT_ID") INPUT_ARTIFACT_DESCRIPTION = os.environ.get("INPUT_ARTIFACT_DESCRIPTION") except KeyError: - msg = f"Required inputs not available. Please, check required inputs definition" + msg = "Required inputs not available. Please, check required inputs definition" error = msg logger.error(msg) raise error = None asset_version = "" - logger.info(f"Starting - Create new asset version and upload test results") + logger.info("Starting - Create new asset version and upload test results") if not INPUT_GITHUB_TOKEN and INPUT_AUTOMATIC_COMMENT: - msg = f"Caught an exception. The [Github Token] input is required when [Automatic comment] is enabled." + msg = "Caught an exception. The [Github Token] input is required when [Automatic comment] is enabled." error = msg logger.error(msg) - logger.debug(e) - if error == None: + if error is None: # Authenticate try: - logger.info(f"Starting - Authentication") + logger.info("Starting - Authentication") token = finite_state_sdk.get_auth_token( INPUT_FINITE_STATE_CLIENT_ID, INPUT_FINITE_STATE_SECRET ) @@ -84,7 +83,7 @@ def create_and_upload_test_results(): logger.debug(e) # Create new asset version an upload test results: - if error == None: + if error is None: try: response = ( finite_state_sdk.create_new_asset_version_and_upload_test_results( @@ -121,8 +120,8 @@ def create_and_upload_test_results(): logger.error(msg) logger.debug(e) - if error == None: - logger.info(f"File uploaded - Extracting asset version") + if error is None: + logger.info("File uploaded - Extracting asset version") set_multiline_output("response", json.dumps(response, indent=4)) asset_version_url = "https://platform.finitestate.io/artifacts/{asset_id}/versions/{version}".format( asset_id=INPUT_ASSET_ID, version=asset_version @@ -130,14 +129,14 @@ def create_and_upload_test_results(): set_output("asset-version-url", asset_version_url) logger.info(f"Asset version URL: {asset_version_url}") if not INPUT_AUTOMATIC_COMMENT: - logger.info(f"Automatic comment disabled") + logger.info("Automatic comment disabled") else: if is_pull_request(): - logger.info(f"Automatic comment enabled. Generating comment...") + logger.info("Automatic comment enabled. Generating comment...") generate_comment(INPUT_GITHUB_TOKEN, asset_version_url, logger) else: logger.info( - f"Automatic comment enabled. But this isn't a pull request. Skip generating comment..." + "Automatic comment enabled. But this isn't a pull request. Skip generating comment..." ) else: set_multiline_output("error", error) diff --git a/src/python/requirements.txt b/src/python/requirements.txt index 7340472..6b8deda 100644 --- a/src/python/requirements.txt +++ b/src/python/requirements.txt @@ -1 +1 @@ -finite-state-sdk==0.1.6 \ No newline at end of file +finite-state-sdk==0.1.9