-
Notifications
You must be signed in to change notification settings - Fork 233
Revamp deploy pipeline to be stateless #1925
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8811db8
Revamp deploy pipeline to be stateless
inlined 2635391
Add missing trailing newline
inlined 89de7e8
chore: Revert back to Node 18+ support for Functions SDK. (#1919)
ajperel 65e05ed
Revamp deploy pipeline to be stateless
inlined 7b3daa1
fix: update deploy pipeline, template, and release notes linter
inlined 84d7b59
fix: resolve set -e exit on PR_SUFFIX and add permissions block to li…
inlined 186ba4e
Merge branch 'master' into inlined.stateless-deploys
inlined f30bd5e
feat: filter out reverted PRs/commits in generated changelog
inlined 2929df0
feat: address PR comments, decouple changelog, and clean up Twitter b…
inlined 57f5796
fix: change zero-commit check to validate relnote presence instead
inlined 487b561
Merge remote-tracking branch 'origin/master' into inlined.stateless-d…
inlined 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
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,37 @@ | ||
| name: Lint Release Notes | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited, synchronized, reopened] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint-pr-body: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Validate PR Release Notes | ||
| env: | ||
| PR_BODY: ${{ github.event.pull_request.body }} | ||
| run: | | ||
| echo "Analyzing PR description for release notes..." | ||
|
|
||
| # 1. Check if the body contains a 'relnote:' or 'relnotes:' line (case-insensitive) | ||
| if ! echo "$PR_BODY" | grep -qiE '^[Rr]elnotes?:'; then | ||
| echo "❌ Error: Could not find a 'relnote:' or 'relnotes:' line in the PR description." | ||
| echo "Please ensure your PR description includes a line matching: 'relnote: <your note>' or 'relnote: none'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # 2. Extract the actual note content to ensure it isn't blank | ||
| # This grabs the line, strips the prefix, and trims trailing/leading spaces | ||
| NOTE_CONTENT=$(echo "$PR_BODY" | grep -iE '^[Rr]elnotes?:' | head -n 1 | sed -E 's/^[Rr]elnotes?:[[:space:]]*//g' | xargs) | ||
|
|
||
| if [ -z "$NOTE_CONTENT" ]; then | ||
| echo "❌ Error: The 'relnote:' field is empty." | ||
| echo "Please provide a brief release note or write 'relnote: none' if this change doesn't require one." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Success! Found valid release note: '$NOTE_CONTENT'" | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # Ensure we run from the repository root | ||
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
| cd "$DIR/.." | ||
|
|
||
| PREVIOUS_TAG="" | ||
| for tag in $(git log --tags --simplify-by-decoration --pretty="format:%d" | grep -o 'tag: [^,)]*' | sed 's/tag: //'); do | ||
| if echo "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then | ||
| PREVIOUS_TAG="$tag" | ||
| break | ||
| fi | ||
| done | ||
|
|
||
| if [ -z "$PREVIOUS_TAG" ]; then | ||
| echo "Initial release." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # First pass: Identify all reverted PRs and SHAs in the interval | ||
| REVERTED_PRS=" " | ||
| REVERTED_SHAS=" " | ||
| while read -r sha; do | ||
| COMMIT_SUBJECT=$(git log -1 --format="%s" "$sha") | ||
| if [[ "$COMMIT_SUBJECT" =~ ^Revert[[:space:]]\" ]]; then | ||
| # Extract PR number from revert subject: e.g. Revert "feat: foo (#123)" -> 123 | ||
| REVERTED_PR=$(echo "$COMMIT_SUBJECT" | grep -oE '\(#[0-9]+\)' | tr -d '(#)' || true) | ||
| if [ -n "$REVERTED_PR" ]; then | ||
| REVERTED_PRS+="$REVERTED_PR " | ||
| fi | ||
|
|
||
| # Extract reverted commit SHA from the body: e.g. "This reverts commit 8ec5..." | ||
| REVERTED_SHA=$(git log -1 --format="%b" "$sha" | grep -iE 'this reverts commit' | sed -E 's/.*[Tt]his reverts commit[[:space:]]+([0-9a-fA-F]+).*/\1/' || true) | ||
| if [ -n "$REVERTED_SHA" ]; then | ||
| RESOLVED_SHA=$(git rev-parse "$REVERTED_SHA" 2>/dev/null || echo "$REVERTED_SHA") | ||
| REVERTED_SHAS+="$RESOLVED_SHA " | ||
|
|
||
| # Also try to get the PR number associated with the reverted commit | ||
| REVERTED_SHA_SUBJECT=$(git log -1 --format="%s" "$RESOLVED_SHA" 2>/dev/null || true) | ||
| if [ -n "$REVERTED_SHA_SUBJECT" ]; then | ||
| REVERTED_SHA_PR=$(echo "$REVERTED_SHA_SUBJECT" | grep -oE '\(#[0-9]+\)' | tr -d '(#)' || true) | ||
| if [ -n "$REVERTED_SHA_PR" ]; then | ||
| REVERTED_PRS+="$REVERTED_SHA_PR " | ||
| fi | ||
| fi | ||
| fi | ||
| fi | ||
| done < <(git rev-list "${PREVIOUS_TAG}..HEAD") | ||
|
|
||
| CHANGELOG_NOTES="" | ||
| while read -r sha; do | ||
| # Check if this SHA was reverted | ||
| FULL_SHA=$(git rev-parse "$sha") | ||
| if [[ "$REVERTED_SHAS" =~ " $FULL_SHA " ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| COMMIT_SUBJECT=$(git log -1 --format="%s" "$sha") | ||
|
|
||
| # Skip revert commits themselves | ||
| if [[ "$COMMIT_SUBJECT" =~ ^Revert[[:space:]]\" ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| PR_SUFFIX=$(echo "$COMMIT_SUBJECT" | grep -oE '\(#[0-9]+\)$' || true) | ||
| if [ -n "$PR_SUFFIX" ]; then | ||
| PR_NUM=$(echo "$PR_SUFFIX" | tr -d '(#)') | ||
| if [[ "$REVERTED_PRS" =~ " $PR_NUM " ]]; then | ||
| continue | ||
| fi | ||
| fi | ||
|
|
||
| while read -r line; do | ||
| if [ -n "$line" ]; then | ||
| if echo "$line" | grep -qE '\(#[0-9]+\)$'; then | ||
| CHANGELOG_NOTES+="- $line"$'\n' | ||
| elif [ -n "$PR_SUFFIX" ]; then | ||
| CHANGELOG_NOTES+="- $line $PR_SUFFIX"$'\n' | ||
| else | ||
| CHANGELOG_NOTES+="- $line"$'\n' | ||
| fi | ||
| fi | ||
| done < <(git log -1 --format="%b" "$sha" | \ | ||
| grep -iE '^relnotes?:' | \ | ||
| grep -vi 'relnotes?:[[:space:]]*none' | \ | ||
| sed -E 's/^[Rr]elnotes?:[[:space:]]*//g' | \ | ||
| sed -E 's/[[:space:]]*$//') | ||
| done < <(git rev-list "${PREVIOUS_TAG}..HEAD") | ||
|
|
||
| echo -e "$CHANGELOG_NOTES" |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.