feat: ignore test_and_release in PRs without code changes#6974
feat: ignore test_and_release in PRs without code changes#6974robertolopezlopez wants to merge 1 commit into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
4944ced to
5c91d33
Compare
5d2253f to
506ea98
Compare
|
/describe |
|
PR Description updated to latest commit (506ea98) |
506ea98 to
75e5ac5
Compare
This comment has been minimized.
This comment has been minimized.
| if ./scripts/ci/has-code-changes.sh; then | ||
| echo '.circleci/continue_config.yml' > /tmp/continuation-config-path.txt | ||
| else | ||
| echo '.circleci/continue_config_light.yml' > /tmp/continuation-config-path.txt | ||
| fi |
There was a problem hiding this comment.
Error handling bug: If has-code-changes.sh exits with error code 2 (e.g., when git merge-base fails due to insufficient fetch depth), the else branch executes and selects the lightweight config instead of failing the build. This silently masks errors and could run the wrong pipeline.
Impact: On older PR branches where the merge-base is beyond the 100-commit fetch depth (line 17), the detection will error but incorrectly proceed with lightweight config, skipping critical tests.
Fix:
set +e
./scripts/ci/has-code-changes.sh
result=$?
set -e
if [ $result -eq 0 ]; then
echo '.circleci/continue_config.yml' > /tmp/continuation-config-path.txt
elif [ $result -eq 1 ]; then
echo '.circleci/continue_config_light.yml' > /tmp/continuation-config-path.txt
else
echo "Error detecting code changes (exit $result)" >&2
exit 1
fi| if ./scripts/ci/has-code-changes.sh; then | |
| echo '.circleci/continue_config.yml' > /tmp/continuation-config-path.txt | |
| else | |
| echo '.circleci/continue_config_light.yml' > /tmp/continuation-config-path.txt | |
| fi | |
| set +e | |
| ./scripts/ci/has-code-changes.sh | |
| result=$? | |
| set -e | |
| if [ $result -eq 0 ]; then | |
| echo '.circleci/continue_config.yml' > /tmp/continuation-config-path.txt | |
| elif [ $result -eq 1 ]; then | |
| echo '.circleci/continue_config_light.yml' > /tmp/continuation-config-path.txt | |
| else | |
| echo "Error detecting code changes (exit $result)" >&2 | |
| exit 1 | |
| fi | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
75e5ac5 to
80ad6e1
Compare
This comment has been minimized.
This comment has been minimized.
80ad6e1 to
a9fde9d
Compare
This comment has been minimized.
This comment has been minimized.
2c11b2d to
05687e1
Compare
This comment has been minimized.
This comment has been minimized.
05687e1 to
8159563
Compare
| - checkout: | ||
| fetch-depth: 0 |
There was a problem hiding this comment.
Invalid checkout parameter. CircleCI's checkout step does not support a fetch-depth parameter (this is GitHub Actions syntax). This will either fail the job or be silently ignored, potentially causing insufficient git history for merge-base calculations.
Fix:
- checkout
- run:
name: Fetch full history
command: git fetch --unshallow || true| - checkout: | |
| fetch-depth: 0 | |
| - checkout | |
| - run: | |
| name: Fetch full history | |
| command: git fetch --unshallow || true | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
8159563 to
b9437b7
Compare
This comment has been minimized.
This comment has been minimized.
b9437b7 to
48c474d
Compare
This comment has been minimized.
This comment has been minimized.
48c474d to
8afd504
Compare
This comment has been minimized.
This comment has been minimized.
8afd504 to
28df1f4
Compare
28df1f4 to
c9e161a
Compare
PR Reviewer Guide 🔍
|
| workflows: | ||
| light_test_and_release: | ||
| jobs: | ||
| - prodsec/secrets-scan: |
There was a problem hiding this comment.
Suggestion: Please make this pipeline run the same checks as we do for docs-only branches here.
| @@ -0,0 +1,2080 @@ | |||
| version: 2.1 | |||
There was a problem hiding this comment.
Question: Can we freely name these files? If so, I would recommend to name them more descriptively.
| channel: cli-alerts | ||
| trusted-branch: main | ||
|
|
||
| - docs-only-check: |
There was a problem hiding this comment.
Question: Isn't this superseded by your changes?
| repo_path="${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" | ||
| fi | ||
|
|
||
| token="${GITHUB_TOKEN:-${GITHUB_PRIVATE_TOKEN:-${HAMMERHEAD_GITHUB_PAT:-}}}" |
There was a problem hiding this comment.
Issue: Why do we send tokens here?
There was a problem hiding this comment.
Question: Why do we generally need to interact with the github API.
| fi | ||
|
|
||
| mkdir -p /tmp/circleci | ||
| jq -Rs '.' "$CONFIG_PATH" > /tmp/circleci/config-string.json |
There was a problem hiding this comment.
Question: Isn't there a circleci cli function to do all of this? all the manually crafted API calls seems like quite some unnecessary maintenance burden?
|
These changes are quite massive for a performance improvement. Is there are chance to reduce these and focus on the minimum necessary? Also did you consider aspects around stability of the pipeline since this PR adds additional API calls etc which will now be required every time the pipeline runs. |
User description
Pull Request Submission Checklist
are release-note ready, emphasizing
what was changed, not how.
What does this PR do?
It skips the
test_and_releasepipeline for changes which do not touch code nor dependencies. Keeps the previous behaviour for others.Where should the reviewer start?
How should this be manually tested?
Right now the pipeline is running full in this PR.
After merge to main, there will be another PR showcasing the "light scenario".
What's the product update that needs to be communicated to CLI users?
PR Type
Enhancement
Description
Detect code changes vs. docs-only PRs.
Conditionally run full or lightweight CI.
Document new CI workflow behavior.
Diagram Walkthrough
flowchart LR A[CI Trigger] --> B{Detect Code Changes}; B -- Code Changes Found --> C[Full CI Pipeline]; B -- Docs-Only Changes --> D[Lightweight CI Pipeline];File Walkthrough
7 files
Changes required by linter, also failing in main branchNew script to detect code changesNew script to identify documentation-only changesHelper script to list changed filesImplement CI job for detecting code changesNew file for full CI pipeline configurationNew file for lightweight CI pipeline configuration1 files
Changes required by linter, also failing in main branch2 files
Tests for code change detection scriptTests for documentation-only change detection1 files
Document new CI pipeline behavior and logic1 files
Define pathspecs for code changes