Skip to content

Commit

Permalink
chore: multi_deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz committed Jun 6, 2024
1 parent df289b5 commit c1f8bdb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tubular/scripts/frontend_multi_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@


@click.command("frontend_deploy")
@click.option(
'--common-config-file',
help='File from which common configuration variables are read.',
)
@click.option(
'--env-config-file',
help='File from which to read environment configuration variables.',
Expand All @@ -40,27 +44,30 @@
is_flag=True,
help='Boolean to decide if Cloudflare cache needs to be purged or not.',
)
def frontend_deploy(env_config_file, app_name, app_dist, purge_cache):
def frontend_deploy(common_config_file, env_config_file, app_name, app_dist, purge_cache):
"""
Copies a frontend application to an s3 bucket.
Args:
common_config_file (str): Path to a YAML file containing common configuration variables.
env_config_file (str): Path to a YAML file containing environment configuration variables.
app_name (str): Name of the frontend app.
app_dist (str): Path to frontend application dist directory.
purge_cache (bool): Should Cloudflare cache needs to be purged.
"""

if not env_config_file:
FAIL(1, 'Environment config file was not specified.')
if not app_name:
FAIL(1, 'Frontend application name was not specified.')
if not app_dist:
FAIL(1, 'Frontend application dist path was not specified.')
if not common_config_file:
FAIL(1, 'Common config file was not specified.')
if not env_config_file:
FAIL(1, 'Environment config file was not specified.')

# We are deploying ALL sites to a single bucket so they live at
# /<hostname>/ within the global bucket.
deployer = FrontendDeployer(env_config_file, app_name)
deployer = FrontendDeployer(common_config_file, env_config_file, app_name)
bucket_name = deployer.env_cfg.get('BUCKET_NAME')
if not bucket_name:
FAIL(1, 'No S3 bucket name configured for {}.'.format(app_name))
Expand Down

0 comments on commit c1f8bdb

Please sign in to comment.