Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tooling] Introduce pipelines to trigger release tasks on CI #3514

Merged
merged 12 commits into from
Jan 31, 2025

Conversation

AliSoftware
Copy link
Contributor

@AliSoftware AliSoftware commented Jan 29, 2025

Description

As part of this Project Thread: paaHJt-78B-p2, this introduces .buildkite/release-pipelines/*.yml files that will take care of calling fastlane code_freeze and similar lanes called during the release process.

Those lanes are currently called by the Release Manager on their own Mac, so the point of introducing those pipelines is to be able to instead switch to make those kicker lanes be run on CI instead.

Created pipelines

List of .buildkite/release-pipelines/*.yml files calling their associated fastlane lane during ReleaseV2 scenario:

  • code_freeze
  • update_rollouts
  • new_beta_release
  • finalize_release
  • publish_release
  • new_hotfix_release
  • finalize_hotfix_release

Scenario steps update in ReleasesV2

Once this lands, we will be able to also land the companion PR in wpcom to update the Release Scenario in MC (internal ref: 171698-ghe-Automattic/wpcom) to replace the currently-manual tasks like "Call bundle exec fastlane code_freeze" and the likes with automated tasks instead—i.e. tasks that will present a clickable button on ReleasesV2 which, when clicked, will trigger those lanes on CI—thus not requiring Release Managers to run those from their personal Macs anymore.

Testing Instructions

Otherwise I think the only way to test this is during the next release process that will adopt those changes (likely during 7.82)

@AliSoftware AliSoftware self-assigned this Jan 29, 2025
@AliSoftware AliSoftware added [Type] Tooling Related to the Gradle build scripts and the setup or maintenance of the project build process. [Area] Tooling labels Jan 29, 2025
@AliSoftware AliSoftware added this to the 7.82 milestone Jan 29, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 29, 2025

📲 You can test the changes from this Pull Request in 📱 Mobile by scanning the QR code below to install the corresponding build.
App Name 📱 Mobile
Build TypedebugProd
Commitee4f481
Direct Downloadpocketcasts-app-prototype-build-pr3514-ee4f481.apk
📲 You can test the changes from this Pull Request in 🚗 Automotive by scanning the QR code below to install the corresponding build.
App Name 🚗 Automotive
Build TypedebugProd
Commitee4f481
Direct Downloadpocketcasts-automotive-prototype-build-pr3514-ee4f481.apk
📲 You can test the changes from this Pull Request in ⌚ Wear by scanning the QR code below to install the corresponding build.
App Name ⌚ Wear
Build TypedebugProd
Commitee4f481
Direct Downloadpocketcasts-wear-prototype-build-pr3514-ee4f481.apk

@AliSoftware AliSoftware marked this pull request as ready for review January 30, 2025 19:46
@AliSoftware AliSoftware requested a review from a team as a code owner January 30, 2025 19:46
@AliSoftware AliSoftware requested review from mebarbosa and a team and removed request for a team January 30, 2025 19:46
@@ -362,9 +361,7 @@ platform :android do
version = release_version_current

# Wrap up
remove_branch_protection(repository: GITHUB_REPO, branch: "release/#{version}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already done later during publish_release, which is a better moment to remove the release branch protection anyway (see https://github.com/Automattic/apps-infra-plans/issues/83)

Copy link
Contributor

@mokagio mokagio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good as far as I can see.

A similar feeling to what you wrote in regards to testing this:

I think the only way to test this is during the next release process that will adopt those changes (likely during 7.82)

However, I'll say that the more of these we implement, the more confident I become because I can see the code being ported from one already real-world-tested implementation to a new one.

.buildkite/commands/release-build.sh Show resolved Hide resolved
Comment on lines +9 to +16
echo '--- 🤖 Use bot for Git operations'
source use-bot-for-git

echo '--- :ruby: Setup Ruby Tools'
install_gems

echo '--- 🔐 Access Secrets'
bundle exec fastlane run configure_apply
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is something we've ever done in the release pipelines, but how do you feel about extracting these common steps in a script to source?

Could be a followup / mini-project to log and pick up once someone has time to implement consistently. Just thought I'd toss the idea there for DRYing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, as I copy/pasted the release-pipelines/code-freeze.yml multiple times to create the other release-pipelines/ and seeing how similar they all were I thought about it too; a good idea to implement cross-repo in a subsequent iteration indeed!

Comment on lines +413 to +437
pipeline_args = {
pipeline_file: 'release-builds.yml',
environment: {
RELEASE_VERSION: release_version_current
}
}
if is_ci?
buildkite_pipeline_upload(**pipeline_args)
else
buildkite_trigger_build(
buildkite_organization: 'automattic',
buildkite_pipeline: 'pocket-casts-android',
branch: branch_to_build,
**pipeline_args
)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice DRYing

@mokagio
Copy link
Contributor

mokagio commented Jan 31, 2025

Side note: Glad you used consistent naming with - in the new pipeline files even though they don't match the lanes they call 1:1.

I feel like the confusing of seeing some files with dashes and some with underscores would be bigger than the feeling of inconsistency with the file being called lane-name.yml and the lane being lane_name.

AliSoftware and others added 11 commits January 31, 2025 12:16
Otherwise we get a crash trying to load the `release-toolkit`—which depends on `nokogiri`—on certain agents like `tumblr-metal` because the version of `libc.so` (`GLIBC_2.28`) required by the pre-build `nokogiri.so` lib is not found on those agents (due to an older Linux OS, iinm)
Newly detected since the update of the `rubocop` gem to a more recent version
Especially since this fastlane built-in action relies on CI env vars to check the branch instead of checking the actual git branch being checked out at the time it's called, leading to it checking the `BUILDKITE_BRANCH` value (the branch on which the pipeline was started from) even if we since called `Fastlane::Helper::GitHelper.checkout_and_pull(DEFAULT_BRANCH)` right before that to switch to a different branch…
That lane does not have a `skip_confirm:` param
 - We don't need to create the next milestone via Fastfile anymore since GitHub milestones creation is now handled by ReleasesV2
 - We don't want to remove the branch protection of the `release/*` branch as soon as `finalize_release` but instead only during `publish_release` (where that action was also called already)
Co-authored-by: Gio Lodi <gio@mokacoding.com>
@AliSoftware AliSoftware force-pushed the tooling/release-on-ci branch from 4439e93 to c3b2138 Compare January 31, 2025 11:17
For safety and reducing risk of injection
@AliSoftware AliSoftware enabled auto-merge (squash) January 31, 2025 12:11
@AliSoftware AliSoftware merged commit e00218f into main Jan 31, 2025
15 of 16 checks passed
@AliSoftware AliSoftware deleted the tooling/release-on-ci branch January 31, 2025 12:21
Jorge-Martin777

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Area] Tooling [Type] Tooling Related to the Gradle build scripts and the setup or maintenance of the project build process.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants