Skip to content

Commit 2484f20

Browse files
authored
chore(ci): revamp parallel test outputs clarity and conciseness (#18002)
## Problem The current output from the **package checking phase** (where we determine if a package should be tested OR not) in parallel `system tests` is noisy and difficult to read. It prints internal debug commands and multiple lines of text for every package, making it hard to quickly scan and see which packages are being tested or skipped. ## Solution This Pull Request revamps the output format of the package checking phase to be highly readable and aligned. - Internal debug commands have been silenced. - The output now uses a "State-First" format, where the decision (TEST or SKIP) and the reason are displayed first, followed by the package name and commit hash. - The output is aligned in columns using `printf`, making vertical scanning easy for humans and parsing easy for tools. ## Notes to Reviewers - This change is purely cosmetic and does not alter the logic of package selection or test execution. - A harmless trigger comment was added to `packages/google-cloud-testutils/setup.py` to force this package to be tested in CI, allowing you to see the new output format in action. This will be removed before merging. ## Example Output ```text TEST [changed] google-cloud-testutils c3bdf09 SKIP [no_changes] google-cloud-tasks c3bdf09 SKIP [no_changes] google-cloud-storage c3bdf09 ``` ## Pre-planning For Adhoc Testing: While ad hoc testing is not yet merged to main and is not processed as a part of this PR, the expectation is that a future PR will refine this format when adhoc is added> At that time we will be able to determine why a TEST state was chosen (changed, adhoc, or both if a package has changes AND is inadvertantly included in the ad hoc list). ```text TEST [changed] google-cloud-testutils c3bdf09 TEST [adhoc] google-cloud-tasks c3bdf09 TEST [changed,adhoc] google-cloud-tasks c3bdf09 SKIP [no_changes] google-cloud-storage c3bdf09 ```
1 parent 5e0c2ff commit 2484f20

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.kokoro/system.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,16 +263,25 @@ for path in `find 'packages' \
263263
files_to_check=("${package_path}")
264264
fi
265265

266-
echo "checking changes with 'git diff ${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT} -- ${files_to_check[*]}'"
267266
set +e
268-
# Passing the array expanded as arguments to git diff
267+
# Passing the array expanded as arguments to git diff.
269268
package_modified=$(git diff "${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}...${KOKORO_GITHUB_PULL_REQUEST_COMMIT}" -- "${files_to_check[@]}" | wc -l)
270269
set -e
271270

272-
if [[ "${package_modified}" -gt 0 || "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]]; then
271+
states=()
272+
[[ "${package_modified}" -gt 0 ]] && states+=("changed")
273+
[[ "$KOKORO_BUILD_ARTIFACTS_SUBDIR" == *"continuous"* ]] && states+=("continuous")
274+
275+
# Join states with a comma
276+
state_str=$(IFS=, ; echo "${states[*]}")
277+
278+
commit_hash="${KOKORO_GITHUB_PULL_REQUEST_COMMIT:-HEAD}"
279+
280+
if [[ ${#states[@]} -gt 0 ]]; then
281+
printf "TEST %-20s %-40s %s\n" "[${state_str}]" "${package_name}" "${commit_hash}"
273282
PACKAGES_TO_TEST+=("$package_name")
274283
else
275-
echo "No changes in ${package_name} and not a continuous build, skipping."
284+
printf "SKIP %-20s %-40s %s\n" "[no_changes]" "${package_name}" "${commit_hash}"
276285
fi
277286
done
278287

0 commit comments

Comments
 (0)