Skip to content

[tool] Add a package-level pre-publish hook #7156

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

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

stuartmorgan-g
Copy link
Contributor

Adds the ability for a package to specify a script that should be run before publishing. To minimize the chance of such a script breaking things only in the post-submit release step, if the script is present it will also be run during publish-check.

These should be used with caution since they can cause the published artifacts to be different from that is checked in, but in the intended use case of extension builds this risk is far preferable to the risks associated with checking in binaries that were built on local, ad-hoc basis. (Longer term, we may need an alternate solution however, as generating artifacts in CI can have its own supply chain validation issues.)

Also does some minor refactoring to custom test script code to make it follow the same pattern as this new code.

Fixes flutter/flutter#150210

Pre-launch Checklist

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM

Code looks good to me, but I do have some thoughts on the use case. It looks like this is mainly being done to build binaries/artifacts before publishing. Could it be possible that building could be needed outside of publishing (as in for testing)? Should the script be called something like generate.dart instead so that other commands could potentially make use of it?

@stuartmorgan-g
Copy link
Contributor Author

Could it be possible that building could be needed outside of publishing (as in for testing)?

In general, I think special script entry points should be clearly named, and then if we have code we want to run from multiple entry points the best option is to factor that out into code that the different entry point files can call into.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2024
Copy link
Contributor

auto-submit bot commented Jul 25, 2024

auto label is removed for flutter/packages/7156, due to - The status or check suite Mac_arm64 ios_platform_tests_shard_3 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2024
Copy link
Contributor

auto-submit bot commented Jul 25, 2024

auto label is removed for flutter/packages/7156, due to - The status or check suite Mac_arm64 ios_platform_tests_shard_3 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2024
@auto-submit auto-submit bot merged commit 50238e7 into flutter:main Jul 25, 2024
76 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 26, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 26, 2024
flutter/packages@19daf6f...3d358d9

2024-07-26 reidbaker@google.com [many] Ignore NewerVersionAvailable in android lint  (flutter/packages#7218)
2024-07-25 rexios@rexios.dev [tool] Adds `--wasm` flag to the `drive-examples` command (flutter/packages#7162)
2024-07-25 stuartmorgan@google.com [tool] Add a package-level pre-publish hook (flutter/packages#7156)
2024-07-25 srawlins@google.com [flutter_migrate] Remove one set of parens that wrap a single String literal (flutter/packages#7216)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
flutter/packages@19daf6f...3d358d9

2024-07-26 reidbaker@google.com [many] Ignore NewerVersionAvailable in android lint  (flutter/packages#7218)
2024-07-25 rexios@rexios.dev [tool] Adds `--wasm` flag to the `drive-examples` command (flutter/packages#7162)
2024-07-25 stuartmorgan@google.com [tool] Add a package-level pre-publish hook (flutter/packages#7156)
2024-07-25 srawlins@google.com [flutter_migrate] Remove one set of parens that wrap a single String literal (flutter/packages#7216)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
flutter/packages@19daf6f...3d358d9

2024-07-26 reidbaker@google.com [many] Ignore NewerVersionAvailable in android lint  (flutter/packages#7218)
2024-07-25 rexios@rexios.dev [tool] Adds `--wasm` flag to the `drive-examples` command (flutter/packages#7162)
2024-07-25 stuartmorgan@google.com [tool] Add a package-level pre-publish hook (flutter/packages#7156)
2024-07-25 srawlins@google.com [flutter_migrate] Remove one set of parens that wrap a single String literal (flutter/packages#7216)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for pre-publish hooks for publishing first party Flutter packages
2 participants