[release-11.3.4] CI: Backport to release branches (#100692)

* CI: Backport to release branches (#100067)

* update backport and release comms

* Backport to release branches and change docs source branch for publishing

* Add new workflows to CODEOWNERS

* Re-add removed line oops

* backport-testing -> grafana

* checkout grafana repo in backport action, reference repo / branch in reusable action

* generate -> create

(cherry picked from commit 6787cdccb9)

* remove v
pull/100744/head
Kevin Minehart 4 months ago committed by GitHub
parent ec913bf706
commit e0f120d757
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      .github/CODEOWNERS
  2. 15
      .github/workflows/backport.yml
  3. 43
      .github/workflows/create-next-release-branch.yml
  4. 50
      .github/workflows/migrate-prs.yml
  5. 6
      .github/workflows/publish-technical-documentation-release.yml
  6. 50
      .github/workflows/release-comms.yml
  7. 18
      .github/workflows/release-pr.yml

@ -695,12 +695,14 @@ embed.go @grafana/grafana-as-code
/.github/renovate.json5 @grafana/frontend-ops
/.github/teams.yml @armandgrillet
/.github/workflows/alerting-swagger-gen.yml @grafana/alerting-backend
/.github/workflows/auto-milestone.yml @grafana/grafana-release-guild
/.github/workflows/backport.yml @grafana/grafana-release-guild
/.github/workflows/bump-version.yml @grafana/grafana-release-guild
/.github/workflows/close-milestone.yml @grafana/grafana-release-guild
/.github/workflows/release-pr.yml @grafana/grafana-release-guild
/.github/workflows/release-comms.yml @grafana/grafana-release-guild
/.github/workflows/auto-milestone.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/backport.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/bump-version.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/close-milestone.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/release-pr.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/release-comms.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/migrate-prs.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/create-next-release-branch.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/codeowners-validator.yml @tolzhabayev
/.github/workflows/codeql-analysis.yml @DanCech
/.github/workflows/commands.yml @torkelo

@ -10,24 +10,19 @@ jobs:
if: github.repository == 'grafana/grafana'
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
- name: Checkout
uses: actions/checkout@v4
with:
repository: "grafana/grafana-github-actions"
path: ./actions
ref: main
- name: Install Actions
run: npm install --production --prefix ./actions
- name: "Generate token"
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
with:
app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }}
private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }}
- run: git config --global user.email '132647405+grafana-delivery-bot[bot]@users.noreply.github.com'
- run: git config --global user.name 'grafana-delivery-bot[bot]'
- run: git remote set-url origin "https://grafana-delivery-bot:${{ steps.generate_token.outputs.token }}@github.com/grafana/grafana.git"
- name: Run backport
uses: ./actions/backport
uses: grafana/grafana-github-actions-go/backport@main
with:
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}
token: ${{ steps.generate_token.outputs.token }}
labelsToAdd: "backport"
title: "[{{base}}] {{originalTitle}}"

@ -0,0 +1,43 @@
name: Create next release branch
on:
workflow_call:
inputs:
ownerRepo:
type: string
description: Owner/repo of the repository where the branch is created (e.g. 'grafana/grafana')
required: true
source:
description: The release branch to increment (eg providing `release-11.2.3` will result in `release-11.2.4` being created)
type: string
required: true
secrets:
token:
required: true
outputs:
branch:
description: The new branch that was created
value: ${{ jobs.main.outputs.branch }}
workflow_dispatch:
inputs:
ownerRepo:
description: Owner/repo of the repository where the branch is created (e.g. 'grafana/grafana')
source:
description: The release branch to increment (eg providing `release-11.2.3` will result in `release-11.2.4` being created)
type: string
required: true
secrets:
token:
required: true
jobs:
main:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.branch.outputs.branch }}
steps:
- name: Create release branch
id: branch
uses: grafana/grafana-github-actions-go/bump-release@main
with:
ownerRepo: ${{ inputs.ownerRepo }}
source: ${{ inputs.source }}
token: ${{ secrets.token }}

@ -0,0 +1,50 @@
name: Migrate open PRs
# Migrate open PRs from a superseded release branch to the current release branch and notify authors
on:
workflow_call:
inputs:
from:
description: 'The base branch to check for open PRs'
required: true
type: string
to:
description: 'The base branch to migrate open PRs to'
required: true
type: string
ownerRepo:
description: Owner/repo of the repository where the branch is created (e.g. 'grafana/grafana')
required: true
type: string
secrets:
token:
required: true
workflow_dispatch:
inputs:
from:
description: 'The base branch to check for open PRs'
required: true
type: string
to:
description: 'The base branch to migrate open PRs to'
required: true
type: string
ownerRepo:
description: Owner/repo of the repository where the branch is created (e.g. 'grafana/grafana')
required: true
type: string
secrets:
token:
required: true
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Migrate PRs
uses: grafana/grafana-github-actions-go/migrate-open-prs@main
with:
token: ${{ secrets.token }}
ownerRepo: ${{ inputs.ownerRepo }}
from: ${{ inputs.from }}
to: ${{ inputs.to }}
binary_release_tag: 'dev'

