Skip to content

Commit

Permalink
[Tooling] Use buildkite_pipeline_upload action to inline Buildkite …
Browse files Browse the repository at this point in the history
…release pipelines (#23782)

* Update gem dependencies

* Update Fastfile to add the `buildkite_pipeline_upload` call

* Checkout the release branch before creating a new build

* Move echo call to .buildkite/commands/checkout-release-branch.sh and standardize script calls

* [TO REVERT] Disable side effects to complete-code-freeze pipeline for testing

* Revert "[TO REVERT] Disable side effects to complete-code-freeze pipeline for testing"

This reverts commit 7863f25.
  • Loading branch information
iangmaia authored Nov 12, 2024
1 parent 5b3871e commit 7ca8f48
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .buildkite/commands/checkout-release-branch.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -eu

echo '--- :git: Checkout release branch'

RELEASE_NUMBER=$1

if [[ -z "${RELEASE_NUMBER}" ]]; then
Expand Down
1 change: 0 additions & 1 deletion .buildkite/commands/complete-code-freeze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fi
echo '--- :robot_face: Use bot for Git operations'
source use-bot-for-git

echo '--- :git: Checkout release branch'
.buildkite/commands/checkout-release-branch.sh "$RELEASE_NUMBER"

echo '--- :ruby: Setup Ruby tools'
Expand Down
1 change: 0 additions & 1 deletion .buildkite/commands/finalize-hotfix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fi
echo '--- :robot_face: Use bot for Git operations'
source use-bot-for-git

echo '--- :git: Checkout release branch'
.buildkite/commands/checkout-release-branch.sh "$RELEASE_NUMBER"

echo '--- :ruby: Setup Ruby tools'
Expand Down
1 change: 0 additions & 1 deletion .buildkite/commands/finalize-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fi
echo '--- :robot_face: Use bot for Git operations'
source use-bot-for-git

echo '--- :git: Checkout release branch'
.buildkite/commands/checkout-release-branch.sh "$RELEASE_NUMBER"

echo '--- :ruby: Setup Ruby tools'
Expand Down
1 change: 0 additions & 1 deletion .buildkite/commands/log-outdated-pods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ fi
echo '--- :robot_face: Use bot for Git operations'
source use-bot-for-git

echo '--- :git: Checkout release branch'
.buildkite/commands/checkout-release-branch.sh "$RELEASE_NUMBER"

echo '--- :ruby: Setup Ruby tools'
Expand Down
8 changes: 6 additions & 2 deletions .buildkite/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ env:
steps:

- label: ":wordpress: :testflight: WordPress Release Build (App Store Connect)"
command: ".buildkite/commands/release-build-wordpress.sh $BETA_RELEASE"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/release-build-wordpress.sh $IS_BETA_RELEASE
plugins: [$CI_TOOLKIT_PLUGIN]
notify:
- slack: "#build-and-ship"
Expand All @@ -18,7 +20,9 @@ steps:
allowed: false

- label: ":jetpack: :testflight: Jetpack Release Build (App Store Connect)"
command: ".buildkite/commands/release-build-jetpack.sh"
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/release-build-jetpack.sh
plugins: [$CI_TOOLKIT_PLUGIN]
notify:
- slack: "#build-and-ship"
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/release-pipelines/complete-code-freeze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ steps:
- label: Complete Code Freeze
key: complete_code_freeze
plugins: [$CI_TOOLKIT_PLUGIN]
command: .buildkite/commands/complete-code-freeze.sh $RELEASE_VERSION
command: .buildkite/commands/complete-code-freeze.sh "$RELEASE_VERSION"
retry:
manual:
# If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite
Expand All @@ -21,7 +21,7 @@ steps:
- label: Log Outdated Pods
depends_on: complete_code_freeze
plugins: [$CI_TOOLKIT_PLUGIN]
command: .buildkite/commands/log-outdated-pods.sh $RELEASE_VERSION
command: .buildkite/commands/log-outdated-pods.sh "$RELEASE_VERSION"
retry:
manual:
# If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/release-pipelines/finalize-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ steps:
- label: Finalize Release
plugins:
- $CI_TOOLKIT_PLUGIN
command: .buildkite/commands/finalize-release.sh $RELEASE_VERSION
command: .buildkite/commands/finalize-release.sh "$RELEASE_VERSION"
retry:
manual:
# If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite
Expand Down
3 changes: 1 addition & 2 deletions .buildkite/release-pipelines/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,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 $RELEASE_VERSION
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
echo '--- :ruby: Setup Ruby tools'
install_gems
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source 'https://rubygems.org'

gem 'cocoapods', '~> 1.16'
gem 'danger-dangermattic', '~> 1.1'
gem 'danger-dangermattic', '~> 1.2'
gem 'dotenv'
# 2.223.1 includes a fix for an ASC-interfacing issue
#
Expand All @@ -15,9 +15,9 @@ gem 'fastlane-plugin-sentry'
# This comment avoids typing to switch to a development version for testing.
#
# gem 'fastlane-plugin-wpmreleasetoolkit', git: 'https://github.com/wordpress-mobile/release-toolkit', ref: ''
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 12.2'
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 12.3'
gem 'rake'
gem 'rubocop', '~> 1.60'
gem 'rubocop', '~> 1.68'
gem 'rubocop-rake', '~> 0.6'
gem 'xcpretty-travis-formatter'

Expand Down
34 changes: 18 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ GEM
ast (2.4.2)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.999.0)
aws-sdk-core (3.211.0)
aws-partitions (1.1001.0)
aws-sdk-core (3.212.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.95.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.169.0)
aws-sdk-s3 (1.170.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -98,7 +98,8 @@ GEM
connection_pool (2.4.1)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.5.0)
danger (9.5.1)
base64 (~> 0.2)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
Expand All @@ -109,8 +110,9 @@ GEM
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
octokit (>= 4.0)
pstore (~> 0.1)
terminal-table (>= 1, < 4)
danger-dangermattic (1.1.2)
danger-dangermattic (1.2.1)
danger (~> 9.4)
danger-plugin-api (~> 1.0)
danger-rubocop (~> 0.13)
Expand Down Expand Up @@ -208,7 +210,7 @@ GEM
fastlane-plugin-appcenter (2.1.2)
fastlane-plugin-sentry (1.25.1)
os (~> 1.1, >= 1.1.4)
fastlane-plugin-wpmreleasetoolkit (12.2.1)
fastlane-plugin-wpmreleasetoolkit (12.3.0)
activesupport (>= 6.1.7.1)
buildkit (~> 1.5)
chroma (= 0.2.0)
Expand Down Expand Up @@ -278,7 +280,7 @@ GEM
concurrent-ruby (~> 1.0)
java-properties (0.3.0)
jmespath (1.6.2)
json (2.7.6)
json (2.8.1)
jwt (2.9.3)
base64
kramdown (2.4.0)
Expand Down Expand Up @@ -310,14 +312,15 @@ GEM
optparse (0.5.0)
os (1.1.4)
parallel (1.26.3)
parser (3.3.4.1)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
pkg-config (1.5.6)
pkg-config (1.5.7)
plist (3.7.1)
progress_bar (1.3.4)
highline (>= 1.6)
options (~> 2.3.0)
pstore (0.1.3)
public_suffix (4.0.7)
racc (1.8.1)
rainbow (3.1.1)
Expand All @@ -335,18 +338,17 @@ GEM
rmagick (5.3.0)
pkg-config (~> 1.4)
rouge (2.0.7)
rubocop (1.65.1)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.0)
rubocop-ast (1.34.1)
parser (>= 3.3.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
Expand Down Expand Up @@ -400,15 +402,15 @@ PLATFORMS

DEPENDENCIES
cocoapods (~> 1.16)
danger-dangermattic (~> 1.1)
danger-dangermattic (~> 1.2)
dotenv
fastlane (~> 2.225)
fastlane-plugin-appcenter (~> 2.1)
fastlane-plugin-sentry
fastlane-plugin-wpmreleasetoolkit (~> 12.2)
fastlane-plugin-wpmreleasetoolkit (~> 12.3)
rake
rmagick (~> 5.3.0)
rubocop (~> 1.60)
rubocop (~> 1.68)
rubocop-rake (~> 0.6)
xcpretty-travis-formatter

Expand Down
1 change: 1 addition & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ INTERNAL_VERSION_FILE = Fastlane::Wpmreleasetoolkit::Versioning::IOSVersionFile.

BUILDKITE_ORGANIZATION = 'automattic'
BUILDKITE_PIPELINE = 'wordpress-ios'
BUILDKITE_RELEASE_PIPELINE = 'release-builds.yml'

# Use this instead of getting values from ENV directly. It will throw an error if the requested value is missing
def get_required_env(key)
Expand Down
32 changes: 21 additions & 11 deletions fastlane/lanes/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -504,19 +504,29 @@
# @param [Boolean] beta Indicate if we should build a beta or regular release
#
def trigger_buildkite_release_build(branch:, beta:)
build_url = buildkite_trigger_build(
buildkite_organization: BUILDKITE_ORGANIZATION,
buildkite_pipeline: BUILDKITE_PIPELINE,
branch: branch,
environment: { BETA_RELEASE: beta },
pipeline_file: 'release-builds.yml',
message: beta ? 'Beta Builds' : 'Release Builds'
)
environment = {
IS_BETA_RELEASE: beta,
RELEASE_VERSION: release_version_current
}

return unless is_ci
# 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: BUILDKITE_RELEASE_PIPELINE,
environment: environment
)
else
build_url = buildkite_trigger_build(
buildkite_organization: BUILDKITE_ORGANIZATION,
buildkite_pipeline: BUILDKITE_PIPELINE,
branch: branch,
environment: environment,
pipeline_file: BUILDKITE_RELEASE_PIPELINE,
message: beta ? 'Beta Builds' : 'Release Builds'
)

message = "This build triggered a build on `#{branch}`:\n\n- #{build_url}"
buildkite_annotate(style: 'info', context: 'trigger-release-build', message: message)
UI.success("Release build triggered on #{branch}: #{build_url}")
end
end

# Checks that the Gutenberg pod is reference by a tag and not a commit
Expand Down

0 comments on commit 7ca8f48

Please sign in to comment.