fix: detect .zip bundles in archive mode (apm pack default changed to zip)#49
Closed
danielmeppiel wants to merge 1 commit into
Closed
fix: detect .zip bundles in archive mode (apm pack default changed to zip)#49danielmeppiel wants to merge 1 commit into
danielmeppiel wants to merge 1 commit into
Conversation
… zip) The APM CLI flipped its `apm pack --archive` default output from .tar.gz to .zip. The action's bundle detection only matched .tar.gz, so packing with a current CLI failed with "apm pack produced no bundle" even though a .zip bundle was produced. findBundleOrNull now detects both .zip and .tar.gz in archive mode, with a format-agnostic multiple-archive error message. tar.gz remains fully supported (CLI opt-out via --archive-format tar.gz; bundles-file/restore paths unchanged). Doc strings in action.yml corrected to reflect the new .zip default. dist/ rebuilt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the action’s bundle discovery logic to remain compatible with the APM CLI’s apm pack --archive default changing from producing .tar.gz to producing .zip, and updates tests/docs accordingly.
Changes:
- Update
findBundleOrNull(..., archive=true)to detect both.zipand.tar.gzoutputs and make the “multiple archive” error message format-agnostic. - Extend
runPackSteptests to cover.zipdetection, keep.tar.gzcoverage, and update the multi-archive assertion message. - Update
action.ymlinput descriptions to reflect the CLI’s new default, and rebuilddist/index.js.
Show a summary per file
| File | Description |
|---|---|
| src/bundler.ts | Detect .zip and .tar.gz bundle artifacts in archive mode; improve ambiguity error message. |
| src/tests/bundler.test.ts | Add/adjust tests to validate .zip detection and updated multi-archive error messaging. |
| dist/index.js | Rebuilt compiled action output reflecting the source changes. |
| action.yml | Update input documentation to reflect .zip archive default behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/4 changed files
- Comments generated: 2
Comment on lines
37
to
40
| pack: | ||
| description: 'Pack a bundle after install. Format is controlled by `bundle-format` (default: apm). Produces .tar.gz by default.' | ||
| description: 'Pack a bundle after install. Format is controlled by `bundle-format` (default: apm). With `archive: true`, follows the apm CLI default and produces a .zip; .tar.gz remains supported via the CLI opt-out.' | ||
| required: false | ||
| default: 'false' |
Comment on lines
72
to
75
| archive: | ||
| description: 'Produce .tar.gz instead of directory (used with pack: true)' | ||
| description: 'Produce an archive bundle instead of a directory (used with pack: true). Follows the apm CLI default, which now produces .zip; .tar.gz is still supported.' | ||
| required: false | ||
| default: 'true' |
Collaborator
Author
|
Closing as superseded by #47, which predates this PR and fixes the same root cause (apm pack #47 fixes the .zip break across all three affected surfaces; this PR only addressed
Merging #47 instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The APM CLI intentionally and permanently flipped its
apm pack --archivedefault output format from.tar.gzto.zip(src/apm_cli/bundle/packer.py:archive_format: str = "zip", with--archive-format tar.gzas the opt-out). This action's bundle detection still only matched.tar.gz, so packing with a current CLI fails withapm pack produced no bundleeven though the CLI did produce a valid.zipbundle.Empirical evidence
Failing job: microsoft/apm GH-AW Compatibility (
build-release.yml→gh-aw-compat) on tag v0.21.0 — run 27832510355, job 82376879301.The fix belongs here in apm-action, not the CLI — the CLI default is deliberate.
Root cause
src/bundler.ts→findBundleOrNull(buildDir, archive). The archive branch filterede.endsWith('.tar.gz')only, so a.zipemit produced an empty list →null→ caller throws "apm pack produced no bundle."The fix (one line of detection)
--archive-format tar.gz;bundles-file/restore paths inmultibundle.tsstill use.tar.gz).installer.ts(apm-<suffix>.tar.gzbinary download) andrelease.tsmatrix-pack tar.gz logic untouched.Doc-string corrections (
action.yml)packinput: now statesarchive: truefollows the CLI default and produces.zip, with.tar.gzstill supported via the CLI opt-out.archiveinput: reworded from "Produce .tar.gz instead of directory" to reflect the.zipdefault.Tests
Extended
src/__tests__/bundler.test.ts(runPackStepsuite):.zipbundle in archive mode,.tar.gzbundle in archive mode,Build + verify
This is a compiled action —
dist/was rebuilt and committed.npm ci✅npm run typecheck✅npm run lint✅npm run build(regeneratesdist/index.js) ✅ —dist/index.jscommittedgit diff --name-only dist/) ✅ — no drift after commitnpm test✅ — 184 passed, 5 suitesCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com