Skip to content
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

ci(release): automate release steps for the minor #12233

Merged
merged 69 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
362bfd6
ci(release): automate release steps
v1v Dec 18, 2023
d496968
Merge remote-tracking branch 'upstream/main' into feature/automate-re…
v1v Dec 19, 2023
170be4c
refactor a bit
v1v Dec 19, 2023
14b37df
report non supported versions
v1v Dec 19, 2023
01a46d9
rename make goals and add some docs
v1v Dec 19, 2023
5160ab9
cosmetic changes in the slack messages
v1v Dec 19, 2023
26b7c55
support slack threads
v1v Dec 19, 2023
1e6b4b6
fix
v1v Dec 19, 2023
e530a73
chore
v1v Dec 19, 2023
0144e15
chore
v1v Dec 19, 2023
40c915e
refactor: patch
v1v Dec 19, 2023
f23de22
refactor: minor
v1v Dec 19, 2023
40e1680
fix
v1v Dec 19, 2023
6bde939
use slack channel env
v1v Dec 19, 2023
7bb4582
use output slack-thread
v1v Dec 19, 2023
677b466
avoid concurrency
v1v Dec 19, 2023
73b1a28
support full checkout and validaitons
v1v Dec 19, 2023
e33feb6
notify what's the error if any failure
v1v Dec 19, 2023
bf6e5f7
fix
v1v Dec 19, 2023
12453ef
chore
v1v Dec 19, 2023
01248e5
initial
v1v Dec 20, 2023
04ce400
exclude
v1v Dec 20, 2023
e4af33a
chore
v1v Dec 20, 2023
6e60869
enable mergify and yq
v1v Dec 20, 2023
299e6d8
update mergify if required
v1v Dec 20, 2023
05de44a
Revert "update mergify if required"
v1v Dec 20, 2023
29f763d
update mergify if required
v1v Dec 20, 2023
d09fd29
use RELEASE_BRANCH
v1v Dec 20, 2023
eb68c73
fix
v1v Dec 20, 2023
e0cf89e
support prs
v1v Dec 20, 2023
15b91e5
run only if things were created correctly
v1v Dec 20, 2023
5ea611e
fix
v1v Dec 20, 2023
887517d
force branch
v1v Dec 20, 2023
2ed60df
refactor
v1v Dec 21, 2023
6c4aa1b
refactor
v1v Dec 21, 2023
eb57f2b
github warn
v1v Dec 21, 2023
adf652e
enable
v1v Dec 21, 2023
bccf6bc
set makefile and use variable
v1v Dec 21, 2023
09fcacc
fix
v1v Dec 21, 2023
0096080
fix
v1v Dec 21, 2023
8090f3e
create head
v1v Dec 21, 2023
ae0ee78
update changelog
v1v Dec 21, 2023
5d36ebc
replace compare
v1v Dec 21, 2023
ac67c09
modify
v1v Dec 21, 2023
9d78692
partial
v1v Dec 21, 2023
61b6658
fix
v1v Dec 21, 2023
8abd8e6
fix
v1v Dec 21, 2023
995c0ac
refactor
v1v Dec 21, 2023
c36a7c5
docs
v1v Dec 21, 2023
a1e1d64
test
v1v Dec 21, 2023
6668224
action: grant permissions
v1v Dec 21, 2023
0bfd73e
notify if failrues
v1v Dec 21, 2023
bd4087f
use base branch
v1v Dec 21, 2023
53202e9
fix hardcoded value
v1v Dec 21, 2023
8ce0aa4
remove leaving directory
v1v Dec 21, 2023
710c429
cannot user github bot to create PRs
v1v Dec 21, 2023
532a45f
chore
v1v Dec 21, 2023
488da7f
enable
v1v Dec 21, 2023
8087b19
chore
v1v Dec 21, 2023
9e976b3
fix
v1v Dec 21, 2023
a7b9237
production
v1v Dec 21, 2023
9781ad0
use release version
v1v Dec 21, 2023
db90eb6
Merge remote-tracking branch 'upstream/main' into feature/automate-re…
v1v Dec 21, 2023
a1afb16
support for https://github.com/elastic/apm-server/pull/12251
v1v Dec 21, 2023
6a7bd31
Merge branch 'main' into feature/automate-release-process
simitt Jan 2, 2024
b8db352
Merge branch 'main' into feature/automate-release-process
simitt Jan 3, 2024
586f00e
Merge branch 'main' into feature/automate-release-process
carsonip Jan 3, 2024
f8e804f
Merge branch 'main' into feature/automate-release-process
v1v Jan 3, 2024
3d01476
Merge branch 'main' into feature/automate-release-process
kruskall Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/prepare-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help run some pre-flight validations

name: prepare-release
description: Common tasks for preparing minor and patch releases

inputs:
type:
description: 'Release type (minor or patch)'
required: true
version:
description: 'The version'
required: true
vault-url:
description: 'Vault URL'
required: true
vault-role-id:
description: 'Vault role ID'
required: true
vault-secret-id:
description: 'Vault secret ID'
required: true

outputs:
release-branch:
description: "Release branch (relevant for minor releases)"
value: ${{ steps.generate.outputs.release-branch }}
release-version:
description: "Release version"
value: ${{ steps.generate.outputs.release-version }}
slack-thread:
description: "Slack thread id"
value: ${{ steps.slack-thread.outputs.threadTimestamp }}

runs:
using: "composite"
steps:
- name: Send slack message when started
id: slack-thread
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
with:
url: ${{ inputs.vault-url }}
roleId: ${{ inputs.vault-role-id }}
secretId: ${{ inputs.vault-secret-id }}
channel: ${{ env.SLACK_CHANNEL }}
message: ":wave: This is the thread for the ${{ inputs.type }} release `${{ github.repository }}@${{ env.VERSION }}`. (<${{ env.JOB_URL }}|workflow run>)"
env:
VERSION: ${{ inputs.version }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

- id: generate
run: |-
echo "release-branch=${VERSION%.*}" >> "${GITHUB_OUTPUT}"
echo "release-version=${VERSION}" >> "${GITHUB_OUTPUT}"
env:
VERSION: ${{ inputs.version }}
shell: 'bash'

- name: validate version format (minor only)
if: ${{ inputs.type == 'minor' && ! endsWith(inputs.version, '0') }}
run: |-
FAILURE_MESSAGE='version is not a minor one but a patch (only support for <major>.<minor>.0)'
echo "FAILURE_MESSAGE=${FAILURE_MESSAGE}" >> "$GITHUB_ENV"
echo "::error::${FAILURE_MESSAGE}" ; exit 1
shell: 'bash'

- name: validate version format (patch only)
if: ${{ inputs.type == 'patch' && endsWith(inputs.version, '0') }}
run: |-
FAILURE_MESSAGE='version is not a patch one but a minor (only support for <major>.<minor>.[1-9]+[0-9]*)'
echo "FAILURE_MESSAGE=${FAILURE_MESSAGE}" >> "$GITHUB_ENV"
echo "::error::${FAILURE_MESSAGE}" ; exit 1
shell: 'bash'

- name: validate if branch already exists (minor only)
if: ${{ inputs.type == 'minor' }}
run: |-
if git ls-remote --exit-code --heads https://github.com/${{ github.repository }}.git "$BRANCH" > /dev/null ; then
FAILURE_MESSAGE='Branch already exists. This is not a minor release.'
echo "FAILURE_MESSAGE=${FAILURE_MESSAGE}" >> "$GITHUB_ENV"
echo "::error::${FAILURE_MESSAGE}" ; exit 1
fi
shell: 'bash'
env:
BRANCH: ${{ steps.generate.outputs.release-branch }}

- name: validate if tag already exists
run: |-
if git ls-remote --exit-code https://github.com/${{ github.repository }}.git "$TAG" > /dev/null ; then
FAILURE_MESSAGE='Tag already exists.'
echo "FAILURE_MESSAGE=${FAILURE_MESSAGE}" >> "$GITHUB_ENV"
echo "::error::${FAILURE_MESSAGE}" ; exit 1
fi
shell: 'bash'
env:
TAG: 'refs/tags/v${{ steps.generate.outputs.release-version }}'

- uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
if: failure()
with:
url: ${{ inputs.vault-url }}
roleId: ${{ inputs.vault-role-id }}
secretId: ${{ inputs.vault-secret-id }}
channel: ${{ env.SLACK_CHANNEL }}
threadTimestamp: ${{ steps.slack-thread.outputs.threadTimestamp || '' }}
message: |-
:fire: Something went wrong with the ${{ inputs.type }} release preparation. It failed with the below error message:
`${{ env.FAILURE_MESSAGE }}`.
See <${{ env.JOB_URL }}|logs>.
env:
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
93 changes: 90 additions & 3 deletions .github/workflows/run-minor-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,105 @@ on:
workflow_dispatch:
inputs:
version:
description: 'The version (semver format: major.minor.patch)'
description: 'The version (semver format: major.minor.0)'
required: true
type: string

# Avoid concurrency so we can watch the releases correctly
concurrency:
group: ${{ github.workflow }}

permissions:
contents: read

env:
SLACK_CHANNEL: "#apm-server-test-release"

JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_CHANNEL: "#apm-server"

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
release-branch: ${{ steps.prepare.outputs.release-branch }}
release-version: ${{ steps.prepare.outputs.release-version }}
slack-thread: ${{ steps.prepare.outputs.slack-thread }}
steps:
- uses: actions/checkout@v4
- id: prepare
uses: ./.github/workflows/prepare-release
with:
vault-url: ${{ secrets.VAULT_ADDR }}
vault-role-id: ${{ secrets.VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.VAULT_SECRET_ID }}
version: ${{ inputs.version }}
type: 'minor'

run-minor:
runs-on: ubuntu-latest
needs: [ prepare ]
env:
RELEASE_BRANCH: ${{ needs.prepare.outputs.release-branch }}
RELEASE_VERSION: ${{ needs.prepare.outputs.release-version }}
permissions:
contents: write
steps:

- uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: ${{ env.SLACK_CHANNEL }}
threadTimestamp: ${{ needs.prepare.outputs.slack-thread || '' }}
message: |-
Feature freeze for `${{ github.repository }}@${{ env.RELEASE_VERSION }}` just started.
The `${{ github.repository }}@${{ env.RELEASE_BRANCH }}` branch will be created Today.

- uses: actions/checkout@v4
with:
# 0 indicates all history for all branches and tags.
fetch-depth: 0

# Required to use a service account, otherwise PRs created by
# GitHub bot won't trigger any CI builds.
# See https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-537478081
- name: Configure github token
uses: elastic/apm-pipeline-library/.github/actions/github-token@current
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}

