-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: upload-artifacts.sh, deploy and destroy scripts.
- Loading branch information
1 parent
ec1bc61
commit c93b008
Showing
16 changed files
with
431 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
openapi3.yaml | ||
openapi2.yaml | ||
api_gateway_config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ venv-iac | |
realm/Pulumi.*.yaml | ||
environment/Pulumi.*.yaml | ||
keys/ | ||
_tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
# Determine the absolute path to the 'iac' directory | ||
iac_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
# Add this directory to sys.path, | ||
# so that we can import the iac/lib module when we run pulumi from withing the iac/backend directory. | ||
sys.path.insert(0, iac_folder) | ||
|
||
from lib import get_pulumi_stack_outputs | ||
|
||
current_dir = os.path.join(iac_folder, "backend") | ||
|
||
# the GCP API config file name | ||
# it should match the file name at `backend/scripts/convert_to_openapi2.py` | ||
GCP_API_GATEWAY_CONFIG_FILE="api_gateway_config.yaml" | ||
CONFIGS_DIR = os.path.join(current_dir, "_tmp", "configs") | ||
|
||
|
||
def download_backend_config(*, | ||
realm_name: str, | ||
run_id: str, | ||
version: str) -> None: | ||
output_dir = os.path.join(CONFIGS_DIR, run_id) | ||
os.makedirs(output_dir, exist_ok=False) | ||
print(f"Downloading the backend config to {output_dir}") | ||
|
||
# download the configurations. | ||
realm_outputs = get_pulumi_stack_outputs(stack_name=realm_name, module="realm") | ||
generic_repository = realm_outputs["generic_repository"].value | ||
|
||
try: | ||
subprocess.run( | ||
[ | ||
"gcloud", | ||
"artifacts", | ||
"generic", | ||
"download", | ||
"--package=backend-config", | ||
f"--repository={generic_repository["name"]}", | ||
f"--location={generic_repository["location"]}", | ||
f"--project={generic_repository["project"]}", | ||
"--destination=./", | ||
f"--version={version}" | ||
], | ||
cwd=output_dir, | ||
check=True, | ||
text=True | ||
) | ||
|
||
print("Done downloading the backend config bundle.") | ||
except subprocess.CalledProcessError as e: | ||
print(f"Error downloading backend config: {e}") | ||
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.