From 7ca8f48864768bb876910bfd7d7bc3b6d93b9f2c Mon Sep 17 00:00:00 2001 From: Ian Guedes Maia Date: Tue, 12 Nov 2024 18:48:20 +0100 Subject: [PATCH] [Tooling] Use `buildkite_pipeline_upload` action to inline Buildkite 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 7863f25931d5182ec67ebbb94a7aaff890b581e3. --- .../commands/checkout-release-branch.sh | 2 ++ .buildkite/commands/complete-code-freeze.sh | 1 - .buildkite/commands/finalize-hotfix.sh | 1 - .buildkite/commands/finalize-release.sh | 1 - .buildkite/commands/log-outdated-pods.sh | 1 - .buildkite/release-builds.yml | 8 +++-- .../complete-code-freeze.yml | 4 +-- .../release-pipelines/finalize-release.yml | 2 +- .../release-pipelines/publish-release.yml | 3 +- Gemfile | 6 ++-- Gemfile.lock | 34 ++++++++++--------- fastlane/Fastfile | 1 + fastlane/lanes/release.rb | 32 +++++++++++------ 13 files changed, 55 insertions(+), 41 deletions(-) diff --git a/.buildkite/commands/checkout-release-branch.sh b/.buildkite/commands/checkout-release-branch.sh index 394e18560bb9..f06ad3d85c69 100755 --- a/.buildkite/commands/checkout-release-branch.sh +++ b/.buildkite/commands/checkout-release-branch.sh @@ -1,5 +1,7 @@ #!/bin/bash -eu +echo '--- :git: Checkout release branch' + RELEASE_NUMBER=$1 if [[ -z "${RELEASE_NUMBER}" ]]; then diff --git a/.buildkite/commands/complete-code-freeze.sh b/.buildkite/commands/complete-code-freeze.sh index 4c567841922e..40653d10c534 100755 --- a/.buildkite/commands/complete-code-freeze.sh +++ b/.buildkite/commands/complete-code-freeze.sh @@ -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' diff --git a/.buildkite/commands/finalize-hotfix.sh b/.buildkite/commands/finalize-hotfix.sh index 52e32e0e2209..cb3be53d1d66 100755 --- a/.buildkite/commands/finalize-hotfix.sh +++ b/.buildkite/commands/finalize-hotfix.sh @@ -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' diff --git a/.buildkite/commands/finalize-release.sh b/.buildkite/commands/finalize-release.sh index 012e03c398d3..bbba37e01b8d 100755 --- a/.buildkite/commands/finalize-release.sh +++ b/.buildkite/commands/finalize-release.sh @@ -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' diff --git a/.buildkite/commands/log-outdated-pods.sh b/.buildkite/commands/log-outdated-pods.sh index 1770271037f7..5bef2f1972ee 100755 --- a/.buildkite/commands/log-outdated-pods.sh +++ b/.buildkite/commands/log-outdated-pods.sh @@ -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' diff --git a/.buildkite/release-builds.yml b/.buildkite/release-builds.yml index b6d0d255cc02..1839174c967f 100644 --- a/.buildkite/release-builds.yml +++ b/.buildkite/release-builds.yml @@ -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" @@ -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" diff --git a/.buildkite/release-pipelines/complete-code-freeze.yml b/.buildkite/release-pipelines/complete-code-freeze.yml index b788898d5f2d..aad2868d3f46 100644 --- a/.buildkite/release-pipelines/complete-code-freeze.yml +++ b/.buildkite/release-pipelines/complete-code-freeze.yml @@ -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 @@ -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 diff --git a/.buildkite/release-pipelines/finalize-release.yml b/.buildkite/release-pipelines/finalize-release.yml index f964cdddd20c..fbe6f86b0df5 100644 --- a/.buildkite/release-pipelines/finalize-release.yml +++ b/.buildkite/release-pipelines/finalize-release.yml @@ -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 diff --git a/.buildkite/release-pipelines/publish-release.yml b/.buildkite/release-pipelines/publish-release.yml index dd0d9aef1c45..1e96cb3b1bd6 100644 --- a/.buildkite/release-pipelines/publish-release.yml +++ b/.buildkite/release-pipelines/publish-release.yml @@ -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 diff --git a/Gemfile b/Gemfile index 25988375d673..73f660dce2ae 100644 --- a/Gemfile +++ b/Gemfile @@ -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 # @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index ed2b8f4428ca..12259bbf6133 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,8 +26,8 @@ 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) @@ -35,7 +35,7 @@ GEM 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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b6b9941c845c..b143e06e48fb 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -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) diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index 37bebcf82c73..335b0b936df0 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -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