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

[Build] Migrate Build Scan to Develocity APIs #21234

Merged
merged 3 commits into from
Sep 17, 2024

Conversation

ParaskP7
Copy link
Contributor

Relates To: #21164

Description:

In our previous attempt to upgrade com.gradle.enterprise from 3.15 to 3.18 we had to also upgrade to the plugin id to com.gradle.develocity (#21164). Although testing CI didn't show anything fishy about this migration, and build scans continue to work as expected, when running any task locally it now started to asking for a build scan license agreement:

Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Use defined at https://gradle.com/help/legal-terms-of-use. Do you accept these terms? [yes, no]

After researching quickly on the matter, it seems that Develocity is now publishing every build by default (see Publishing every build). Previously, we only accepted the build scan agreement on CI and ignored any local configuration, it defaulting to NOT publishing on every build.

FYI: Also, as part of this change, the buildScan APIs were migrated to the new develocity ones, which are being accessible from the including develocity { ... } block, and then, the whole script got applied on the settings.gradle level, just like it is already done for buildCache.


Additionally, you would notice the below (related) warning:

WARNING: The following functionality has been deprecated and will be removed in the next major release 
of the Develocity Gradle plugin. Run with '-Ddevelocity.deprecation.captureOrigin=true' to see where the 
deprecated functionality is being used. For assistance with migration, see https://gradle.com/help/
gradle-plugin-develocity-migration.
- The deprecated "gradleEnterprise.buildScan.buildScanPublished" API has been replaced by 
"develocity.buildScan.buildScanPublished"

After running with the -Ddevelocity.deprecation.captureOrigin=true parameter further information reveals that this is related to the com.automattic.android.measure-builds, so maybe, it is worth updating this plugin to Develocity at some point as well:

WARNING: The following functionality ... replaced by "develocity.buildScan.buildScanPublished"
  Origin:
    com.automattic.android.measure.BuildTimePlugin.prepareBuildScanListener(BuildTimePlugin.kt:83)
    com.automattic.android.measure.BuildTimePlugin.apply(BuildTimePlugin.kt:60)
    com.automattic.android.measure.BuildTimePlugin.apply(BuildTimePlugin.kt:24)

To Test:

  1. Local:
    • Run ./gradlew assembleJetpackJalapenoDebug and make sure that the build is not blocked by the license agreement at the end.
    • Run ./gradlew assembleJetpackJalapenoDebug --scan and make sure that issuing a build scan on demand still works as expected.
  2. CI:
    • Look at the Prototype Build job, any of the two, or any job for that matter, and make sure that at the end of that job a build scan is being publishing as expected.

Regression Notes: N/A


PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones): N/A

For more info see:
- Connecting to scans.gradle.com: https://docs.gradle.com/develocity/
gradle-plugin/current/#connecting_to_scans_gradle_com
- Using Build Scans: https://docs.gradle.com/develocity/
gradle-plugin/current/#using_build_scans
For more info see:
- Publishing every build: https://docs.gradle.com/develocity/
gradle-plugin/current/#controlling_when_build_scans_are_published
Previously, it wasn't possible to apply this 'gradle_build_scan.gradle'
file from the 'settings.gradle' file, but now, after the Develocity
migration, it seems that it is now perfectly possible, most probably
because of the added 'develocity { ... }' block.
@ParaskP7 ParaskP7 added this to the Future milestone Sep 17, 2024
@ParaskP7
Copy link
Contributor Author

👋 @nbradbury and just an FYI for you here; it seems that we actually missed all that work above and we had to do a minor migration on the buildScan side of things. 🤷

Copy link
Contributor

@wzieba wzieba left a comment

Choose a reason for hiding this comment

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

Looks great, thank you for the research, TIL! Good idea to adjust this as well in the measure-builds plugin.

Copy link

sonarcloud bot commented Sep 17, 2024

@ParaskP7
Copy link
Contributor Author

Btw @wzieba and after we review/merge this work, it is maybe worth it to update all other projects we maintain to Develocity too (WCAndroid, DOAndroid, PCAndroid, etc), just to avoid it being updated automatically and having to solve this problem retrospectively for every project. 🤔

@wpmobilebot
Copy link
Contributor

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
Versionpr21234-629342d
Commit629342d
Direct Downloadwordpress-prototype-build-pr21234-629342d.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

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
Versionpr21234-629342d
Commit629342d
Direct Downloadjetpack-prototype-build-pr21234-629342d.apk
Note: Google Login is not supported on these builds.

@nbradbury
Copy link
Contributor

@ParaskP7 Just a side note that we have this dependabot PR that has a minor update to the Develocity plugin. Would that be something to include here?

@ParaskP7
Copy link
Contributor Author

👋 @nbradbury , thanks and sure, but I recommend updating Develocity separately, no matter if it is a patch update, rebasing this :dependabot: #21224 you mentioned when we merge this, and use the same testing instructions to make sure that both locally and on CI, build scan is working as expected.

@ParaskP7 ParaskP7 merged commit 89ae9f9 into trunk Sep 17, 2024
22 of 24 checks passed
@ParaskP7 ParaskP7 deleted the build/migrate-build-scan-to-develocity-apis branch September 17, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants