Skip to content

Commit b58746d

Browse files
committed
downloading issuer tracker
Signed-off-by: Javan Lacerda <[email protected]>
1 parent 9b0fe2f commit b58746d

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

src/clusterfuzz/_internal/config/local_config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ def sub_config(self, path):
161161

162162
return Config(root=new_root)
163163

164+
# it returns if the config is for internal, external or google
165+
# TODO: add and get this information from the project.yaml file
166+
def get_target(self):
167+
return self._config_dir.split("/")[-1]
168+
169+
def get_config_dir(self):
170+
return self._config_dir
171+
164172
def _get_helper(self, key_name='', default=None,
165173
value_is_relative_path=False):
166174
"""Helper for get and get_absolute_functions."""

src/local/butler/deploy.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ def _deploy_zip(bucket_name, zip_path, test_deployment=False):
236236
else:
237237
common.execute('gsutil cp %s gs://%s/%s' % (zip_path, bucket_name,
238238
os.path.basename(zip_path)))
239+
240+
241+
def _download_zip(bucket_name, gcs_file_path, target_path):
242+
"""Download zip from GCS."""
243+
common.execute('gsutil cp gs://%s/%s %s' % (bucket_name, gcs_file_path, target_path))
239244

240245

241246
def _deploy_manifest(bucket_name,
@@ -610,10 +615,21 @@ def execute(args):
610615
if args.staging:
611616
_staging_deployment_helper()
612617
else:
613-
# This workaround is needed to set the env vars APPLICATION_ID and BOT_NAME
614-
# for local environment, and it's needed for loading the monitoring module
615-
config = local_config.ProjectConfig().get('env')
616-
environment.set_value("APPLICATION_ID", config["APPLICATION_ID"])
618+
# This workaround is needed to set BOT_NAME for local environment
619+
# and it's needed for loading the monitoring module
620+
config = local_config.ProjectConfig()
621+
config.set_environment()
622+
# We are removing the internal_issue_tracker module from cluterfuzz-config code
623+
# to be able to open the clusterfuzz-config code.
624+
# This workaround manages to download the internal_issue_tracker module from
625+
# GCS during the deployment.
626+
if config.get_target() == "google":
627+
config_dir = config.get_config_dir()
628+
config_path = os.path.join(config_dir, 'modules')
629+
bucket = config.get('deployment.bucket')
630+
_download_zip(bucket, "internal_issue_tracker.zip", config_path)
631+
common.execute(f'unzip {config_path}/internal_issue_tracker.zip -d {config_path}')
632+
common.execute(f'rm {config_path}/internal_issue_tracker.zip')
617633
environment.set_value("BOT_NAME", os.uname().nodename)
618634
_prod_deployment_helper(
619635
args.config_dir,

0 commit comments

Comments
 (0)