refactor
Some checks failed
Lint Checks / Run linter (pull_request) Failing after 47s
Deploy Test / Run deploy test suite (pull_request) Successful in 5m35s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 12m38s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m6s
Smoke Test / Run basic test suite (pull_request) Successful in 5m50s

This commit is contained in:
Thomas E Lackey 2024-02-23 15:22:15 -06:00
parent 2d8cc09e6f
commit 2a34f43678
3 changed files with 13 additions and 8 deletions

View File

@ -21,6 +21,8 @@
# TODO: display the available list of containers; allow re-build of either all or specific containers
import os
import sys
from decouple import config
import click
from pathlib import Path
@ -40,12 +42,9 @@ def command(ctx, base_container, source_repo, force_rebuild, extra_build_args, t
'''build the specified webapp container'''
quiet = ctx.obj.quiet
verbose = ctx.obj.verbose
dry_run = ctx.obj.dry_run
debug = ctx.obj.debug
local_stack = ctx.obj.local_stack
stack = ctx.obj.stack
continue_on_error = ctx.obj.continue_on_error
# See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
container_build_dir = Path(__file__).absolute().parent.parent.joinpath("data", "container-build")
@ -73,7 +72,10 @@ def command(ctx, base_container, source_repo, force_rebuild, extra_build_args, t
container_build_env,
dev_root_path,
)
build_containers.process_container(build_context_1)
ok = build_containers.process_container(build_context_1)
if not ok:
print("ERROR: Build failed.", file=sys.stderr)
sys.exit(1)
# Now build the target webapp. We use the same build script, but with a different Dockerfile and work dir.
container_build_env["CERC_WEBAPP_BUILD_RUNNING"] = "true"
@ -94,4 +96,7 @@ def command(ctx, base_container, source_repo, force_rebuild, extra_build_args, t
container_build_env,
dev_root_path,
)
build_containers.process_container(build_context_2)
ok = build_containers.process_container(build_context_2)
if not ok:
print("ERROR: Build failed.", file=sys.stderr)
sys.exit(1)

View File

@ -34,7 +34,7 @@ def remote_image_exists(local_tag: str, remote_repo_url: str):
try:
result = docker.manifest.inspect(remote_tag_for_image(local_tag, remote_repo_url))
return True if result else False
except:
except: # noqa: E722
return False

View File

@ -45,8 +45,8 @@ def process_app_deployment_request(
deployment_parent_dir,
kube_config,
image_registry,
force_rebuild = False,
log_file = None
force_rebuild=False,
log_file=None
):
# 1. look up application
app = laconic.get_record(app_deployment_request.attributes.application, require=True)