Skip to content

Commit

Permalink
Merge pull request #21437 from wordpress-mobile/iangmaia/use-buildkit…
Browse files Browse the repository at this point in the history
…e-pipeline-upload

[Tooling] Use `buildkite_pipeline_upload` action to inline Buildkite release pipelines
  • Loading branch information
iangmaia authored Nov 12, 2024
2 parents 0a324b6 + accc6e3 commit 28b1dd9
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 31 deletions.
21 changes: 16 additions & 5 deletions .buildkite/beta-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ steps:
#################
- label: "Gradle Wrapper Validation"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
validate_gradle_wrapper
plugins: [$CI_TOOLKIT]

Expand All @@ -27,14 +28,18 @@ steps:

- label: "🕵️ Lint WordPress"
key: wplint
command: ".buildkite/commands/lint.sh wordpress"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/lint.sh wordpress
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/lint-results*.*"

- label: "🕵️ Lint Jetpack"
key: jplint
command: ".buildkite/commands/lint.sh jetpack"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/lint.sh jetpack
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/lint-results*.*"
Expand All @@ -47,7 +52,9 @@ steps:

- label: ":wordpress: :android: Beta Build"
key: wpbuild
command: ".buildkite/commands/beta-build.sh wordpress"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/beta-build.sh wordpress
depends_on: wplint
plugins: [$CI_TOOLKIT]
notify:
Expand All @@ -59,7 +66,9 @@ steps:

- label: ":jetpack: :android: Beta Build"
key: jpbuild
command: ".buildkite/commands/beta-build.sh jetpack"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/beta-build.sh jetpack
depends_on: jplint
plugins: [$CI_TOOLKIT]
notify:
Expand All @@ -76,5 +85,7 @@ steps:
depends_on:
- wpbuild
- jpbuild
command: ".buildkite/commands/create-github-release.sh"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/create-github-release.sh
plugins: [$CI_TOOLKIT]
2 changes: 2 additions & 0 deletions .buildkite/commands/checkout-editorial-branch.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

echo '--- :git: Checkout Editorial Branch'

# EDITORIAL_BRANCH is passed as an environment variable from fastlane to Buildkite
#
if [[ -z "${EDITORIAL_BRANCH}" ]]; then
Expand Down
8 changes: 3 additions & 5 deletions .buildkite/commands/checkout-release-branch.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/bin/bash -eu

# RELEASE_VERSION is passed as an environment variable passed to Buildkite by ReleasesV2.
if [[ -z "${RELEASE_VERSION}" ]]; then
echo "RELEASE_VERSION is not set."
exit 1
fi
echo "--- :git: Checkout Release Branch"

RELEASE_VERSION="${1?Please provide a release version as an argument.}"

# Buildkite, by default, checks out a specific commit. For many release actions, we need to be
# on a release branch instead.
Expand Down
3 changes: 1 addition & 2 deletions .buildkite/complete-code-freeze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ steps:
echo '--- :robot_face: Use bot for git operations'
source use-bot-for-git
echo '--- :git: Checkout Release Branch'
.buildkite/commands/checkout-release-branch.sh
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
echo '--- :ruby: Setup Ruby Tools'
install_gems
Expand Down
3 changes: 1 addition & 2 deletions .buildkite/finalize-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ steps:
echo '--- :robot_face: Use bot for git operations'
source use-bot-for-git
echo '--- :git: Checkout Release Branch'
.buildkite/commands/checkout-release-branch.sh
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
echo '--- :ruby: Setup Ruby Tools'
install_gems
Expand Down
3 changes: 1 addition & 2 deletions .buildkite/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ steps:
echo '--- :robot_face: Use bot for git operations'
source use-bot-for-git
echo '--- :git: Checkout Release Branch'
.buildkite/commands/checkout-release-branch.sh
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
echo '--- :ruby: Setup Ruby tools'
install_gems
Expand Down
21 changes: 16 additions & 5 deletions .buildkite/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ steps:
#################
- label: "Gradle Wrapper Validation"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
validate_gradle_wrapper
priority: 1
plugins: [$CI_TOOLKIT]
Expand All @@ -28,15 +29,19 @@ steps:

- label: "🕵️ Lint WordPress"
key: wplint
command: ".buildkite/commands/lint.sh wordpress"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/lint.sh wordpress
priority: 1
plugins: [$CI_TOOLKIT]
artifact_paths:
- "**/build/reports/lint-results*.*"

- label: "🕵️ Lint Jetpack"
key: jplint
command: ".buildkite/commands/lint.sh jetpack"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/lint.sh jetpack
priority: 1
plugins: [$CI_TOOLKIT]
artifact_paths:
Expand All @@ -50,7 +55,9 @@ steps:

- label: ":wordpress: :android: Release Build"
key: wpbuild
command: ".buildkite/commands/release-build.sh wordpress"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/release-build.sh wordpress
priority: 1
depends_on: wplint
plugins: [$CI_TOOLKIT]
Expand All @@ -63,7 +70,9 @@ steps:

- label: ":jetpack: :android: Release Build"
key: jpbuild
command: ".buildkite/commands/release-build.sh jetpack"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/release-build.sh jetpack
priority: 1
depends_on: jplint
plugins: [$CI_TOOLKIT]
Expand All @@ -81,6 +90,8 @@ steps:
depends_on:
- wpbuild
- jpbuild
command: ".buildkite/commands/create-github-release.sh"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/create-github-release.sh
priority: 1
plugins: [$CI_TOOLKIT]
1 change: 0 additions & 1 deletion .buildkite/update-release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ steps:
echo '--- :robot_face: Use bot for git operations'
source use-bot-for-git
echo '--- :git: Checkout Editorial Branch'
.buildkite/commands/checkout-editorial-branch.sh
echo '--- :ruby: Setup Ruby Tools'
Expand Down
29 changes: 20 additions & 9 deletions fastlane/lanes/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -548,19 +548,30 @@ def commit_version_bump
end

def trigger_buildkite_release_build(branch:, beta:)
environment = {
RELEASE_VERSION: current_release_version
}

pipeline_file = beta ? 'beta-builds.yml' : 'release-builds.yml'
message = beta ? 'Beta Builds' : 'Release Builds'

build_url = buildkite_trigger_build(
buildkite_organization: 'automattic',
buildkite_pipeline: 'wordpress-android',
branch: branch,
pipeline_file: pipeline_file,
message: message
)
# If we're running on CI, we can directly start the release pipeline jobs within the same build
if is_ci
buildkite_pipeline_upload(
pipeline_file: pipeline_file,
environment: environment
)
else
build_url = buildkite_trigger_build(
buildkite_organization: 'automattic',
buildkite_pipeline: 'wordpress-android',
branch: branch,
pipeline_file: pipeline_file,
message: message
)

message = "This build triggered a build on <code>#{branch}</code>:<br>- #{build_url}"
buildkite_annotate(style: 'info', context: 'trigger-release-build', message: message) if is_ci
UI.success("Release build triggered on #{branch}: #{build_url}")
end
end

def create_backmerge_pr(source_branch: "release/#{current_release_version}", target_branch: nil)
Expand Down

0 comments on commit 28b1dd9

Please sign in to comment.