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
8bee0834
Unverified
Commit
8bee0834
authored
May 28, 2021
by
godofredoc
Committed by
GitHub
May 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove logic to save artifacts to old gcs location. (#83526)
parent
c13c2ee6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
56 deletions
+28
-56
prepare_package.dart
dev/bots/prepare_package.dart
+21
-28
prepare_package_test.dart
dev/bots/test/prepare_package_test.dart
+7
-28
No files found.
dev/bots/prepare_package.dart
View file @
8bee0834
...
...
@@ -20,13 +20,10 @@ const String chromiumRepo = 'https://chromium.googlesource.com/external/github.c
const
String
githubRepo
=
'https://github.com/flutter/flutter.git'
;
const
String
mingitForWindowsUrl
=
'https://storage.googleapis.com/flutter_infra_release/mingit/'
'603511c649b00bbef0a6122a827ac419b656bc19/mingit.zip'
;
const
String
oldGsBase
=
'gs://flutter_infra'
;
const
String
releaseFolder
=
'/releases'
;
const
String
oldGsReleaseFolder
=
'
$oldGsBase$releaseFolder
'
;
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
String
gsBase
=
'gs://flutter_infra_release'
;
const
String
gsReleaseFolder
=
'
$gsBase$releaseFolder
'
;
const
String
baseUrl
=
'https://storage.googleapis.com/flutter_infra_release'
;
const
int
shortCacheSeconds
=
60
;
/// Exception class for when a process fails to run, so we can catch
...
...
@@ -540,7 +537,7 @@ class ArchivePublisher {
this
.
platform
=
const
LocalPlatform
(),
})
:
assert
(
revision
.
length
==
40
),
platformName
=
platform
.
operatingSystem
.
toLowerCase
(),
metadataGsPath
=
'
$
newG
sReleaseFolder
/
${getMetadataFilename(platform)}
'
,
metadataGsPath
=
'
$
g
sReleaseFolder
/
${getMetadataFilename(platform)}
'
,
_processRunner
=
ProcessRunner
(
processManager:
processManager
,
subprocessOutput:
subprocessOutput
,
...
...
@@ -577,28 +574,24 @@ class ArchivePublisher {
/// This method will throw if the target archive already exists on cloud
/// storage.
Future
<
void
>
publishArchive
([
bool
forceUpload
=
false
])
async
{
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
)
{
throw
PreparePackageException
(
'File
$destGsPath
already exists on cloud storage!'
,
);
}
final
String
destGsPath
=
'
$gsReleaseFolder
/
$destinationArchivePath
'
;
if
(!
forceUpload
)
{
if
(
await
_cloudPathExists
(
destGsPath
)
&&
!
dryRun
)
{
throw
PreparePackageException
(
'File
$destGsPath
already exists on cloud storage!'
,
);
}
await
_cloudCopy
(
src:
outputFile
.
absolute
.
path
,
dest:
destGsPath
,
);
assert
(
tempDir
.
existsSync
());
await
_updateMetadata
(
'
$releaseFolder
/
${getMetadataFilename(platform)}
'
,
newBucket:
isNew
);
}
await
_cloudCopy
(
src:
outputFile
.
absolute
.
path
,
dest:
destGsPath
,
);
assert
(
tempDir
.
existsSync
());
await
_updateMetadata
(
'
$gsReleaseFolder
/
${getMetadataFilename(platform)}
'
);
}
Future
<
Map
<
String
,
dynamic
>>
_addRelease
(
Map
<
String
,
dynamic
>
jsonData
,
{
bool
newBucket
=
true
})
async
{
final
String
tmpBaseUrl
=
newBucket
?
newBaseUrl
:
oldBaseUrl
;
jsonData
[
'base_url'
]
=
'
$tmpBaseUrl$releaseFolder
'
;
Future
<
Map
<
String
,
dynamic
>>
_addRelease
(
Map
<
String
,
dynamic
>
jsonData
)
async
{
jsonData
[
'base_url'
]
=
'
$baseUrl$releaseFolder
'
;
if
(!
jsonData
.
containsKey
(
'current_release'
))
{
jsonData
[
'current_release'
]
=
<
String
,
String
>{};
}
...
...
@@ -630,7 +623,7 @@ class ArchivePublisher {
return
jsonData
;
}
Future
<
void
>
_updateMetadata
(
String
gsPath
,
{
bool
newBucket
=
true
}
)
async
{
Future
<
void
>
_updateMetadata
(
String
gsPath
)
async
{
// We can't just cat the metadata from the server with 'gsutil cat', because
// Windows wants to echo the commands that execute in gsutil.bat to the
// stdout when we do that. So, we copy the file locally and then read it
...
...
@@ -652,7 +645,7 @@ class ArchivePublisher {
throw
PreparePackageException
(
'Unable to parse JSON metadata received from cloud:
$e
'
);
}
jsonData
=
await
_addRelease
(
jsonData
,
newBucket:
newBucket
);
jsonData
=
await
_addRelease
(
jsonData
);
const
JsonEncoder
encoder
=
JsonEncoder
.
withIndent
(
' '
);
metadataFile
.
writeAsStringSync
(
encoder
.
convert
(
jsonData
));
...
...
@@ -776,7 +769,7 @@ Future<void> main(List<String> rawArguments) async {
defaultsTo:
false
,
help:
'If set, will publish the archive to Google Cloud Storage upon '
'successful creation of the archive. Will publish under this '
'directory:
$
newB
aseUrl$releaseFolder
'
,
'directory:
$
b
aseUrl$releaseFolder
'
,
);
argParser
.
addFlag
(
'force'
,
...
...
dev/bots/test/prepare_package_test.dart
View file @
8bee0834
...
...
@@ -294,8 +294,7 @@ void main() {
final
String
releasesName
=
'releases_
$platformName
.json'
;
final
String
archiveName
=
platform
.
isLinux
?
'archive.tar.xz'
:
'archive.zip'
;
final
String
archiveMime
=
platform
.
isLinux
?
'application/x-gtar'
:
'application/zip'
;
final
String
gsArchivePath
=
'gs://flutter_infra/releases/stable/
$platformName
/
$archiveName
'
;
final
String
newGsArchivePath
=
'gs://flutter_infra_release/releases/stable/
$platformName
/
$archiveName
'
;
final
String
gsArchivePath
=
'gs://flutter_infra_release/releases/stable/
$platformName
/
$archiveName
'
;
setUp
(()
async
{
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[]);
...
...
@@ -309,11 +308,10 @@ void main() {
test
(
'calls the right processes'
,
()
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
gsJsonPath
=
'gs://flutter_infra_release/releases/
$releasesName
'
;
final
String
releasesJson
=
'''
{
"base_url": "https://storage.googleapis.com/flutter_infra/releases",
"base_url": "https://storage.googleapis.com/flutter_infra
_release
/releases",
"current_release": {
"beta": "3ea4d06340a97a1e9d7cae97567c64e0569dcaa2",
"dev": "5a58b36e36b8d7aace89d3950e6deb307956a6a0"
...
...
@@ -356,12 +354,6 @@ void main() {
'
$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
));
...
...
@@ -412,11 +404,10 @@ void main() {
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
gsJsonPath
=
'gs://flutter_infra_release/releases/
$releasesName
'
;
final
String
releasesJson
=
'''
{
"base_url": "https://storage.googleapis.com/flutter_infra/releases",
"base_url": "https://storage.googleapis.com/flutter_infra
_release
/releases",
"current_release": {
"beta": "3ea4d06340a97a1e9d7cae97567c64e0569dcaa2",
"dev": "5a58b36e36b8d7aace89d3950e6deb307956a6a0"
...
...
@@ -459,12 +450,6 @@ void main() {
'
$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
));
...
...
@@ -529,11 +514,10 @@ void main() {
);
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
gsJsonPath
=
'gs://flutter_infra_release/releases/
$releasesName
'
;
final
String
releasesJson
=
'''
{
"base_url": "https://storage.googleapis.com/flutter_infra/releases",
"base_url": "https://storage.googleapis.com/flutter_infra
_release
/releases",
"current_release": {
"beta": "3ea4d06340a97a1e9d7cae97567c64e0569dcaa2",
"dev": "5a58b36e36b8d7aace89d3950e6deb307956a6a0"
...
...
@@ -574,11 +558,6 @@ void main() {
'
$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
-- 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
));
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