Skip to content

Commit 91378e7

Browse files
claude-codePaebbels
andcommitted
Fix three defects found while cross-checking the documentation
**`PrepareJob.yml`: submodules were never detected.** The check tested for a file named `.gitsubmodules`; Git's file is `.gitmodules`. `has_submodules` was therefore always `'false'` and `git_submodule_count`, `git_submodule_names` and `git_submodule_paths` kept their initial empty values for every repository. The block already had the correct name in a local variable one line below, which is now used for the test as well. Verified against a scratch repository with two submodules: ``` has_submodules=true count=2 names=libA:libB paths=deps/libA:deps/libB ``` and `has_submodules=false` once the file is removed. **`CleanupArtifacts.yml`: an unknown artifact ID raised `NameError`.** Both compute steps call `printf(...)` in their `case _:` fallback, but the step runs `shell: python`, where `printf` is not a function. An `artifact-json-ids` entry that is not a key of the JSON dictionary - a typo, or a key removed from `Parameters.yml` while a consumer still lists it - aborted the step with `NameError: name 'printf' is not defined` instead of reporting the name. That is precisely the case the branch exists for. Reproduced against the previous revision (exit code 1, `NameError`) and against this one: ``` Name 'typo_key' not found in JSON dictionary. Artifact to delete: pyX-UnitTestReportSummary-XML-* pyX-Packages ``` `_Checking_CleanupArtifacts.yml` now passes an `unknown_key` entry, so the branch is exercised by the verification pipeline. **`CheckCodeQuality.yml`: the security scan could be skipped silently.** The `Bandit` step was guarded by `if: inputs.artifact != ''`, although the step writes its report to a fixed path and never used that parameter. An empty artifact name skipped the scan while the job still reported success. The guard is removed; the scan now runs whenever the job runs. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
1 parent 08dd2c2 commit 91378e7

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/CheckCodeQuality.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ jobs:
8686

8787
- name: 👮 Bandit
8888
id: bandit
89-
if: inputs.artifact != ''
9089
run: |
9190
set +e
9291

.github/workflows/CleanupArtifacts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
case [prefix, key, postfix] if key in artifactNames:
9797
artifacts.append(f"{prefix}{artifactNames[key]}{postfix}")
9898
case _:
99-
printf(f"Name '{name}' not found in JSON dictionary.")
99+
print(f"Name '{name}' not found in JSON dictionary.")
100100
101101
print("Artifact to delete:")
102102
for name in artifacts:
@@ -143,7 +143,7 @@ jobs:
143143
case [prefix, key, postfix] if key in artifactNames:
144144
artifacts.append(f"{prefix}{artifactNames[key]}{postfix}")
145145
case _:
146-
printf(f"Name '{name}' not found in JSON dictionary.")
146+
print(f"Name '{name}' not found in JSON dictionary.")
147147
148148
print("Artifact to delete:")
149149
for name in artifacts:

.github/workflows/PrepareJob.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ jobs:
366366
fi
367367
368368
# Submodules
369-
if [[ -f .gitsubmodules ]]; then
369+
git_modules_file=.gitmodules # $(git rev-parse --show-toplevel)/.gitmodules
370+
if [[ -f "${git_modules_file}" ]]; then
370371
has_submodules="true"
371-
git_modules_file=.gitmodules # $(git rev-parse --show-toplevel)/.gitmodules
372372
git_submodule_count="$(grep -Po '(?<=\[submodule \")(.*)(?=\"\])' "${git_modules_file}" | wc -l)"
373373
git_submodule_names="$(grep -Po '(?<=\[submodule \")(.*)(?=\"\])' "${git_modules_file}" | paste -sd ':' -)"
374374
git_submodule_paths="$(git config --file "${git_modules_file}" --null --name-only --get-regexp '\.path$' | xargs -0 -n1 git config --file "${git_modules_file}" --get | paste -sd ':' -)"

.github/workflows/_Checking_CleanupArtifacts.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ jobs:
5757
- Package
5858
with:
5959
json: ${{ needs.Params.outputs.artifact_names }}
60+
# Deliberate added 'unknown_key' for exception testing.
6061
artifact-json-ids: >-
6162
unittesting_xml:-*
63+
unknown_key
6264
# The package artifact is kept on tagged runs, so 'PublishOnPyPI.yml' can still consume it.
6365
json2: ${{ needs.Params.outputs.artifact_names }}
6466
condition2: ${{ ! startsWith(github.ref, 'refs/tags') }}

0 commit comments

Comments
 (0)