push-images will only use the compose-defined tag
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 26s
Smoke Test / Run basic test suite (pull_request) Successful in 2m59s
Deploy Test / Run deploy test suite (pull_request) Successful in 4m19s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m9s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 9m44s

This commit is contained in:
Thomas E Lackey 2024-02-23 19:52:57 -06:00
parent 3194ebf8a6
commit a54e9c43a0

View File

@ -108,27 +108,28 @@ def process_app_deployment_request(
shutil.copyfile(env_filename, deployment_config_file)
needs_k8s_deploy = False
built_images = False
# 6. build container (if needed)
if not deployment_record or deployment_record.attributes.application != app.id:
needs_k8s_deploy = True
# check if the image already exists
if force_rebuild or not remote_image_exists(image_registry, app_image_shared_tag):
shared_tag_exists = remote_image_exists(image_registry, app_image_shared_tag)
if shared_tag_exists and not force_rebuild:
# simply add our unique tag to the existing image and we are done
add_tags_to_image(image_registry, app_image_shared_tag, deployment_container_unique_tag)
else:
# TODO: pull from request
extra_build_args = []
build_container_image(app, app_image_shared_tag, extra_build_args, log_file)
build_container_image(app, deployment_container_unique_tag, extra_build_args, log_file)
push_container_image(deployment_dir, log_file)
built_images = True
needs_k8s_deploy = True
# The build/push commands above will use the unique deployment tag, so now we need to add the shared tag.
add_tags_to_image(image_registry, deployment_container_unique_tag, app_image_shared_tag)
# 7. Add tags (as needed)
if built_images or not remote_image_exists(image_registry, deployment_container_unique_tag):
add_tags_to_image(image_registry, app_image_shared_tag, deployment_container_unique_tag)
# 8. update config (if needed)
# 7. update config (if needed)
if not deployment_record or file_hash(deployment_config_file) != deployment_record.attributes.meta.config:
needs_k8s_deploy = True
# 9. update k8s deployment
# 8. update k8s deployment
if needs_k8s_deploy:
print("Deploying to k8s")
deploy_to_k8s(