[AppService] Fix Azure/azure-cli#33688: az functionapp deploy: Fix wrong Content-Type header for zip deployments - #33689
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
az functionapp deploy: Fix wrong Content-Type header for zip deployments
Aditya Pujara (a0x1ab)
left a comment
There was a problem hiding this comment.
Automated review — CI and live-test results
Head SHA: fe8263daa6b929e225b2b6558942b165906cfe21
❌ CI check: Azure.azure-cli (Build #20260701.11 failed)
Looking at the Azure DevOps build timeline (buildId 326978), the actual root cause is:
Test Homebrew Formulajob was canceled after exceeding the 60-minute job timeout.- This timeout cascaded and canceled the
Bash Scriptstep as well. - No other job in the pipeline reported an error (no pylint/pytest/unit-test failures were found in the timeline).
This looks like an environment/timeout flake in the Homebrew formula packaging step rather than a
failure caused by the code change itself, but please double-check that nothing in this PR (e.g. new
dependencies, changed packaging metadata) could slow down or hang the Homebrew formula build/test
step. If you can't find a relevant cause, it's worth pushing an empty/no-op commit or re-checking after
a rebase so the CI re-runs.
❌ Tester (live-test.yml on Azure/issue-sentinel)
The live-test workflow run also failed, but for an infrastructure reason unrelated to this PR's code:
gh: The 'Microsoft Open Source' enterprise forbids access via a personal access tokens (classic)
if the token's lifetime is greater than 8 days. (HTTP 403)
The workflow's azclibot-pat (stored in Key Vault azclibotfinegrainedpat) appears to be expired/rejected,
so it could not even fetch the PR JSON to determine which tests to run. This is a pipeline credential
issue on the Azure/issue-sentinel side, not something this PR can fix.
Summary
- 92/94 checks passed; 1 failed (
Azure.azure-cli, apparently a Homebrew-formula timeout), and the
live-test tester failed due to an expired bot PAT (infra issue). - Please verify the PR change doesn't affect Homebrew packaging/build time, and consider triggering a
fresh commit/rebase to get a clean CI run for theAzure.azure-clicheck.
Posted by agent-assist (autonomous bug-fix pipeline).
|
Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33689 (review) and push a fix. Posted by agent-assist (autonomous bug-fix pipeline). |
Investigated both failures and confirmed they are infra flakes, not caused by this PR change.
I also reran the relevant AppService unit tests locally and pushed commit |
|
AppService |
Aditya Pujara (a0x1ab)
left a comment
There was a problem hiding this comment.
Review summary — PR #33689
CI: ✅ All 50 checks passed.
Live-test tester: live-test.yml run (run 28512989987) failed, but not due to this PR's code. The job's gh api calls failed with:
gh: The 'Microsoft Open Source' enterprise forbids access via a personal access tokens (classic) if the token's lifetime is greater than 8 days. Please adjust your token's lifetime at the following URL: https://github.com/settings/tokens/4717038685 (HTTP 403)
This is an infrastructure problem (the azclibotfinegrainedpat/azclibot-pat secret used by the tester has expired), which broke the PR-info lookup before the test-selection logic ran. The tester's own log shows it would have found no changed test files for this PR and skipped the live test neutrally otherwise.
Conclusion: No action needed from Copilot — this PR looks good on CI, and the tester failure is an unrelated pipeline/secret issue requiring maintainer attention (rotate the azclibot-pat secret), not a code fix.
Posted by agent-assist (autonomous bug-fix pipeline).
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
This PR updates the SCM “one deploy” request headers so zip-based deployments use the correct Content-Type, and adds unit tests to validate the behavior.
Changes:
- Set
Content-Typetoapplication/zipwhen deploying a zip artifact viasrc_path. - Keep
application/octet-streamfor non-zip artifacts viasrc_path. - Add mocked tests asserting the
additional_headerspassed toget_scm_site_headers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/appservice/custom.py | Adjusts _get_ondeploy_headers to select Content-Type based on artifact_type for file-path deployments. |
| src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_webapp_commands_thru_mock.py | Adds tests verifying Content-Type selection and Cache-Control header propagation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if params.artifact_type == 'zip': | ||
| content_type = 'application/zip' | ||
| else: | ||
| content_type = 'application/octet-stream' |
| @mock.patch('azure.cli.command_modules.appservice.custom._populate_cached_scm_headers') | ||
| @mock.patch('azure.cli.command_modules.appservice.custom.get_scm_site_headers', return_value={}) | ||
| def test_get_ondeploy_headers_uses_zip_content_type_for_zip_artifact( | ||
| self, get_scm_site_headers_mock, _populate_cached_headers_mock): | ||
| from azure.cli.command_modules.appservice.custom import _get_ondeploy_headers | ||
| params = self._make_params() | ||
| params.src_path = '/tmp/package.zip' | ||
| params.artifact_type = 'zip' |
Live test results —
|
Live test results —
|
|
Copilot please review and implement all unaddressed human feedback through Yong Zhang (@yonzhan)'s latest comment at #33689 (comment), then push the fix to this PR. Posted by agent-assist (autonomous bug-fix pipeline). |
Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Addressed the outstanding review feedback: |
Live test results —
|
Live test results —
|
|
🔔 Routing this PR to @Azure/act-observability-squad. |
Live test results —
|
There was a problem hiding this comment.
Automated Review Summary — All Checks Passed
PR: [AppService] Fix #33688: az functionapp deploy: Fix wrong Content-Type header for zip deployments
- Live test: ✅ Passed (
azdev testagainst changed test files) — https://github.com/Azure/issue-sentinel/actions/runs/32455267949 - CI checks: ✅ All required checks passed (0 failed, 0 pending)
- Regression coverage: ✅ Production change in
appservice/custom.pyis covered by an updated test intest_webapp_commands_thru_mock.py; no coverage gap detected.
No further automated action needed. Ready for human/maintainer merge decision.
Related command
az functionapp deploy --resource-group <rg> --name <app> --src-path <artifact>.zipDescription
az functionapp deploysentapplication/octet-streamfor all local artifacts, including zip files, which can be rejected by Kudu/SCM with HTTP 415.This change makes zip uploads use
application/zipwhile preserving existing behavior for non-zip artifact types.Header selection fix
_get_ondeploy_headers()to branch onartifact_typewhensrc_pathis used.zipnow maps toContent-Type: application/zip; other local artifact types remainapplication/octet-stream.src_urlbehavior is unchanged (application/json).Coverage update
application/zip).application/octet-stream.Testing Guide
Example command that should now send the correct media type for zip:
History Notes
[AppService]
az functionapp deploy: Fix wrong Content-Type header for zip deploymentsThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.