From 073c5fb94eab0c86692a808ab951e4f56921ff97 Mon Sep 17 00:00:00 2001 From: strahi-linux Date: Mon, 16 Dec 2024 15:05:09 +0100 Subject: [PATCH] Added legacy package indexing for manual runs. --- .github/workflows/checkIndexes.yaml | 8 ++++++-- scripts/check_indexes.py | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checkIndexes.yaml b/.github/workflows/checkIndexes.yaml index e0a5ad024..e1b0cd1d5 100644 --- a/.github/workflows/checkIndexes.yaml +++ b/.github/workflows/checkIndexes.yaml @@ -18,6 +18,10 @@ on: type: boolean description: Fix the broken links with new ones? default: false + index_legacy: + type: boolean + description: Re-index legacy compiler packages as well (MikroC libraries/only applicable to manual runs)? + default: false push: branches: @@ -53,7 +57,7 @@ jobs: FIX_ACTION=${{ github.event.inputs.fix }} # Capture the fix input LOG_ONLY=$([[ "$FIX_ACTION" == "false" ]] && echo true || echo false) # Negate the fix input echo "LOG_ONLY is set to $LOG_ONLY" - python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_LIVE }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY" + python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_LIVE }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY" "--index_legacy_packages" "${{ github.event.inputs.index_legacy }}" continue-on-error: true # Ensure the workflow continues - name: Check Indexed Links - Test @@ -62,7 +66,7 @@ jobs: FIX_ACTION=${{ github.event.inputs.fix }} # Capture the fix input LOG_ONLY=$([[ "$FIX_ACTION" == "false" ]] && echo true || echo false) # Negate the fix input echo "LOG_ONLY is set to $LOG_ONLY" - python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_TEST }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY" + python -u scripts/check_indexes.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ secrets.ES_HOST }} ${{ secrets.ES_USER }} ${{ secrets.ES_PASSWORD }} ${{ secrets.ME_ES_HOST }} ${{ secrets.ME_ES_USER }} ${{ secrets.ME_ES_PASSWORD }} ${{ secrets.ES_INDEX_TEST }} "--es_regex" "${{ github.event.inputs.regex }}" "--log_only" "$LOG_ONLY" "--index_legacy_packages" "${{ github.event.inputs.index_legacy }}" continue-on-error: true # Ensure the workflow continues push_to_main_run: diff --git a/scripts/check_indexes.py b/scripts/check_indexes.py index 70df03f02..738f45e98 100644 --- a/scripts/check_indexes.py +++ b/scripts/check_indexes.py @@ -32,6 +32,7 @@ def str2bool(v): parser.add_argument("--es_regex", help="Regex to use to fetch indexed items", type=str, default=".+") parser.add_argument("--log_only", help="If True, will not fix broken links, just log them to std out", type=str2bool, default=False) parser.add_argument("--index_package_names", help="If True, will add \"gh_package_name\" to indexed item", type=str2bool, default=True) + parser.add_argument("--index_legacy_packages", help="If True, will re-index legacy compiler packages to DBP", type=str2bool, default=False) args = parser.parse_args() es_instance = es.index( @@ -46,6 +47,9 @@ def str2bool(v): gh_instance = gh.repo(args.gh_repo, args.gh_token) + if args.index_legacy_packages: + args.es_regex += '|^legacy_.+$' + es_instance.fetch(regex=args.es_regex) headers = {