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

Add Buildkite #299

Merged
merged 19 commits into from
Oct 22, 2021
Merged

Add Buildkite #299

merged 19 commits into from
Oct 22, 2021

Conversation

jkmassel
Copy link
Contributor

@jkmassel jkmassel commented Sep 8, 2021

This PR adds Buildkite and does some housekeeping, including:

  • Adding rubocop in CI
  • Requiring that development gems be installed in the vendor directory
  • Adding git-lfs installation (IMHO we should deprecate LFS stuff in the future...)
  • Removes the test group from the Gemfile – if you're using that instead of the gemspec you are sort of by definition out to do development work on the toolkit, so you should have all the tooling present.

@jkmassel jkmassel added the enhancement New feature or request label Sep 8, 2021
@jkmassel jkmassel requested a review from a team September 8, 2021 03:46
@jkmassel jkmassel self-assigned this Sep 8, 2021
@jkmassel jkmassel added Releases Release related stuff and removed Releases Release related stuff labels Sep 8, 2021
@codecov-commenter
Copy link

Codecov Report

Merging #299 (9093ea7) into develop (07b3152) will decrease coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #299      +/-   ##
===========================================
- Coverage    51.64%   51.62%   -0.03%     
===========================================
  Files          108      108              
  Lines         4533     4533              
