Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bbaee5f
Adding patch list
harryli0108 May 4, 2023
5419d8e
Added patch list command
snehapar9 May 4, 2023
9f425d8
Revert thumbprint arg
snehapar9 May 4, 2023
1d8078a
Fix bugs
harryli0108 May 4, 2023
9af1fc8
Merge branch 'snehapar/patch-list' into patchList
snehapar9 May 4, 2023
04f21ed
Merge pull request #1 from harryli0108/patchList
snehapar9 May 4, 2023
1821286
Integrated with Harry
snehapar9 May 4, 2023
e373062
Fixed bug
snehapar9 May 5, 2023
eae2a49
Fixed command usage text
snehapar9 May 5, 2023
44371f1
Made managed env optional
snehapar9 May 8, 2023
9ba04df
Fixed identation
snehapar9 May 8, 2023
fd55c59
Fixed identation
snehapar9 May 8, 2023
3a5f808
Merge branch 'snehapar/test-branch' into test
harryli0108 May 8, 2023
4ee1946
Merge branch 'snehapar/test-branch' into test
harryli0108 May 8, 2023
ee786b5
Merge pull request #2 from harryli0108/test
snehapar9 May 8, 2023
01ec69a
Made env optional
snehapar9 May 9, 2023
f00eba5
Merge pull request #3 from harryli0108/main
snehapar9 May 9, 2023
6a17a94
Merge branch 'snehapar/patch-list' into snehapar/test-branch
snehapar9 May 9, 2023
cfb5fe2
Remove patch list
snehapar9 May 10, 2023
eca488e
Update help text for patch list and patch run
snehapar9 May 10, 2023
f75be55
Modified help text
snehapar9 May 11, 2023
d6aa33d
Merge branch 'main' into snehapar/test-branch
snehapar9 May 11, 2023
d1f890b
Made resouce group optional
snehapar9 May 11, 2023
e20e7de
Merge branch 'snehapar/test-branch' of https://github.com/snehapar9/a…
snehapar9 May 11, 2023
9b3e381
Added custom telemetry
snehapar9 May 11, 2023
398f7ce
Fixed linting errors
snehapar9 May 11, 2023
84d3fcc
Merge remote-tracking branch 'harry/main' into snehapar/test-branch
snehapar9 May 11, 2023
ca37ef8
Fix merge resolution fails
snehapar9 May 11, 2023
49d747e
Telemetry for patch run
snehapar9 May 11, 2023
68d12fb
Added telemetry for patch apply count
snehapar9 May 11, 2023
6c8effd
Removed revision mode
snehapar9 May 11, 2023
34cfd69
Removed print statement
snehapar9 May 11, 2023
156da83
Merge branch 'main' into snehapar/test-branch
harryli0108 May 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/containerapp/azext_containerapp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,7 @@ def patchableCheck(repoTagSplit: str, oryxBuilderRunImgTags, bom):
result = {
"targetContainerAppName": bom["targetContainerAppName"],
"targetContainerName": bom["targetContainerName"],
"targetContainerAppEnvironmentName": bom["targetContainerAppEnvironmentName"],
"targetImageName": bom["image_name"],
"oldRunImage": repoTagSplit,
"newRunImage": None,
Expand Down
11 changes: 8 additions & 3 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4407,7 +4407,7 @@ def patch_run_interactive(cmd, resource_group_name=None, managed_env=None, show_
if without_unpatchable_results == []: return
user_input=input("Do you want to apply all the patch or specify by id? (y/n/id)\n")
if user_input == "y":
telemetry_core.add_extension_event('patch-run')
telemetry_core.add_extension_event('containerapp',{'Context.Default.AzureCLI.PatchRun':"Ran patch run command"})
return patch_apply(cmd, patchable_check_results, user_input, resource_group_name, pack_exec_path)

def patch_run(cmd, resource_group_name=None, managed_env=None, show_all=False):
Expand All @@ -4429,6 +4429,8 @@ def patch_run(cmd, resource_group_name=None, managed_env=None, show_all=False):
def patch_apply(cmd, patchCheckList, method, resource_group_name, pack_exec_path):
results = []
m = method.strip().lower()
# Tracks number of times patch was applied.
patchApplyCount = 0
if m == "y":
for patch_check in patchCheckList:
if patch_check["id"]:
Expand All @@ -4438,7 +4440,8 @@ def patch_apply(cmd, patchCheckList, method, resource_group_name, pack_exec_path
patch_check["targetContainerAppName"],
patch_check["targetContainerName"],
patch_check["targetImageName"],
patch_check["newRunImage"],
patch_check["newRunImage"],
patchApplyCount,
pack_exec_path))
elif m == "n":
print("No patch applied."); return
Expand All @@ -4453,12 +4456,13 @@ def patch_apply(cmd, patchCheckList, method, resource_group_name, pack_exec_path
patch_check["targetContainerName"],
patch_check["targetImageName"],
patch_check["newRunImage"],
patchApplyCount,
pack_exec_path))
return
print("Invalid patch method or id."); return
return results

def patch_cli_call(cmd, resource_group, container_app_name, container_name, target_image_name, new_run_image, pack_exec_path):
def patch_cli_call(cmd, resource_group, container_app_name, container_name, target_image_name, new_run_image, patch_apply_count=0, pack_exec_path):
try:
print("Applying patch for container app: " + container_app_name + " container: " + container_name)
subprocess.run(f"{pack_exec_path} rebase -q {target_image_name} --run-image {new_run_image}", shell=True)
Expand All @@ -4467,6 +4471,7 @@ def patch_cli_call(cmd, resource_group, container_app_name, container_name, targ
print(f"Publishing {new_target_image_name} to registry...")
subprocess.run(f"docker push -q {new_target_image_name}", shell=True)
print("Patch applied and published successfully.\nNew image: " + new_target_image_name)
patch_apply_count+=1
except Exception:
print("Error: Failed to apply patch and publish. Check if registry is logged in and has write access.")
raise
Expand Down