@ -3,7 +3,7 @@ name: publish-technical-documentation-release
on:
push:
branches:
- v[0-9]+.[0-9]+.x
- release-[0-9]+.[0-9]+.[0-9]+
tags:
- v[0-9]+.[0-9]+.[0-9]+
paths:
@ -23,7 +23,7 @@ jobs:
- uses: grafana/writers-toolkit/publish-technical-documentation-release@publish-technical-documentation-release/v2
with:
release_tag_regexp: "^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
release_branch_regexp: "^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.x$"
release_branch_with_patch_regexp: "^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
release_branch_regexp: "^release-(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
release_branch_with_patch_regexp: "^release-(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
website_directory: content/docs/grafana
version_suffix: ""

@ -27,10 +27,18 @@ jobs:
name: Setup and establish latest
outputs:
version: ${{ steps.output.outputs.version }}
release_branch: ${{ steps.output.outputs.release_branch }}
dry_run: ${{ steps.output.outputs.dry_run }}
latest: ${{ steps.output.outputs.latest }}
token: ${{ steps.output.outputs.token }}
runs-on: ubuntu-latest
steps:
- name: "Generate token"
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
with:
app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }}
private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }}
# The github-release action expects a `LATEST` value of a string of either '1' or '0'
- if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
@ -49,9 +57,51 @@ jobs:
echo "latest: $LATEST"
echo "version: $VERSION"
echo "release_branch=$(echo $VERSION | sed -s 's/^v/release-/g')" >> "$GITHUB_OUTPUT"
echo "token=${{ steps.generate_token.outputs.token }}" >> "$GITHUB_OUTPUT"
echo "dry_run=$DRY_RUN" >> "$GITHUB_OUTPUT"
echo "latest=$LATEST" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
create_next_release_branch_grafana:
name: Create next release branch (Grafana)
needs: setup
uses: ./.github/workflows/create-next-release-branch.yml
with:
ownerRepo: 'grafana/grafana'
source: ${{ needs.setup.outputs.release_branch }}
secrets:
token: ${{ needs.setup.outputs.token }}
create_next_release_branch_enterprise:
name: Create next release branch (Grafana Enterprise)
needs: setup
uses: ./.github/workflows/create-next-release-branch.yml
with:
ownerRepo: 'grafana/grafana'
source: ${{ needs.setup.outputs.release_branch }}
secrets:
token: ${{ needs.setup.outputs.token }}
migrate_prs_grafana:
needs:
- setup
- create_next_release_branch_grafana
uses: ./.github/workflows/migrate-prs.yml
with:
ownerRepo: 'grafana/grafana'
from: ${{ needs.setup.outputs.release_branch }}
to: ${{ needs.create_next_release_branch_grafana.outputs.branch }}
secrets:
token: ${{ needs.setup.outputs.token }}
migrate_prs_enterprise:
needs:
- setup
- create_next_release_branch_enterprise
uses: ./.github/workflows/migrate-prs.yml
with:
ownerRepo: 'grafana/grafana-enterprise'
from: ${{ needs.setup.outputs.release_branch }}
to: ${{ needs.create_next_release_branch_enterprise.outputs.branch }}
secrets:
token: ${{ needs.setup.outputs.token }}
post_changelog_on_forum:
needs: setup
uses: ./.github/workflows/community-release.yml

@ -4,7 +4,7 @@
# Please refrain from including any processes that do not result in code changes in this workflow. Instead, they should
# either be triggered in the release promotion process or in the release comms process (that is triggered by merging
# this PR).
name: Complete a Grafana release
name: Grafana Release PR
on:
workflow_dispatch:
inputs:
@ -19,7 +19,7 @@ on:
target:
required: true
type: string
description: The base branch that these changes are being merged into
description: The release branch pattern (eg v9.5.x) that these changes are being merged into
backport:
required: false
type: string
@ -61,10 +61,17 @@ jobs:
with:
app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }}
private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }}
- name: Get release branch
id: branch
uses: grafana/grafana-github-actions-go/latest-release-branch@main
with:
token: ${{ steps.generate_token.outputs.token }}
ownerRepo: 'grafana/grafana'
pattern: ${{ inputs.target }}
- name: Checkout Grafana
uses: actions/checkout@v4
with:
ref: ${{ inputs.target }}
ref: ${{ steps.branch.outputs.branch }}
fetch-depth: 0
fetch-tags: true
- name: Checkout Grafana (main)
@ -124,7 +131,6 @@ jobs:
rm -f CHANGELOG.part changelog_items.md
git diff CHANGELOG.md
- name: "Prettify CHANGELOG.md"
run: npx prettier --write CHANGELOG.md
- name: Commit CHANGELOG.md changes
@ -151,7 +157,7 @@ jobs:
$( [ "x${{ inputs.latest }}" == "xtrue" ] && printf %s '-l "release/latest"') \
-l "no-changelog" \
--dry-run=${{ inputs.dry_run }} \
-B "${{ inputs.target }}" \
-B "${{ steps.branch.outputs.branch }}" \
--title "Release: ${{ inputs.version }}" \
--body "These code changes must be merged after a release is complete"
env:
@ -165,7 +171,7 @@ jobs:
-l "product-approved" \
-l "no-changelog" \
--dry-run=${{ inputs.dry_run }} \
-B "${{ inputs.target }}" \
-B "${{ steps.branch.outputs.branch }}" \
--title "Release: ${{ inputs.version }}" \
--body "These code changes must be merged after a release is complete"
env:

Loading…
Cancel
Save