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

Protect sdk upload script from missing ndk, add documentation for checking write access, improve comments to add context #47989

Conversation

reidbaker
Copy link
Contributor

@reidbaker reidbaker commented Nov 13, 2023

Script used to upload 34v7 with ndk 26.1.10909125
Added documentation for how to check for write access before running script.
Added documentation for why the ndk is in a non standard location.
Protected against silent ndk failure caused by a failure to download ndk on m1 macs #47609 (comment)
Clean up os override so that script does not dirty the environment variables in a shell where it is run.

See flutter/flutter#117973 for more detail on why a newer ndk is required.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

…cking write access, improve comments to add context
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard
Copy link

This pull request is not mergeable in its current state, likely because of a merge conflict. Pre-submit CI jobs were not triggered. Pushing a new commit to this branch that resolves the issue will result in pre-submit jobs being scheduled.

@reidbaker reidbaker requested review from gmackall and a team November 13, 2023 21:33
Comment on lines 132 to 133
echo "Failure to bundle ndk for platform"
exit 1
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't these lines be indented?

btw I wonder if running shellcheck would make sense in Flutter's repos.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, if you wanted to add shellcheck I am not opposed. I will say that we (the broader fluter team) have agreed to move from shell scripts like this to dart scripts. Thanks for the catch, this is fixed.

@stuartmorgan
Copy link
Contributor

test-exempt: The current structure of the script (a bash script that does both upload and download) makes it very difficult to test without a complete rewrite, and the team consensus is that the value of such a rewrite is currently too low for the benefits given that this is for an infrequent manual process that already has failsafes later in the process.

@@ -26,13 +27,13 @@ print_usage () {
echo "and should only be run on linux or macos hosts."
}

# Validate version is provided
# Validate version or argument is provided.
Copy link
Contributor

Choose a reason for hiding this comment

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

The following code would read better if you copied $1 into a named variable:

VERSION_TAG=$1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Named first argument since sometimes that is a version and sometimes it is an argument (which is confusing) but at least the variable hints at the truth.

@@ -54,6 +55,8 @@ if [[ ! -d "$sdk_path" ]]; then
print_usage
exit 1
fi

# Validate caller has cipd.
Copy link
Contributor

Choose a reason for hiding this comment

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

What about changing the comment to:

Validate environment has cipd installed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I like that more.

@@ -15,6 +15,7 @@ print_usage () {
echo ""
echo "This script downloads the packages specified in packages.txt and uploads"
echo "them to CIPD for linux, mac, and windows."
echo "To confirm you have write permissions run 'cipd acl-check flutter/android/sdk/all/ -writer'."
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be done as part of this script?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can but honestly given we dont have a dry run. One of the only(and easy) ways to verify what is about to be uploaded is to comment out the rm -rf $upload_dir and the upload command and see what is about to be uploaded. Adding that check would add another piece of code to comment out. I added this documentation so that when I come back to do flutter/flutter#138021 I know what is required to warn on missing permissions. But in a dry run we would continue anyway since the user is not trying to upload.

@reidbaker reidbaker added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 20, 2023
@auto-submit auto-submit bot merged commit 337ab58 into flutter:main Nov 20, 2023
28 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 20, 2023
…on for checking write access, improve comments to add context (flutter/engine#47989)
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 20, 2023
…138751)

flutter/engine@2158531...337ab58

2023-11-20 reidbaker@google.com Protect sdk upload script from missing ndk, add documentation for checking write access, improve comments to add context (flutter/engine#47989)
2023-11-20 skia-flutter-autoroll@skia.org Roll Dart SDK from 09bd5d71062d to ee7aaca9adcc (1 revision) (flutter/engine#48237)
2023-11-20 skia-flutter-autoroll@skia.org Roll Skia from 151d297efcf5 to 69213ba6f68a (2 revisions) (flutter/engine#48236)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jonahwilliams@google.com,rmistry@google.com,zra@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
@reidbaker reidbaker deleted the i117973-protect-android-sdk-upload-from-ndk-failure branch November 21, 2023 15:46
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.

4 participants