===========================================
- Hits          2341     2340       -1     
- Misses        2192     2193       +1     
Impacted Files Coverage Δ
...ctions/android/android_download_file_by_version.rb 47.82% <ø> (ø)
...olkit/actions/common/check_translation_progress.rb 84.09% <ø> (ø)
...mreleasetoolkit/helper/promo_screenshots_helper.rb 21.54% <0.00%> (-0.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07b3152...9093ea7. Read the comment docs.

Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

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

Looks good overall but I think we should also get rid of GitHub Actions and Danger in this PR to avoid the double rubocop reporting.

We might also want to get rid of the CircleCI config too on that PR, except if you planned to do that in a separate one as a secondary step?

CHANGELOG.md Outdated Show resolved Hide resolved
.buildkite/pipeline.yml Outdated Show resolved Hide resolved
Gemfile Outdated Show resolved Hide resolved
.buildkite/pipeline.yml Show resolved Hide resolved
jkmassel and others added 7 commits September 8, 2021 12:42
Co-authored-by: Olivier Halligon <olivier.halligon@automattic.com>
Co-authored-by: Olivier Halligon <olivier.halligon@automattic.com>
Co-authored-by: Olivier Halligon <olivier.halligon@automattic.com>
mokagio
mokagio previously approved these changes Sep 9, 2021
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.

:shipit:

Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

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

The gem-push job from CircleCI is missing from the .buildkite/pipeline.yml, we need to add it before being ready to remove CircleCI.

@AliSoftware
Copy link
Contributor

AliSoftware commented Oct 20, 2021

Note that I noticed while doing the 2.0.0 that even today the gem-push job from CircleCI fails because it doesn't install the packages from the .brewfile like it does for the test job.

Not sure why we set skip_brew_install: true on the gem-push job (maybe because we expected the test job to run beforehand and install it for us? But it doesn't run on tags…) but when we'll port this to BuildKite in this PR we need to ensure the brew install step is done during gem push too.

@AliSoftware AliSoftware requested a review from mokagio October 20, 2021 14:56
@AliSoftware
Copy link
Contributor

AliSoftware commented Oct 20, 2021

PR update: gem-push step

@jkmassel @mokagio I've updated the PR to add the gem-push step to the Buildkite pipeline:

  • Added the gem-push step via these set of commits, with an if: build.tag != null condition
  • Added RUBYGEMS_API_KEY to the shared-secrets.json in mobile-secrets, and updated the CI/secrets/release-toolkit/env file to export it, then ran ./build to upload new secrets to S3. (I used the same API Key that we have been using on CircleCI and which is in our Secret Store – didn't create a new one)

You can check the changes I made to mobile-secrets by running git -C ~/.mobile-secrets show c20d2d5c6d0302e7d477284a628dd25572fc9174 on your Mac.

CircleCI Deploy Key re-added (and PR check failure)

I've incidentally re-added a public key for CircleCI during the release of 2.0.0 while trying to gem push the release 2.0.0 to RubyGems via the existing CircleCI job; which is why we have the ci/circleci: Build Error failure in this PR's checks. We'll need to re-delete that deploy key and remove the project from CircleCI once this Buildkite migration is merged to stop it from trying to run anymore.

Reviews

  • @jkmassel I can't add you as reviewer of this PR because you're also its author, but please review the changes I made for gem-push before we can consider merging it.
  • @mokagio I've dismissed your approval of this PR so that we don't accidentally merge it before someone re-reviews the new changes with new gem-push step.

@AliSoftware AliSoftware dismissed stale reviews from mokagio and themself October 20, 2021 14:58

New commit to add gem-push step was added since this review

@AliSoftware AliSoftware requested a review from a team October 20, 2021 14:59
@AliSoftware AliSoftware force-pushed the add/buildkite branch 2 times, most recently from 04edfde to 62de49c Compare October 20, 2021 17:29
As we apparently don't have the permissions to write in $HOME to use the default $HOME/.gem/credentials file
To test that credentials work, even if the push will fail because 2.0.0 is already published.
@AliSoftware
Copy link
Contributor

AliSoftware commented Oct 20, 2021

Testing the gem-push step

I tested the new gem-push step by temporarily disabling the if build.tag != null condition via 4f86bec to test the command (I expected it to fail on push saying that 2.0.0 already existed, but passing all the previous steps otherwise).

Had to do a lot of back and forth 😓 to test and make gem push be able to use authentication as expected 😓 .

  • First I tried to use the same method as what we used on CircleCI, i.e. writing the credentials in $HOME/.gem/credentials
  • But then it appeared that we don't have write access to $HOME in our Buildkite images.
  • Then I tried to use the GEM_HOST_API_KEY env var instead of the ~/.gem/credentials file, as suggested by the gem push help here, but apparently it wasn't picked up by CI (while it seemed to work on my Mac… may it depends on the version of rubygems?).
  • So after a lot of reading in the docs and finally looking at the rubygems source code on any alternatives to set the API keys (the official docs only mentioned ~/.gem/credentials as an acceptable file…) I finally found out that using --config-file would apparently not only allow to provide default flags for gem commands (original documented purpose, similar to what we can put into a gemrc file)… but also allows us to provide the API key via this file.

The last solution finally "succeeded" (well the step failed but on the error that "version 2.0.0 has already been published" which is the error I expected – as opposed to being blocked on an interactive prompt asking us for our credentials, or failing to authenticate with RubyGems), so I reverted the test commit via ac143b1 to only do the gem push on tags.

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.

This looks ready to ship. I only left nitpicks 👍

I assume you intent to keep the test and revert commit pair, as opposed interactive rebase and drop them, because there's no mention of removing them. Correct?

Part of me would like to get rid of them to keep the Git history neat, but I can see the value in having them here for the extra context. You did a great job at making it clear they are test commit, so I'm sure if someone landed on them (e.g. during a bisect) they'd understand the state of the codebase is intentionally "incorrect". 👌

The CircleCI failure is obviously due to this PR removing CircleCI 😄

image

.buildkite/gem-push.sh Outdated Show resolved Hide resolved
.buildkite/pipeline.yml Show resolved Hide resolved
.buildkite/pipeline.yml Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines -8 to +10
group :test do
gem 'codecov', require: false
gem 'rspec'
gem 'webmock', require: false, group: :test
gem 'yard'
end
gem 'codecov', require: false
gem 'webmock', require: false
gem 'yard'
Copy link
Contributor

Choose a reason for hiding this comment

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

This LGTM. Just curious, though, did you decide to remove the test group because:

  • Everyone running bundle install on this project is expected to run the tests; and
  • Consumer of the gem get the dependencies via what's specified in the .gemspec, so there's no need to add groups here because, if we don't add these to the .gemspec they won't be part of the gem dependency resolution chain

?

Copy link
Contributor

@AliSoftware AliSoftware Oct 22, 2021

Choose a reason for hiding this comment

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

Yep, exactly. As Jeremy said in the description of this PR:

Removes the test group from the Gemfile – if you're using that instead of the gemspec you are sort of by definition out to do development work on the toolkit, so you should have all the tooling present.

AliSoftware and others added 3 commits October 22, 2021 11:36
Co-authored-by: Gio Lodi <giovanni.lodi42@gmail.com>
Co-authored-by: Gio Lodi <giovanni.lodi42@gmail.com>
Co-authored-by: Gio Lodi <giovanni.lodi42@gmail.com>
@AliSoftware
Copy link
Contributor

I assume you intent to keep the test and revert commit pair, as opposed interactive rebase and drop them, because there's no mention of removing them. Correct?

Yep.

I'm not strong about this and I'm ok either case, and I thought about rebasing to eliminate those 2 commits too instead of keeping them. But as you say it also helps keep context – especially if someone comes back to this PR and the conversations in it even after the PR got merged – also because I do mention those commits' SHA1 in some of my comments, so removing them would make the comment outdated and odd to read in the future.

Overall even if I do like a clean and nice git graph and history, I don't think it's that a big deal to include those, both to keep context for this PR but also to show in the git history that we did test this scenario, and maybe show future us how we test similar stuff if we need more similar changes to be tested later.

@AliSoftware
Copy link
Contributor

The CircleCI failure is obviously due to this PR removing CircleCI 😄

I've just hit the "Stop Building" red button on the project settings in CircleCI which has removed the CircleCI Deploy Key from this repo's settings in GitHub, so CircleCI will no longer try to build this project (and fail).

@AliSoftware AliSoftware merged commit 4655900 into develop Oct 22, 2021
@AliSoftware AliSoftware deleted the add/buildkite branch October 22, 2021 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants