Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Important changes to data models, configuration, and migrations between each
AppEngine version, listed here to ease deployment and troubleshooting.

## Next Release (replace with git tag when deployed)
* Note: `setup-flutter.sh` uses http archives for stable/beta channel.

## `20240627t084200-all`
* Bumped runtimeVersion to `2024.06.25`.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM gcr.io/google-containers/debian-base-amd64:v2.0.0

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y unzip ca-certificates curl bash git && \
apt-get install -y unzip ca-certificates curl bash git xz-utils && \
rm -rf /var/lib/apt/lists/*

ENV PUB_ENVIRONMENT="bot.pub_dev.pub_worker"
Expand Down
9 changes: 9 additions & 0 deletions pkg/pub_worker/lib/src/bin/pana_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>
sdkKind: 'dart',
configKind: bundle.configKind,
version: bundle.dart,
channel: bundle.channel,
);
final flutterSdkPath = await _installSdk(
sdkKind: 'flutter',
configKind: bundle.configKind,
version: bundle.flutter,
channel: bundle.channel,
);

return (
Expand All @@ -280,6 +282,7 @@ Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>

Future<String?> _installSdk({
required String sdkKind,
required String channel,
required String configKind,
required String version,
}) async {
Expand All @@ -300,6 +303,7 @@ Future<String?> _installSdk({
'tool/setup-$sdkKind.sh',
sdkPath,
version,
channel,
],
workingDirectory: '/home/worker/pub-dev',
environment: {
Expand All @@ -322,11 +326,13 @@ Future<String?> _installSdk({
}

class _SdkBundle {
final String channel;
final String configKind;
final String dart;
final String flutter;

_SdkBundle({
required this.channel,
required this.configKind,
required this.dart,
required this.flutter,
Expand All @@ -352,17 +358,20 @@ Future<List<_SdkBundle>> _detectSdkBundles() async {
if (latestStableDartSdkVersion != null &&
latestStableFlutterSdkVersion != null)
_SdkBundle(
channel: 'stable',
configKind: 'latest-stable',
dart: latestStableDartSdkVersion,
flutter: latestStableFlutterSdkVersion,
),
if (latestBetaDartSdkVersion != null && latestBetaFlutterSdkVersion != null)
_SdkBundle(
channel: 'beta',
configKind: 'latest-beta',
dart: latestBetaDartSdkVersion,
flutter: latestBetaFlutterSdkVersion,
),
_SdkBundle(
channel: 'master',
configKind: 'master',
dart: 'master',
flutter: 'master',
Expand Down
3 changes: 2 additions & 1 deletion pkg/pub_worker/test/dockerized_end2end_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ void main() {
final result = await server.waitForResult(package, version);

final docIndex = result.index.lookup('doc/index.html');
expect(docIndex, isNotNull);
expect(docIndex, isNotNull,
reason: '$package must have documentation');

final panaSummaryBytes = result.lookup('summary.json');
expect(panaSummaryBytes, isNotNull);
Expand Down
31 changes: 28 additions & 3 deletions tool/setup-flutter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,34 @@ then
fi

# Download and extract Flutter SDK into the target directory.
git clone -b "$2" --single-branch https://github.com/flutter/flutter.git "$1"
if [[ "$2" == "master" ]]
then
git clone -b "$2" --single-branch https://github.com/flutter/flutter.git "$1"
else
CHANNEL=${3:-stable}

# Create a temporary directory to extract the archive to.
WORK_DIR=`mktemp -d`
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
echo "Could not create temporary directory."
exit 1
fi

# Download and extract Flutter SDK
cd "$WORK_DIR"
curl -sS "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_$2-${CHANNEL}.tar.xz" >flutter.tar.xz
Copy link
Member

Choose a reason for hiding this comment

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

nit: should we consider using -o and some retry options?

Copy link
Member

Choose a reason for hiding this comment

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

probably better done in a separate PR :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

+1 on different PR, but what kind of options would you like to see here?

tar xf flutter.tar.xz
rm flutter.tar.xz

# Move from temp to destination.
DEST_PARENT=`dirname "$1"`
mkdir -p "$DEST_PARENT"
mv "$WORK_DIR/flutter" "$1"
fi

# Downloads the Dart SDK and disables analytics tracking – which we always want.
# This will add 400 MB.
# When using `git clone` above, the first command downloads the Dart SDK (adds ~400MB),
# which should be already included in the tar archive. However, the tar archive requires
# to run `flutter doctor` to work properly.
cd "$1"
./bin/flutter --no-version-check config --no-analytics
./bin/flutter --no-version-check doctor