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] Use a trusted CI agent for pipelines that require push access #21028

Merged
merged 8 commits into from
Jul 4, 2024

Conversation

iangmaia
Copy link
Contributor

@iangmaia iangmaia commented Jul 2, 2024

Description

This PR uses the trusted agent helper script use-bot-for-git to use the GitHub bot for performing git push operations on CI.

Testing Steps

Since there's currently no active release in progress, I've already created a read-only deploy key and used it in our setup.

This PR will be fully tested during the next release cycle of the project, when the affected pipelines should be able to finish successfully.

Follow-up

Once this PR is merged, I will revoke the now unused deploy key.

@iangmaia iangmaia added this to the 25.3 milestone Jul 2, 2024
@iangmaia iangmaia self-assigned this Jul 2, 2024
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jul 2, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21028-59a7598
Commit59a7598
Direct Downloadwordpress-prototype-build-pr21028-59a7598.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jul 2, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21028-59a7598
Commit59a7598
Direct Downloadjetpack-prototype-build-pr21028-59a7598.apk
Note: Google Login is not supported on these builds.

@iangmaia iangmaia force-pushed the iangmaia/trusted-agent-for-push-access branch from cf1c232 to 2597b0d Compare July 2, 2024 23:00
@iangmaia iangmaia marked this pull request as ready for review July 2, 2024 23:18
@iangmaia iangmaia requested review from a team July 2, 2024 23:20
@@ -20,7 +14,7 @@ steps:
- label: "Gradle Wrapper Validation"
command: |
validate_gradle_wrapper
plugins: *common_plugins
plugins: [$CI_TOOLKIT]
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice tidy up.

Have you considered:

Suggested change
plugins: [$CI_TOOLKIT]
plugins: $CI_TOOLKIT

I never tried it but I assume the Buildkite parser would be smart enough to allow a scalar value here and convert it to a sequence internally.

However, maybe we're better off leaving the [ ] so the diff when adding a new plugin will be smaller 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

While I think that Buildkite would allow a single value in an attribute expecting an array (and would wrap it in an array automatically for us) and thus allow such a syntax… personally I prefer to be explicit in it being an array and thus keep the […] syntax.

.buildkite/commands/checkout-release-branch.sh

install_gems

bundle exec fastlane complete_code_freeze skip_confirm:true
agents:
queue: "tumblr-metal"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this has been discussed elsewhere, in which case apologies for the redundancy, but it would be nice for this to eventually be an agent that doesn't have Tumblr in the name 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, whenever I type tumblr-metal I think the same. This is inside Tumblr's DCA, and that's the reason.
But given it is being used for all sorts of things non-Tumblr related, we could name the queue a bit differently.

git remote set-url origin git@github.com:wordpress-mobile/WordPress-Android.git
echo '--- :robot_face: Use bot for git operations'
# shellcheck disable=SC1091
source use-bot-for-git
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you considered removing the script and inlining the source use-bot-for-git call in the pipeline command node / script called by the command node?

As far as I can see, the only additional operation in this script is the echo which we could either move in the command too, or add in the use-bot-for-git implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion -- this script previously did more but it makes sense to inline the operations now -- and tbh, I think it's a lot better with less indirections.
Updated on db4b88f (plus added logging on 59a7598)

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.

I confess I haven't followed the development of the trusted agent as closely as I should have, but as far as changing the agents and updating the script, everything looks good to me here 👍


steps:
- label: "Code Freeze"
plugins: [$CI_TOOLKIT]
command: |
.buildkite/commands/configure-git-for-release-management.sh
source .buildkite/commands/configure-git-for-release-management.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @mokagio that we might as well remove configure-git-for-release-management.sh at that point and call source use-bot-for-git directly from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated on db4b88f (plus added logging on 59a7598)

@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 25.3. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

Copy link

sonarcloud bot commented Jul 4, 2024

@iangmaia iangmaia merged commit 4f5ea84 into trunk Jul 4, 2024
20 checks passed
@iangmaia iangmaia deleted the iangmaia/trusted-agent-for-push-access branch July 4, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants