-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Automate minor release preparation via bump-minor-logstash.yml #19461
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
Open
Copilot
wants to merge
7
commits into
main
Choose a base branch
from
copilot/dra-automate-minor-release-preparation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+177
−0
Open
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3b748aa
Initial plan
Copilot b47b795
Add bump-minor-logstash.yml workflow and wire into version bump pipeline
Copilot 0a97bc2
Use elastic/oblt-actions/git/setup for git identity configuration
Copilot 35d5208
Remove logstash-docs branch step and use intermediate env vars for in…
Copilot a1d3260
Remove add-release-lockfile job and group minor version bump steps in…
Copilot 3f411c2
Address review comments: rename step, idempotent branch creation, rem…
Copilot 2dbdfda
Address remaining minor bump workflow review feedback
Copilot 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
Some comments aren't visible on the classic Files Changed page.
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,237 @@ | ||
| name: bump-minor-logstash-version | ||
|
|
||
| # Automates the "Before feature freeze" / "After feature freeze" pull-request-opening | ||
| # steps of the minor release checklist, up to (but not including) the | ||
| # "Week before release" section: | ||
| # https://github.com/elastic/ingest-dev/blob/main/.github/ISSUE_TEMPLATE/logstash-release-checklist-minor.md | ||
| # | ||
| # Purely manual steps (QA testing, doc coordination, DRA monitoring, Slack | ||
| # notifications, etc.) are intentionally NOT automated here. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| logstash-version: | ||
| description: 'New release branch initial version (example: 9.1.0)' | ||
| required: true | ||
| type: string | ||
| logstash-branch: | ||
| description: 'New release branch to create (example: 9.1)' | ||
| required: true | ||
| type: string | ||
| next-minor-version: | ||
| description: 'Version main should move to after the branch is cut (example: 9.2.0). Optional; when omitted it is computed by bumping the minor of logstash-version.' | ||
| required: false | ||
| type: string | ||
| skip-branch-creation: | ||
| description: 'Skip creating the new release branch (use when logstash-branch is the last minor version of a major).' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
|
Comment on lines
+26
to
+30
|
||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # "Before feature freeze" - check and unpin any active pins in the gemspec/Gemfile. | ||
| check-and-unpin-dependencies: | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: main | ||
| - uses: elastic/oblt-actions/git/setup@v1 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Find and remove undocumented exact-version pins | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| id: unpin | ||
| run: | | ||
| # Any gem pinned with an exact "=" version constraint that does not carry | ||
| # an explanatory inline comment is treated as a candidate for unpinning. | ||
| FILES="Gemfile.template logstash-core/logstash-core.gemspec" | ||
| CHANGED=0 | ||
| for f in $FILES; do | ||
| [ -f "$f" ] || continue | ||
| while IFS= read -r line; do | ||
| echo "Candidate pin in $f: $line" | ||
| CHANGED=1 | ||
| done < <(grep -nE "['\"]= [0-9]" "$f" | grep -v "#") | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| done | ||
| echo "changed=$CHANGED" >> "$GITHUB_OUTPUT" | ||
| - name: Open PR if any undocumented pins were found | ||
| if: steps.unpin.outputs.changed == '1' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| BRANCH="unpin_check_$(date +%s)" | ||
| git checkout -b "$BRANCH" | ||
| git commit --allow-empty -m "Reminder: review active dependency pins before feature freeze" | ||
| git push origin "$BRANCH" | ||
| gh pr create \ | ||
| --title "Review active dependency pins before feature freeze" \ | ||
| --body "Undocumented exact-version pins were found in Gemfile.template or logstash-core.gemspec. Please review whether they can be unpinned before feature freeze." \ | ||
| --base main \ | ||
| --head "$BRANCH" | ||
|
|
||
| # "Before feature freeze" - create the new release branch on elastic/logstash and elastic/logstash-docs. | ||
|
v1v marked this conversation as resolved.
Outdated
|
||
| create-release-branch: | ||
| if: ${{ inputs.skip-branch-creation != true }} | ||
| permissions: | ||
| contents: write | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| LOGSTASH_DOCS_TOKEN: ${{ secrets.LOGSTASH_DOCS_TOKEN }} | ||
|
v1v marked this conversation as resolved.
Outdated
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: main | ||
| fetch-depth: 0 | ||
| - name: Create release branch on elastic/logstash | ||
|
v1v marked this conversation as resolved.
|
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| git push origin "HEAD:refs/heads/${{ inputs.logstash-branch }}" | ||
|
v1v marked this conversation as resolved.
Outdated
|
||
| - name: Create release branch on elastic/logstash-docs | ||
| if: ${{ env.LOGSTASH_DOCS_TOKEN != '' }} | ||
| env: | ||
| GH_TOKEN: ${{ env.LOGSTASH_DOCS_TOKEN }} | ||
| run: | | ||
| MAIN_SHA=$(gh api repos/elastic/logstash-docs/git/ref/heads/main --jq .object.sha) | ||
| gh api repos/elastic/logstash-docs/git/refs \ | ||
| -f ref="refs/heads/${{ inputs.logstash-branch }}" \ | ||
| -f sha="$MAIN_SHA" | ||
|
v1v marked this conversation as resolved.
Outdated
|
||
|
|
||
|
v1v marked this conversation as resolved.
|
||
| # "Before feature freeze" - update versions.yml on main to the next minor. | ||
| bump-versions-yml-main: | ||
| needs: [create-release-branch] | ||
| if: always() && (needs.create-release-branch.result == 'success' || needs.create-release-branch.result == 'skipped') | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: main | ||
| - uses: elastic/oblt-actions/git/setup@v1 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Compute next minor version | ||
| id: next | ||
| run: | | ||
| if [ -n "${{ inputs.next-minor-version }}" ]; then | ||
| echo "version=${{ inputs.next-minor-version }}" >> "$GITHUB_OUTPUT" | ||
| else | ||
| IFS='.' read -r major minor _patch <<< "${{ inputs.logstash-version }}" | ||
| echo "version=${major}.$((minor + 1)).0" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| - name: Update versions.yml on main | ||
| run: | | ||
| NEXT_VERSION="${{ steps.next.outputs.version }}" | ||
| sed -i "s/^logstash: .*/logstash: ${NEXT_VERSION}/" versions.yml | ||
| sed -i "s/^logstash-core: .*/logstash-core: ${NEXT_VERSION}/" versions.yml | ||
| - name: Open PR | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| NEXT_VERSION="${{ steps.next.outputs.version }}" | ||
| BRANCH="bump_versions_yml_main_${NEXT_VERSION}" | ||
| git add versions.yml | ||
| if [ -z "$(git status --porcelain)" ]; then echo "No changes. We're done."; exit 0; fi | ||
| git checkout -b "$BRANCH" | ||
| git commit -m "Bump versions.yml on main to ${NEXT_VERSION}" | ||
| git push origin "$BRANCH" | ||
| gh pr create \ | ||
| --title "Bump versions.yml on main to ${NEXT_VERSION}" \ | ||
| --body "Move main forward to the next minor version now that ${{ inputs.logstash-branch }} has been branched off." \ | ||
| --base main \ | ||
| --head "$BRANCH" | ||
|
|
||
| # "Before feature freeze" - add a new bundler lock file to the release branch. | ||
| add-release-lockfile: | ||
|
v1v marked this conversation as resolved.
Outdated
|
||
| needs: [create-release-branch] | ||
| if: ${{ inputs.skip-branch-creation != true }} | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v5.7.0 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '21' | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ inputs.logstash-branch }} | ||
| fetch-depth: 0 | ||
| - uses: elastic/oblt-actions/git/setup@v1 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Determine previous minor branch | ||
| id: prev | ||
| run: | | ||
| IFS='.' read -r major minor <<< "${{ inputs.logstash-branch }}" | ||
| echo "branch=${major}.$((minor - 1))" >> "$GITHUB_OUTPUT" | ||
| - name: Copy lock file from previous minor branch | ||
| run: | | ||
| PREV_BRANCH="${{ steps.prev.outputs.branch }}" | ||
| git fetch origin "$PREV_BRANCH" --depth 1 | ||
| git checkout "origin/${PREV_BRANCH}" -- 'Gemfile.jruby-*.lock.release' || echo "No previous lock file found, will generate a fresh one." | ||
| - run: ./gradlew clean installDefaultGems | ||
| - run: ./vendor/jruby/bin/jruby -S bundle update --all --strict | ||
| - name: Ensure lock file is named for the release | ||
| run: | | ||
| if [ -f Gemfile.lock ]; then mv Gemfile.lock Gemfile.jruby-3.4.lock.release; fi | ||
| - name: Open PR | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| BRANCH="add_release_lockfile_${{ inputs.logstash-branch }}" | ||
| git add Gemfile.jruby-*.lock.release | ||
| if [ -z "$(git status --porcelain)" ]; then echo "No changes. We're done."; exit 0; fi | ||
| git checkout -b "$BRANCH" | ||
| git commit -m "Add release bundler lock file for ${{ inputs.logstash-branch }}" | ||
| git push origin "$BRANCH" | ||
| gh pr create \ | ||
| --title "Add release bundler lock file for ${{ inputs.logstash-branch }}" \ | ||
| --body "Adds the frozen bundler lock file for the ${{ inputs.logstash-branch }} release branch." \ | ||
| --base "${{ inputs.logstash-branch }}" \ | ||
| --head "$BRANCH" | ||
|
|
||
| # "After feature freeze" - update versions.yml on main to the latest minor, if applicable. | ||
| bump-versions-yml-main-after-freeze: | ||
| needs: [bump-versions-yml-main] | ||
| if: ${{ inputs.next-minor-version != '' }} | ||
| permissions: | ||
|
v1v marked this conversation as resolved.
Outdated
|
||
| contents: write | ||
| pull-requests: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: main | ||
| - uses: elastic/oblt-actions/git/setup@v1 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Update logstash-release-track on main | ||
| run: | | ||
| sed -i "s/^logstash-release-track: .*/logstash-release-track: ${{ inputs.logstash-branch }}/" versions.yml | ||
| - name: Open PR | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| BRANCH="bump_release_track_${{ inputs.logstash-branch }}" | ||
| git add versions.yml | ||
| if [ -z "$(git status --porcelain)" ]; then echo "No changes. We're done."; exit 0; fi | ||
| git checkout -b "$BRANCH" | ||
| git commit -m "Update logstash-release-track on main to ${{ inputs.logstash-branch }}" | ||
| git push origin "$BRANCH" | ||
| gh pr create \ | ||
| --title "Update logstash-release-track on main to ${{ inputs.logstash-branch }}" \ | ||
| --body "Post feature-freeze update of the release track now that ${{ inputs.logstash-branch }} is the active minor." \ | ||
| --base main \ | ||
| --head "$BRANCH" | ||
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.