- name: Configure git user
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
with:
username: ${{ env.GIT_USER }}
email: ${{ env.GIT_EMAIL }}
token: ${{ env.GITHUB_TOKEN }}

- run: make minor-release
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}

- uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
if: success()
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: ${{ env.SLACK_CHANNEL }}
threadTimestamp: ${{ needs.prepare.outputs.slack-thread || '' }}
message: |-
`${{ github.repository }}@${{ env.RELEASE_BRANCH }}` is now available.
The docs and other references are updated. You can start using it.

- uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
if: failure()
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: ${{ env.SLACK_CHANNEL }}
threadTimestamp: ${{ needs.prepare.outputs.slack-thread || '' }}
message: |-
:fire: Something went wrong with the release. See <${{ env.JOB_URL }}|logs>.
43 changes: 42 additions & 1 deletion .github/workflows/run-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,55 @@ on:
required: true
type: string

# Avoid concurrency so we can watch the releases correctly
concurrency:
group: ${{ github.workflow }}

permissions:
contents: read

env:
SLACK_CHANNEL: "#apm-server-test-release"
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_CHANNEL: "#apm-server"

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.prepare.outputs.release-version }}
slack-thread: ${{ steps.prepare.outputs.slack-thread }}
steps:
- uses: actions/checkout@v4

- id: prepare
uses: ./.github/workflows/prepare-release
with:
vault-url: ${{ secrets.VAULT_ADDR }}
vault-role-id: ${{ secrets.VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.VAULT_SECRET_ID }}
version: ${{ inputs.version }}
type: 'patch'

run-patch:
runs-on: ubuntu-latest
needs: [ prepare ]
env:
RELEASE_VERSION: ${{ needs.prepare.outputs.release-version }}
steps:
- uses: actions/checkout@v4
with:
# 0 indicates all history for all branches and tags.
fetch-depth: 0

- run: make patch-release

- uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
with:
url: ${{ secrets.VAULT_ADDR }}
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
channel: ${{ env.SLACK_CHANNEL }}
threadTimestamp: ${{ needs.prepare.outputs.slack-thread || '' }}
message: |-
Feature freeze for `${{ github.repository }}@${{ env.RELEASE_VERSION }}` is Today.
All the relevant PRs and issues have been created.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ testing/smoke/**/main.tf
!testing/smoke/supported-os/main.tf
!testing/smoke/managed/main.tf
testing/rally-cloud/build
.bck
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

include go.mk
include packaging.mk
include release.mk

# By default we run tests with verbose output. This may be overridden, e.g.
# scripts may set GOTESTFLAGS=-json to format test output for processing.
Expand Down
Loading