diff --git a/.buildkite/beta-builds.yml b/.buildkite/beta-builds.yml index 434463858bc6..b9e5d5019bcc 100644 --- a/.buildkite/beta-builds.yml +++ b/.buildkite/beta-builds.yml @@ -13,6 +13,7 @@ steps: ################# - label: "Gradle Wrapper Validation" command: | + .buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION" validate_gradle_wrapper plugins: [$CI_TOOLKIT] @@ -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*.*" @@ -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: @@ -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: @@ -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] diff --git a/.buildkite/commands/checkout-editorial-branch.sh b/.buildkite/commands/checkout-editorial-branch.sh index f495193ae32f..6cae072807ea 100755 --- a/.buildkite/commands/checkout-editorial-branch.sh +++ b/.buildkite/commands/checkout-editorial-branch.sh @@ -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 diff --git a/.buildkite/commands/checkout-release-branch.sh b/.buildkite/commands/checkout-release-branch.sh index 7b6881194cf7..fe570fa93ad6 100755 --- a/.buildkite/commands/checkout-release-branch.sh +++ b/.buildkite/commands/checkout-release-branch.sh @@ -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. diff --git a/.buildkite/complete-code-freeze.yml b/.buildkite/complete-code-freeze.yml index aea9b8822055..e2810cd52cf4 100644 --- a/.buildkite/complete-code-freeze.yml +++ b/.buildkite/complete-code-freeze.yml @@ -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 diff --git a/.buildkite/finalize-release.yml b/.buildkite/finalize-release.yml index 4253bd97c27f..c38a21e774c8 100644 --- a/.buildkite/finalize-release.yml +++ b/.buildkite/finalize-release.yml @@ -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 diff --git a/.buildkite/publish-release.yml b/.buildkite/publish-release.yml index 72b96d7ff4a1..9bacf47c4bc9 100644 --- a/.buildkite/publish-release.yml +++ b/.buildkite/publish-release.yml @@ -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 diff --git a/.buildkite/release-builds.yml b/.buildkite/release-builds.yml index abefd4942a40..1bfe1e5e9371 100644 --- a/.buildkite/release-builds.yml +++ b/.buildkite/release-builds.yml @@ -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] @@ -28,7 +29,9 @@ 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: @@ -36,7 +39,9 @@ steps: - 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: @@ -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] @@ -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] @@ -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] diff --git a/.buildkite/update-release-notes.yml b/.buildkite/update-release-notes.yml index bc781f42589b..5443723ab506 100644 --- a/.buildkite/update-release-notes.yml +++ b/.buildkite/update-release-notes.yml @@ -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' diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index 0605bbd0417c..42c70f25737f 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -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 #{branch}:
- #{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)