Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
a2a520cb
Unverified
Commit
a2a520cb
authored
Mar 30, 2021
by
Christopher Fujino
Committed by
GitHub
Mar 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only cache release manifest files for 60 seconds (#79325)
parent
b2b98a26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
prepare_package.dart
dev/bots/prepare_package.dart
+21
-4
prepare_package_test.dart
dev/bots/test/prepare_package_test.dart
+4
-4
No files found.
dev/bots/prepare_package.dart
View file @
a2a520cb
...
...
@@ -11,6 +11,7 @@ import 'package:args/args.dart';
import
'package:crypto/crypto.dart'
;
import
'package:crypto/src/digest_sink.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:meta/meta.dart'
show
required
;
import
'package:path/path.dart'
as
path
;
import
'package:platform/platform.dart'
show
Platform
,
LocalPlatform
;
import
'package:process/process.dart'
;
...
...
@@ -26,6 +27,7 @@ const String oldBaseUrl = 'https://storage.googleapis.com/flutter_infra';
const
String
newGsBase
=
'gs://flutter_infra_release'
;
const
String
newGsReleaseFolder
=
'
$newGsBase$releaseFolder
'
;
const
String
newBaseUrl
=
'https://storage.googleapis.com/flutter_infra_release'
;
const
int
shortCacheSeconds
=
60
;
/// Exception class for when a process fails to run, so we can catch
/// it and provide something more readable than a stack trace.
...
...
@@ -547,7 +549,10 @@ class ArchivePublisher {
);
}
}
await
_cloudCopy
(
outputFile
.
absolute
.
path
,
destGsPath
);
await
_cloudCopy
(
src:
outputFile
.
absolute
.
path
,
dest:
destGsPath
,
);
assert
(
tempDir
.
existsSync
());
await
_updateMetadata
(
'
$releaseFolder
/
${getMetadataFilename(platform)}
'
,
newBucket:
false
);
}
...
...
@@ -614,7 +619,14 @@ class ArchivePublisher {
const
JsonEncoder
encoder
=
JsonEncoder
.
withIndent
(
' '
);
metadataFile
.
writeAsStringSync
(
encoder
.
convert
(
jsonData
));
}
await
_cloudCopy
(
metadataFile
.
absolute
.
path
,
gsPath
);
await
_cloudCopy
(
src:
metadataFile
.
absolute
.
path
,
dest:
gsPath
,
// This metadata file is used by the website, so we don't want a long
// latency between publishing a release and it being available on the
// site.
cacheSeconds:
shortCacheSeconds
,
);
}
Future
<
String
>
_runGsUtil
(
...
...
@@ -655,7 +667,11 @@ class ArchivePublisher {
return
true
;
}
Future
<
String
>
_cloudCopy
(
String
src
,
String
dest
)
async
{
Future
<
String
>
_cloudCopy
({
@required
String
src
,
@required
String
dest
,
int
cacheSeconds
,
})
async
{
// We often don't have permission to overwrite, but
// we have permission to remove, so that's what we do.
await
_runGsUtil
(<
String
>[
'rm'
,
dest
],
failOk:
true
);
...
...
@@ -673,6 +689,7 @@ class ArchivePublisher {
// Use our preferred MIME type for the files we care about
// and let gsutil figure it out for anything else.
if
(
mimeType
!=
null
)
...<
String
>[
'-h'
,
'Content-Type:
$mimeType
'
],
if
(
cacheSeconds
!=
null
)
...<
String
>[
'-h'
,
'Cache-Control:max-age=
$cacheSeconds
'
],
'cp'
,
src
,
dest
,
...
...
@@ -804,7 +821,7 @@ Future<void> main(List<String> rawArguments) async {
branch
,
version
,
outputFile
,
parsedArguments
[
'dry_run'
]
as
bool
,
parsedArguments
[
'dry_run'
]
as
bool
,
);
await
publisher
.
publishArchive
(
parsedArguments
[
'force'
]
as
bool
);
}
...
...
dev/bots/test/prepare_package_test.dart
View file @
a2a520cb
...
...
@@ -301,13 +301,13 @@ void main() {
'
$gsutilCall
-- -h Content-Type:
$archiveMime
cp
$archivePath
$gsArchivePath
'
:
null
,
'
$gsutilCall
-- cp
$gsJsonPath
$jsonPath
'
:
null
,
'
$gsutilCall
-- rm
$gsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json cp
$jsonPath
$gsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json
-h Cache-Control:max-age=60
cp
$jsonPath
$gsJsonPath
'
:
null
,
'
$gsutilCall
-- stat
$newGsArchivePath
'
:
<
ProcessResult
>[
ProcessResult
(
0
,
1
,
''
,
''
)],
'
$gsutilCall
-- rm
$newGsArchivePath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:
$archiveMime
cp
$archivePath
$newGsArchivePath
'
:
null
,
'
$gsutilCall
-- cp
$newGsJsonPath
$jsonPath
'
:
null
,
'
$gsutilCall
-- rm
$newGsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json cp
$jsonPath
$newGsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json
-h Cache-Control:max-age=60
cp
$jsonPath
$newGsJsonPath
'
:
null
,
};
processManager
.
addCommands
(
convertResults
(
calls
));
final
File
outputFile
=
File
(
path
.
join
(
tempDir
.
absolute
.
path
,
archiveName
));
...
...
@@ -437,12 +437,12 @@ void main() {
'
$gsutilCall
-- -h Content-Type:
$archiveMime
cp
$archivePath
$gsArchivePath
'
:
null
,
'
$gsutilCall
-- cp
$gsJsonPath
$jsonPath
'
:
null
,
'
$gsutilCall
-- rm
$gsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json cp
$jsonPath
$gsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json
-h Cache-Control:max-age=60
cp
$jsonPath
$gsJsonPath
'
:
null
,
'
$gsutilCall
-- rm
$newGsArchivePath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:
$archiveMime
cp
$archivePath
$newGsArchivePath
'
:
null
,
'
$gsutilCall
-- cp
$newGsJsonPath
$jsonPath
'
:
null
,
'
$gsutilCall
-- rm
$newGsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json cp
$jsonPath
$newGsJsonPath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:application/json
-h Cache-Control:max-age=60
cp
$jsonPath
$newGsJsonPath
'
:
null
,
};
processManager
.
addCommands
(
convertResults
(
calls
));
assert
(
tempDir
.
existsSync
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment