mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
ensure we do not double publish to CIPD (#19724)
This commit is contained in:
parent
be7595bafb
commit
56bb3c5b33
@ -10,6 +10,7 @@ import argparse
|
||||
import errno
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
@ -175,17 +176,39 @@ def BuildBucket(runtime_mode, arch, product):
|
||||
CopyIcuDepsToBucket(out_dir, deps_dir)
|
||||
|
||||
|
||||
def CheckCIPDPackageExists(package_name, tag):
|
||||
'''Check to see if the current package/tag combo has been published'''
|
||||
command = [
|
||||
'cipd',
|
||||
'search',
|
||||
package_name,
|
||||
'-tag',
|
||||
tag,
|
||||
]
|
||||
stdout = subprocess.check_output(command)
|
||||
match = re.search(r'No matching instances\.', stdout)
|
||||
if match:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
def ProcessCIPDPackage(upload, engine_version):
|
||||
# Copy the CIPD YAML template from the source directory to be next to the bucket
|
||||
# we are about to package.
|
||||
cipd_yaml = os.path.join(_script_dir, 'fuchsia.cipd.yaml')
|
||||
CopyFiles(cipd_yaml, os.path.join(_bucket_directory, 'fuchsia.cipd.yaml'))
|
||||
|
||||
if upload and IsLinux():
|
||||
tag = 'git_revision:%s' % engine_version
|
||||
already_exists = CheckCIPDPackageExists('flutter/fuchsia', tag)
|
||||
if already_exists:
|
||||
print('CIPD package flutter/fuchsia tag %s already exists!' % tag)
|
||||
|
||||
if upload and IsLinux() and not already_exists:
|
||||
command = [
|
||||
'cipd', 'create', '-pkg-def', 'fuchsia.cipd.yaml', '-ref', 'latest',
|
||||
'-tag',
|
||||
'git_revision:%s' % engine_version
|
||||
tag,
|
||||
]
|
||||
else:
|
||||
command = [
|
||||
|
||||
@ -52,9 +52,34 @@ def WriteCIPDDefinition(target_arch, out_dir, symbol_dirs):
|
||||
return yaml_file
|
||||
|
||||
|
||||
def CheckCIPDPackageExists(package_name, tag):
|
||||
'''Check to see if the current package/tag combo has been published'''
|
||||
command = [
|
||||
'cipd',
|
||||
'search',
|
||||
package_name,
|
||||
'-tag',
|
||||
tag,
|
||||
]
|
||||
stdout = subprocess.check_output(command)
|
||||
match = re.search(r'No matching instances\.', stdout)
|
||||
if match:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
def ProcessCIPDPackage(upload, cipd_yaml, engine_version, out_dir, target_arch):
|
||||
_packaging_dir = GetPackagingDir(out_dir)
|
||||
if upload and IsLinux():
|
||||
tag = 'git_revision:%s' % engine_version
|
||||
package_name = 'flutter/fuchsia-debug-symbols-%s' % target_arch
|
||||
already_exists = CheckCIPDPackageExists(
|
||||
package_name,
|
||||
tag)
|
||||
if already_exists:
|
||||
print('CIPD package %s tag %s already exists!' % (package_name, tag))
|
||||
|
||||
if upload and IsLinux() and not already_exists:
|
||||
command = [
|
||||
'cipd', 'create', '-pkg-def', cipd_yaml, '-ref', 'latest', '-tag',
|
||||
'git_revision:%s' % engine_version
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user