-
Notifications
You must be signed in to change notification settings - Fork 0
Web 471/postgress pipeline #2
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| name: PR Version Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| check_version_bump: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout PR branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Auth GH CLI | ||
| run: gh auth setup-git | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Check Chart.yaml version bump | ||
| id: version_check | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| # Get current version from PR's Chart.yaml | ||
| if [ ! -f "Chart.yaml" ]; then | ||
| echo "❌ Chart.yaml not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| pr_version=$(grep '^version:' Chart.yaml | awk '{print $2}') | ||
| echo "📄 PR Chart.yaml version: $pr_version" | ||
|
|
||
| # Get latest release/tag version | ||
| latest_tag=$(gh api repos/${{ github.repository }}/tags --jq '.[0].name' 2>/dev/null || echo "") | ||
|
|
||
| if [ -z "$latest_tag" ]; then | ||
| echo "ℹ️ No existing releases found" | ||
| echo "✅ This will be the first release with version: $pr_version" | ||
| echo "status=success" >> $GITHUB_OUTPUT | ||
| echo "message=✅ First release - version $pr_version will be used" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Remove 'v' prefix and chart name prefix if present | ||
| # Handles both "v0.1.32" and "webrix-postgres-0.1.32" formats | ||
| latest_version=$(echo "$latest_tag" | sed -E 's/^v//;s/^[a-zA-Z-]+-//') | ||
| echo "📦 Latest release version: $latest_version" | ||
|
|
||
| # Compare versions | ||
| if [ "$pr_version" = "$latest_version" ]; then | ||
| echo "❌ Version not bumped!" | ||
| echo "status=failure" >> $GITHUB_OUTPUT | ||
| echo "message=❌ Chart.yaml version ($pr_version) must be bumped from latest release ($latest_version)" >> $GITHUB_OUTPUT | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Validate version is greater than latest | ||
| IFS='.' read -r pr_major pr_minor pr_patch <<< "$pr_version" | ||
| IFS='.' read -r latest_major latest_minor latest_patch <<< "$latest_version" | ||
|
|
||
| # Remove any non-numeric suffixes (e.g., -alpha, -beta) | ||
| pr_major=${pr_major%%[^0-9]*} | ||
| pr_minor=${pr_minor%%[^0-9]*} | ||
| pr_patch=${pr_patch%%[^0-9]*} | ||
| latest_major=${latest_major%%[^0-9]*} | ||
| latest_minor=${latest_minor%%[^0-9]*} | ||
| latest_patch=${latest_patch%%[^0-9]*} | ||
|
|
||
| version_greater=false | ||
|
|
||
| if [ "$pr_major" -gt "$latest_major" ]; then | ||
| version_greater=true | ||
| bump_type="major" | ||
| elif [ "$pr_major" -eq "$latest_major" ] && [ "$pr_minor" -gt "$latest_minor" ]; then | ||
| version_greater=true | ||
| bump_type="minor" | ||
| elif [ "$pr_major" -eq "$latest_major" ] && [ "$pr_minor" -eq "$latest_minor" ] && [ "$pr_patch" -gt "$latest_patch" ]; then | ||
| version_greater=true | ||
| bump_type="patch" | ||
| fi | ||
|
|
||
| if [ "$version_greater" = false ]; then | ||
| echo "❌ Version is not greater than latest release!" | ||
| echo "status=failure" >> $GITHUB_OUTPUT | ||
| echo "message=❌ Chart.yaml version ($pr_version) must be greater than latest release ($latest_version)" >> $GITHUB_OUTPUT | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Version bump detected: $latest_version → $pr_version ($bump_type)" | ||
| echo "status=success" >> $GITHUB_OUTPUT | ||
| echo "message=✅ Version bumped: $latest_version → $pr_version ($bump_type)" >> $GITHUB_OUTPUT | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Comment on PR | ||
| if: always() && github.event_name == 'pull_request' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const status = '${{ steps.version_check.outputs.status }}'; | ||
| const message = '${{ steps.version_check.outputs.message }}'; | ||
|
|
||
| const commentBody = status === 'success' | ||
| ? `## ✅ Version Check Passed\n\n${message}\n\nThis PR can be merged.` | ||
| : `## ❌ Version Check Failed\n\n${message}\n\n### Required Action\n\nPlease update the \`version\` field in \`Chart.yaml\` to be greater than the latest release.\n\n**Tip**: Use semantic versioning:\n- **Patch** (x.y.Z): Bug fixes, small changes\n- **Minor** (x.Y.0): New features, backward compatible\n- **Major** (X.0.0): Breaking changes`; | ||
|
|
||
| // Find existing bot comment | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| }); | ||
|
|
||
| const botComment = comments.find(comment => | ||
| comment.user.type === 'Bot' && | ||
| comment.body.includes('Version Check') | ||
| ); | ||
|
|
||
| // Update or create comment | ||
| if (botComment) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: botComment.id, | ||
| body: commentBody | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: commentBody | ||
| }); | ||
| } | ||
|
|
||
| - name: Set check status | ||
| if: steps.version_check.outputs.status == 'failure' | ||
| run: | | ||
| echo "::error::Chart.yaml version must be bumped before merging" | ||
| exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: {{ include "postgresql.primary.svcName" . }} | ||
| name: {{ .Release.Name }}-postgresql | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Service name mismatch The primary Service is renamed to {{ .Release.Name }}-postgresql, but NOTES.txt (and the
existing postgresql.primary.svcName helper) still point users to a different service name derived
from postgresql.fullname. This will cause the documented DNS/psql/port-forward commands to fail
and also bypass nameOverride/fullnameOverride for the Service name.
Agent Prompt
|
||
| namespace: {{ .Release.Namespace | quote }} | ||
| labels: | ||
| {{- include "postgresql.labels" . | nindent 4 }} | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
2. Fullname collision risk
🐞 Bug⛯ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools