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
aae92d66
Unverified
Commit
aae92d66
authored
May 11, 2021
by
Christopher Fujino
Committed by
GitHub
May 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix prepare_package.dart not updating base_url (#81941)
parent
a5318173
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
2 deletions
+85
-2
prepare_package.dart
dev/bots/prepare_package.dart
+3
-2
prepare_package_test.dart
dev/bots/test/prepare_package_test.dart
+82
-0
No files found.
dev/bots/prepare_package.dart
View file @
aae92d66
...
...
@@ -577,7 +577,8 @@ class ArchivePublisher {
/// This method will throw if the target archive already exists on cloud
/// storage.
Future
<
void
>
publishArchive
([
bool
forceUpload
=
false
])
async
{
for
(
final
String
releaseFolder
in
<
String
>[
oldGsReleaseFolder
,
newGsReleaseFolder
])
{
for
(
final
bool
isNew
in
<
bool
>[
false
,
true
])
{
final
String
releaseFolder
=
isNew
?
newGsReleaseFolder
:
oldGsReleaseFolder
;
final
String
destGsPath
=
'
$releaseFolder
/
$destinationArchivePath
'
;
if
(!
forceUpload
)
{
if
(
await
_cloudPathExists
(
destGsPath
)
&&
!
dryRun
)
{
...
...
@@ -591,7 +592,7 @@ class ArchivePublisher {
dest:
destGsPath
,
);
assert
(
tempDir
.
existsSync
());
await
_updateMetadata
(
'
$releaseFolder
/
${getMetadataFilename(platform)}
'
,
newBucket:
false
);
await
_updateMetadata
(
'
$releaseFolder
/
${getMetadataFilename(platform)}
'
,
newBucket:
isNew
);
}
}
...
...
dev/bots/test/prepare_package_test.dart
View file @
aae92d66
...
...
@@ -409,6 +409,88 @@ void main() {
expect
(
contents
,
equals
(
encoder
.
convert
(
jsonData
)));
});
test
(
'updates base_url from old bucket to new bucket'
,
()
async
{
final
String
archivePath
=
path
.
join
(
tempDir
.
absolute
.
path
,
archiveName
);
final
String
jsonPath
=
path
.
join
(
tempDir
.
absolute
.
path
,
releasesName
);
final
String
gsJsonPath
=
'gs://flutter_infra/releases/
$releasesName
'
;
final
String
newGsJsonPath
=
'gs://flutter_infra_release/releases/
$releasesName
'
;
final
String
releasesJson
=
'''
{
"base_url": "https://storage.googleapis.com/flutter_infra/releases",
"current_release": {
"beta": "3ea4d06340a97a1e9d7cae97567c64e0569dcaa2",
"dev": "5a58b36e36b8d7aace89d3950e6deb307956a6a0"
},
"releases": [
{
"hash": "5a58b36e36b8d7aace89d3950e6deb307956a6a0",
"channel": "dev",
"version": "v0.2.3",
"release_date": "2018-03-20T01:47:02.851729Z",
"archive": "dev/
$platformName
/flutter_
${platformName}
_v0.2.3-dev.zip",
"sha256": "4fe85a822093e81cb5a66c7fc263f68de39b5797b294191b6d75e7afcc86aff8"
},
{
"hash": "b9bd51cc36b706215915711e580851901faebb40",
"channel": "beta",
"version": "v0.2.2",
"release_date": "2018-03-16T18:48:13.375013Z",
"archive": "dev/
$platformName
/flutter_
${platformName}
_v0.2.2-dev.zip",
"sha256": "6073331168cdb37a4637a5dc073d6a7ef4e466321effa2c529fa27d2253a4d4b"
},
{
"hash": "
$testRef
",
"channel": "stable",
"version": "v0.0.0",
"release_date": "2018-03-20T01:47:02.851729Z",
"archive": "stable/
$platformName
/flutter_
${platformName}
_v0.0.0-dev.zip",
"sha256": "5dd34873b3a3e214a32fd30c2c319a0f46e608afb72f0d450b2d621a6d02aebd"
}
]
}
'''
;
File
(
jsonPath
).
writeAsStringSync
(
releasesJson
);
File
(
archivePath
).
writeAsStringSync
(
'archive contents'
);
final
Map
<
String
,
List
<
ProcessResult
>>
calls
=
<
String
,
List
<
ProcessResult
>>{
// This process fails because the file does NOT already exist
'
$gsutilCall
-- stat
$gsArchivePath
'
:
<
ProcessResult
>[
ProcessResult
(
0
,
1
,
''
,
''
)],
'
$gsutilCall
-- rm
$gsArchivePath
'
:
null
,
'
$gsutilCall
-- -h Content-Type:
$archiveMime
cp
$archivePath
$gsArchivePath
'
:
null
,
'
$gsutilCall
-- cp
$gsJsonPath
$jsonPath
'
:
null
,
'
$gsutilCall
-- rm
$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 -h Cache-Control:max-age=60 cp
$jsonPath
$newGsJsonPath
'
:
null
,
};
processManager
.
addCommands
(
convertResults
(
calls
));
final
File
outputFile
=
File
(
path
.
join
(
tempDir
.
absolute
.
path
,
archiveName
));
outputFile
.
createSync
();
assert
(
tempDir
.
existsSync
());
final
ArchivePublisher
publisher
=
ArchivePublisher
(
tempDir
,
testRef
,
Branch
.
stable
,
'v1.2.3'
,
outputFile
,
false
,
processManager:
processManager
,
subprocessOutput:
false
,
platform:
platform
,
);
assert
(
tempDir
.
existsSync
());
await
publisher
.
publishArchive
();
final
File
releaseFile
=
File
(
jsonPath
);
expect
(
releaseFile
.
existsSync
(),
isTrue
);
final
String
contents
=
releaseFile
.
readAsStringSync
();
final
Map
<
String
,
dynamic
>
jsonData
=
json
.
decode
(
contents
)
as
Map
<
String
,
dynamic
>;
expect
(
jsonData
[
'base_url'
],
'https://storage.googleapis.com/flutter_infra_release/releases'
);
});
test
(
'publishArchive throws if forceUpload is false and artifact already exists on cloud storage'
,
()
async
{
final
String
archiveName
=
platform
.
isLinux
?
'archive.tar.xz'
:
'archive.zip'
;
final
File
outputFile
=
File
(
path
.
join
(
tempDir
.
absolute
.
path
,
archiveName
));
...
...
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