Skip to content

fix: restore package-type Image branching (regression in v1.1.1)#71

Open
JamBalaya56562 wants to merge 1 commit intoaws-actions:mainfrom
JamBalaya56562:fix/70-restore-image-package-type
Open

fix: restore package-type Image branching (regression in v1.1.1)#71
JamBalaya56562 wants to merge 1 commit intoaws-actions:mainfrom
JamBalaya56562:fix/70-restore-image-package-type

Conversation

@JamBalaya56562
Copy link
Copy Markdown
Contributor

Summary

Fixes #70.

v1.1.1 broke package-type: Image deployments. The action now fails for
every Image user with:

Packaging code artifacts from
##[error]Failed to package artifacts: Code artifacts directory path must be provided
##[error]Action failed with error: Code artifacts directory path must be provided

The output Packaging code artifacts from is the smoking gun — the
trailing space shows that code-artifacts-dir is empty (as expected for
Image deploys), yet packageCodeArtifacts() is being called anyway.

Root cause

The durable-functions refactor in #65 removed the package-type
branching from index.js. v1.1.0 had:

if (packageType === 'Zip') {
  finalZipPath = await packageCodeArtifacts(codeArtifactsDir);
} else if (packageType === 'Image') {
  core.info(`Using container image: ${imageUri}`);
}

v1.1.1 collapsed that to:

core.info(`Packaging code artifacts from ${codeArtifactsDir}`);
let finalZipPath = await packageCodeArtifacts(codeArtifactsDir);

The same regression hit createFunction (Code: { ImageUri },
PackageType: 'Image', the Runtime/Handler/Layers/ImageConfig gates,
and the Cannot change package type of existing Lambda function guard
were all deleted) and updateFunctionCode (the ImageUri branch was
removed).

Fix

Restores the v1.1.0 package-type gating across run(),
createFunction, updateFunctionConfiguration,
hasConfigurationChanged, and updateFunctionCode. The durable-
functions feature added in #65 (durableConfig, parsedDurableConfig,
DurableConfig) is preserved unchanged — both features now coexist.

Why the regression slipped through

The existing test suite mocks createFunction and updateFunctionCode
in most tests rather than exercising the real implementations, and
container_image_support.test.js only covered validations.js — there
was no test that drove the real index.js flow with
package-type: Image. This PR adds two regression tests that call the
real createFunction and updateFunctionCode with
package-type: Image and assert:

  • ImageUri is sent and ZipFile is not
  • PackageType: 'Image' is set
  • Runtime / Handler / Layers are omitted for Image

dist

dist/index.js is rebuilt with npm run build (ncc 0.36.1).

Test plan

  • npx jest __tests__/container_image_support.test.js — 7/7 pass (5 existing + 2 new regression tests)
  • Full npx jest — 232 pass; 11 pre-existing path-resolution failures in validations.test.js are POSIX-vs-Windows artifacts unrelated to this change
  • Manual deploy of an Image-type Lambda using the example workflow to confirm the original error no longer occurs

The durable-functions refactor (aws-actions#65) removed the package-type branching
in run(), createFunction, and updateFunctionCode, so Image deployments
now fail unconditionally with:

    Packaging code artifacts from
    Failed to package artifacts: Code artifacts directory path must be provided

because packageCodeArtifacts() is called even when no
code-artifacts-dir is configured.

This restores the v1.1.0 behavior:

  - run() skips packageCodeArtifacts when packageType === 'Image'
  - createFunction sends Code: { ImageUri } and PackageType: 'Image',
    and omits Runtime / Handler / Layers for Image
  - createFunction includes ImageConfig only for Image
  - updateFunctionCode sends ImageUri instead of ZipFile for Image
  - updateFunctionConfiguration omits Handler / Runtime / Layers for
    Image and includes ImageConfig only for Image
  - hasConfigurationChanged uses the same gating
  - the PackageType-change guard is restored
  - durable-functions config from aws-actions#65 is preserved unchanged

Adds a regression test that exercises the real createFunction and
updateFunctionCode with package-type: Image and asserts that ImageUri
is sent and that ZipFile / Runtime / Handler / Layers are not.

Fixes aws-actions#70.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to package artifacts: Code artifacts directory path must be provided

1 participant