-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix delete old artifacts #7
Conversation
WalkthroughWalkthroughThe changes implemented in the CI/CD workflow enhance the handling of pull requests during the release process. Instead of aborting the release when encountering open PRs, the workflow now deletes obsolete artifacts linked to those PRs. This adjustment allows the process to continue seamlessly, improving efficiency by managing artifacts automatically and preventing manual intervention. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CI/CD
participant PR
participant Google Cloud
User->>CI/CD: Trigger Release
CI/CD->>PR: Check for Open PRs
alt Open PR Exists
PR-->>CI/CD: PR Number with Hyphen
CI/CD->>Google Cloud: Delete Obsolete Artifact
CI/CD->>PR: Log Deletion Message
else No Open PRs
CI/CD->>PR: Retrieve PR Details
CI/CD->>Changelog: Append PR Details
end
CI/CD-->User: Release Process Completed
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
.github/workflows/release.yaml (1)
58-58
: Enhance Error Handling for PR Retrieval in Changelog UpdateThe
gh pr view
command in the workflow does not have error handling, which could lead to incomplete changelog entries if the command fails. Consider adding error handling to manage potential failures in retrieving PR details.
- File:
.github/workflows/release.yaml
- Line: 58
Analysis chain
Verify PR details retrieval and changelog update.
Ensure that the
gh pr view
command correctly retrieves PR details and that the changelog is updated accurately. Consider handling potential errors in retrieving PR details.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the retrieval of PR details and the update of the changelog. # Test: Simulate the retrieval of PR details and changelog update. echo "Simulating PR details retrieval and changelog update:" while read -r pr_number; do if [[ $pr_number != *"-"* ]]; then echo "Simulated retrieval and update for PR number: ${pr_number}" fi done < pr_numbers.txtLength of output: 207
Script:
#!/bin/bash # Search for the usage of `gh pr view` command in the release workflow file rg 'gh pr view' -A 5 .github/workflows/release.yamlLength of output: 377
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- .github/workflows/release.yaml (1 hunks)
Additional comments not posted (3)
.github/workflows/release.yaml (3)
Line range hint
1-109
:
Overall workflow configuration looks good.The workflow is well-structured and covers essential steps for a release process. Ensure that all secrets and environment variables are correctly configured and that the workflow runs smoothly on the self-hosted runner.
Line range hint
76-80
:
Review unpublishing logic for PR versions.Ensure that the logic for unpublishing PR versions is consistent with the artifact deletion process. Verify that the
gcloud artifacts versions delete
command is correctly configured and that any errors in the unpublishing process are handled.Verification successful
Unpublishing Logic for PR Versions Verified
The logic for unpublishing PR versions is consistent with the intended behavior and correctly handles the deletion of package versions. The initial issue was due to the absence of
pr_versions.txt
, which has been resolved in the simulation. Ensure that this file is generated in the actual workflow to avoid similar issues.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the unpublishing of PR versions. # Test: Simulate the unpublishing command for PR versions. echo "Simulating unpublishing of PR versions:" while read -r version; do echo "Simulated unpublishing for version: $version" done < pr_versions.txtLength of output: 179
Script:
#!/bin/bash # Description: Verify the creation of pr_versions.txt by simulating the command. # Extract the package versions matching the PR pattern and simulate the output. echo "Simulating creation of pr_versions.txt:" echo '["package1-1.0.0-pr.1", "package2-2.0.0-pr.2"]' | jq -r '.[] | select(. | contains("1.0.0-pr."))' | sed 's/.*versions\///g'Length of output: 240
55-57
: Ensure correct handling of PR numbers with hyphens.The logic assumes that PR numbers with hyphens indicate obsolete artifacts. Verify that this assumption holds for all cases. Additionally, ensure that the
gcloud artifacts versions delete
command is correctly configured with necessary permissions and the correct repository details.
Summary by CodeRabbit