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 (#14244)
  • Loading branch information
iangmaia authored Nov 4, 2024
2 parents 83164ad + b5cafdd commit a2dd518
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 40 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"

# Note: `BUILDKITE_RELEASE_VERSION` is the legacy environment variable passed to Buildkite by ReleaseV2.
# It used the `BUILDKITE_` prefix so it was not filtered out when passed to the MacOS VMs, due to how `hostmgr` works.
# This is considered legacy: we should eventually remove all use of custom `BUILDKITE_` variables, and instead
Expand Down
5 changes: 4 additions & 1 deletion .buildkite/release-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ env:

steps:
- label: ":hammer_and_wrench: Release Build (App Store Connect)"
command: .buildkite/commands/release-build.sh ${BUILDKITE_BETA_RELEASE}
command: |
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
.buildkite/commands/release-build.sh ${IS_BETA_RELEASE}
priority: 1
plugins: [$CI_TOOLKIT]
notify:
Expand Down
1 change: 0 additions & 1 deletion .buildkite/release-pipelines/complete-code-freeze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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"
echo '--- :ruby: Setup Ruby Tools'
Expand Down
1 change: 0 additions & 1 deletion .buildkite/release-pipelines/finalize-hotfix-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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"
echo '--- :ruby: Setup Ruby Tools'
Expand Down
1 change: 0 additions & 1 deletion .buildkite/release-pipelines/finalize-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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"
echo '--- :ruby: Setup Ruby Tools'
Expand Down
1 change: 0 additions & 1 deletion .buildkite/release-pipelines/new-beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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"
echo '--- :ruby: Setup Ruby Tools'
Expand Down
1 change: 0 additions & 1 deletion .buildkite/release-pipelines/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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"
echo '--- :ruby: Setup Ruby Tools'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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"
echo '--- :ruby: Setup Ruby Tools'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: ☢️ Trigger Danger On Buildkite

on:
pull_request:
types: [labeled, unlabeled, milestoned, demilestoned]
types: [labeled, unlabeled, milestoned, demilestoned, ready_for_review, edited]

jobs:
dangermattic:
if: ${{ (github.event.pull_request.draft == false) }}
uses: Automattic/dangermattic/.github/workflows/reusable-retry-buildkite-step-on-events.yml@v1.1.0
uses: Automattic/dangermattic/.github/workflows/reusable-retry-buildkite-step-on-events.yml@1.2.0
with:
org-slug: "automattic"
pipeline-slug: "woocommerce-ios"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gem 'fastlane-plugin-sentry', '~> 1.0'
# This comment avoids typing to switch to a development version for testing.
#
# gem 'fastlane-plugin-wpmreleasetoolkit', git: '[email protected]:wordpress-mobile/release-toolkit', branch: ''
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 12.0'
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 12.3'
gem 'rake', '~> 12.3'
gem 'rubocop', '~> 1.65'
gem 'rubocop-rake', '~> 0.6'
Expand Down
46 changes: 26 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ GEM
base64
nkf
rexml
activesupport (7.2.1)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
Expand All @@ -25,23 +26,24 @@ GEM
ast (2.4.2)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.988.0)
aws-sdk-core (3.209.1)
aws-partitions (1.999.0)
aws-sdk-core (3.211.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.94.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-kms (1.95.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.167.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-s3 (1.169.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.0)
aws-sigv4 (1.10.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
benchmark (0.3.0)
bigdecimal (3.1.8)
buildkit (1.6.1)
sawyer (>= 0.6)
Expand All @@ -51,10 +53,10 @@ GEM
cork
nap
open4 (~> 1.3)
cocoapods (1.15.2)
cocoapods (1.16.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.15.2)
cocoapods-core (= 1.16.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -68,11 +70,11 @@ GEM
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
xcodeproj (>= 1.26.0, < 2.0)
cocoapods-catalyst-support (0.2.1)
cocoapods (~> 1.9)
colored2 (~> 3.1)
cocoapods-core (1.15.2)
cocoapods-core (1.16.1)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand Down Expand Up @@ -124,7 +126,7 @@ GEM
danger
rubocop (~> 1.0)
declarative (0.0.20)
diffy (3.4.2)
diffy (3.4.3)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.6.20240107)
Expand Down Expand Up @@ -166,7 +168,7 @@ GEM
faraday_middleware (1.2.1)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.224.0)
fastlane (2.225.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -182,6 +184,7 @@ GEM
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0)
fastlane-sirp (>= 1.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.3)
google-apis-playcustomapp_v1 (~> 0.1)
Expand Down Expand Up @@ -210,7 +213,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.0)
fastlane-plugin-wpmreleasetoolkit (12.3.0)
activesupport (>= 6.1.7.1)
buildkit (~> 1.5)
chroma (= 0.2.0)
Expand All @@ -227,6 +230,8 @@ GEM
rake (>= 12.3, < 14.0)
rake-compiler (~> 1.0)
xcodeproj (~> 1.22)
fastlane-sirp (1.0.0)
sysrandom (~> 1.0)
ffi (1.17.0)
ffi (1.17.0-x86_64-darwin)
fourflusher (2.3.1)
Expand Down Expand Up @@ -295,7 +300,7 @@ GEM
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.4.1)
nanaimo (0.3.0)
nanaimo (0.4.0)
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
Expand Down Expand Up @@ -368,6 +373,7 @@ GEM
simctl (1.6.10)
CFPropertyList
naturally
sysrandom (1.0.5)
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand All @@ -386,12 +392,12 @@ GEM
xcode-install (2.8.1)
claide (>= 0.9.1)
fastlane (>= 2.1.0, < 3.0.0)
xcodeproj (1.25.1)
xcodeproj (1.26.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
nanaimo (~> 0.4.0)
rexml (>= 3.3.6, < 4.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
Expand All @@ -412,7 +418,7 @@ DEPENDENCIES
fastlane (~> 2.217)
fastlane-plugin-appcenter (~> 2.0)
fastlane-plugin-sentry (~> 1.0)
fastlane-plugin-wpmreleasetoolkit (~> 12.0)
fastlane-plugin-wpmreleasetoolkit (~> 12.3)
rake (~> 12.3)
rmagick (~> 4.1)
rubocop (~> 1.65)
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: a6a6f05f8cb06ff4e707e8ed623df352e7d47ff5

COCOAPODS: 1.15.2
COCOAPODS: 1.16.1
31 changes: 22 additions & 9 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DERIVED_DATA_DIR = File.join(FASTLANE_DIR, 'DerivedData')
SCREENSHOTS_DIR = File.join(FASTLANE_DIR, 'screenshots')
FASTLANE_METADATA_FOLDER = File.join(FASTLANE_DIR, 'metadata')
WORKSPACE_PATH = File.join(PROJECT_ROOT_FOLDER, 'WooCommerce.xcworkspace')
BUILDKITE_RELEASE_PIPELINE = 'release-builds.yml'
IOS_LOCALES = %w[ar de-DE en-US es-ES fr-FR he id it ja ko nl-NL pt-BR ru sv tr zh-Hans zh-Hant].freeze
SIMULATOR_VERSION = '15.5' # For screenshots
SCREENSHOTS_SCHEME = 'WooCommerceScreenshots'
Expand Down Expand Up @@ -1324,16 +1325,28 @@ end
# Kicks off a Buildkite build
# -----------------------------------------------------------------------------------
def trigger_buildkite_release_build(branch:, beta:)
build_url = buildkite_trigger_build(
buildkite_organization: 'automattic',
buildkite_pipeline: 'woocommerce-ios',
branch: branch,
environment: { BUILDKITE_BETA_RELEASE: beta },
pipeline_file: 'release-builds.yml'
)
environment = {
IS_BETA_RELEASE: beta,
RELEASE_VERSION: release_version_current
}

# 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: 'automattic',
buildkite_pipeline: 'woocommerce-ios',
branch: branch,
pipeline_file: BUILDKITE_RELEASE_PIPELINE,
environment: environment
)

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 inject_buildkite_analytics_environment(xctestrun_path:)
Expand Down

0 comments on commit a2dd518

Please sign in to comment.