Skip to content

Commit

Permalink
Merge pull request Azure#11 from daniv-msft/built-image-tag-fix
Browse files Browse the repository at this point in the history
Changed `up` command built image tag name
  • Loading branch information
daniv-msft authored May 12, 2023
2 parents c67fd7b + a43c9c0 commit 13c981f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
31 changes: 26 additions & 5 deletions src/containerapp/azext_containerapp/_up_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,12 @@ def run_acr_build(self, dockerfile, source, quiet=False, build_from_source=False
image_name = self.image if self.image is not None else self.name
from datetime import datetime

now = datetime.now()
# Add version tag for acr image
image_name += ":{}".format(
str(now).replace(" ", "").replace("-", "").replace(".", "").replace(":", "")
)
# Moving this to skip the buildpacks scenario for now due to issues with buildpacks
# now = datetime.now()
# # Add version tag for acr image
# image_name += ":{}".format(
# str(now).replace(" ", "").replace("-", "").replace(".", "").replace(":", "")
# )

self.image = self.registry_server + "/" + image_name

Expand All @@ -501,8 +502,14 @@ def run_acr_build(self, dockerfile, source, quiet=False, build_from_source=False

try:
# First try to build source using buildpacks
# Temporary fix: using run time tag as customer image tag
# Waiting for buildpacks side to fix this issue: https://github.com/buildpacks/pack/issues/1753
logger.warning("Attempting to build image using buildpacks...")
run_image_tag = get_latest_buildpack_run_tag("aspnet", "7.0")
if run_image_tag is not None:
image_name = f"{image_name}:{run_image_tag}"
self.build_container_from_source_with_buildpack(image_name, source)
self.image = self.registry_server + "/" + image_name
return
except ValidationError as e:
logger.warning(f"Unable to use buildpacks to build image from source: {e}\nFalling back to ACR Task...")
Expand All @@ -511,9 +518,23 @@ def run_acr_build(self, dockerfile, source, quiet=False, build_from_source=False
raise e

# If we're unable to use the buildpack, build source using an ACR Task
# Moving tagging img to here
# Skipping the buildpacks scenario for now due to issues with buildpacks
now = datetime.now()
# Add version tag for acr image
image_name += ":{}".format(
str(now).replace(" ", "").replace("-", "").replace(".", "").replace(":", "")
)
logger.warning("Attempting to build image using ACR Task...")
self.build_container_from_source_with_acr_task(image_name, source)
else:
# Moving tagging img to here
# Skipping the buildpacks scenario for now due to issues with buildpacks
now = datetime.now()
# Add version tag for acr image
image_name += ":{}".format(
str(now).replace(" ", "").replace("-", "").replace(".", "").replace(":", "")
)
queue_acr_build(
self.cmd,
self.acr.resource_group.name,
Expand Down
4 changes: 2 additions & 2 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4402,7 +4402,7 @@ def patch_run_interactive(cmd, resource_group_name=None, managed_env=None, show_
print(patchable_check_results_json)
if without_unpatchable_results == []:
return
user_input = input("Do you want to apply all the patch or specify by id? (y/n/id)\n")
user_input = input("Do you want to apply all the patches or specify by id? (y/n/id)\n")
patch_apply(cmd, patchable_check_results, user_input, pack_exec_path)


Expand Down Expand Up @@ -4455,7 +4455,7 @@ def patch_apply(cmd, patch_check_list, method, pack_exec_path):
patch_check["targetContainerName"],
patch_check["targetImageName"],
patch_check["newRunImage"],
pack_exec_path))
pack_exec_path)
patch_run_properties = {
'Context.Default.AzureCLI.PatchRunUserResponse':method,
'Context.Default.AzureCLI.PatchRunCount':1
Expand Down

0 comments on commit 13c981f

Please sign in to comment.