From 3cc6655a7a0bc2b38bc00382ccaf1a71bad9cff0 Mon Sep 17 00:00:00 2001 From: Archit Aggarwal Date: Wed, 28 Jul 2021 07:39:55 +0000 Subject: [PATCH] Make update of verions in manifest.yml optional --- manifest-verifier/action.yml | 11 ++++++++++- manifest-verifier/verify_manifest.py | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/manifest-verifier/action.yml b/manifest-verifier/action.yml index f718a8be..e04c003f 100644 --- a/manifest-verifier/action.yml +++ b/manifest-verifier/action.yml @@ -9,6 +9,10 @@ inputs: description: 'List of comma-separated relative path to submodules that should not be present in manifest.yml. Eg libraries/thirdparty/tinycbor,libraries/thirdparty/mbedtls' required: false default: '' + fail-on-incorrect-version: + description: 'Boolean flag to indicate if verification should fail if any submodule version in manifest.yml file is incorrect or stale.' + required: false + default: 'false' runs: using: "composite" steps: @@ -17,5 +21,10 @@ runs: shell: bash - name: Run verifier script working-directory: ${{ inputs.path }} - run: python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} + run: | + if [[ "${{ inputs.fail-on-incorrect-version }}" == "true" ]]; then + python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} --fail-on-incorrect-version + else + python3 $GITHUB_ACTION_PATH/verify_manifest.py --ignore-submodule-path=${{ inputs.exclude-submodules }} + fi shell: bash diff --git a/manifest-verifier/verify_manifest.py b/manifest-verifier/verify_manifest.py index 7f1481eb..5ffbd0e0 100644 --- a/manifest-verifier/verify_manifest.py +++ b/manifest-verifier/verify_manifest.py @@ -63,8 +63,10 @@ def get_all_submodules(): parser.add_argument('--ignore-submodule-path', type=str, required=None, - default=os.getcwd(), help='Comma-separated list of submodules path to ignore.') + parser.add_argument('--fail-on-incorrect-versions', + action='store_true', + help='Flag to indicate script to fail for incorrect submodules versions in manifest.yml') args = parser.parse_args() @@ -107,7 +109,7 @@ def get_all_submodules(): print('manifest.yml does not have correct commit ID for', submodule_name,'manifest Commit=(',manifest_commit, submodule.head.commit,') Actual Commit=',submodules_info_from_git[relative_path]) mismatch_flag = True - if mismatch_flag: + if mismatch_flag and args.fail_on_incorrect_versions: sys.exit(1) print('\nmanifest.yml file has been verified!')