feat: warn about ignored inputs and remove misleading defaults#74
Open
JamBalaya56562 wants to merge 1 commit intoaws-actions:mainfrom
Open
feat: warn about ignored inputs and remove misleading defaults#74JamBalaya56562 wants to merge 1 commit intoaws-actions:mainfrom
JamBalaya56562 wants to merge 1 commit intoaws-actions:mainfrom
Conversation
When deploying with `package-type: Image`, several Zip-only inputs
(`runtime`, `handler`, `layers`) are silently dropped: index.js gates
each of them with `packageType === 'Zip' && ...` before sending the
CreateFunction / UpdateFunctionConfiguration request. Today the action
neither warns about the dropped values nor stops echoing the action's
own defaults into the workflow log, so the user has no signal that
their `runtime: nodejs20.x` (etc.) has no effect on the deployed
container function.
This is the same shape of footgun the action already guards against
for `s3-bucket` / `s3-key` / `source-kms-key-arn` on the Image side
and for `image-uri` / `code-artifacts-dir` on the Zip side — those
inputs already produce explicit `core.warning(...)` lines. This commit
extends the same treatment to the remaining Zip-only / Image-only
inputs.
Changes:
- validations.js: in checkInputConflicts, emit a warning when
`handler`, `runtime`, or `layers` is supplied with
package-type: Image, and when `image-config` is supplied with
package-type: Zip. Each warning explains why the input is being
ignored.
- action.yml: remove `default: 'index.handler'` from `handler` and
`default: 'nodejs20.x'` from `runtime`. These defaults are
injected into every action invocation by GitHub Actions and end
up echoed in the `with:` block of the run log, even when the
user did not write them — which is the exact source of confusion
reported by users seeing `runtime: nodejs20.x` in their Image
deploy logs (where it has no effect). The Zip fallback behavior
is preserved by validations.js, which already falls back to
`'index.handler'` and `'nodejs20.x'` when the input is empty —
so existing Zip users that omit either input keep getting the
same Lambda runtime/handler. The default values are now
documented in the input descriptions instead.
Tests:
- Three new cases under __tests__/validations.test.js
`Input Conflict Warnings`:
* warns about handler/runtime/layers for Image
* does not warn when those inputs are omitted on Image
* warns about image-config for Zip
dist/index.js is rebuilt with `npm run build` (ncc 0.36.1) since
validations.js is bundled into it.
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.
When deploying with
package-type: Image, several Zip-only inputs(
runtime,handler,layers) are silently dropped: index.js gateseach of them with
packageType === 'Zip' && ...before sending theCreateFunction / UpdateFunctionConfiguration request. Today the action
neither warns about the dropped values nor stops echoing the action's
own defaults into the workflow log, so the user has no signal that
their
runtime: nodejs20.x(etc.) has no effect on the deployedcontainer function.
This is the same shape of footgun the action already guards against
for
s3-bucket/s3-key/source-kms-key-arnon the Image sideand for
image-uri/code-artifacts-diron the Zip side — thoseinputs already produce explicit
core.warning(...)lines. This commitextends the same treatment to the remaining Zip-only / Image-only
inputs.
Changes:
validations.js: in checkInputConflicts, emit a warning when
handler,runtime, orlayersis supplied withpackage-type: Image, and when
image-configis supplied withpackage-type: Zip. Each warning explains why the input is being
ignored.
action.yml: remove
default: 'index.handler'fromhandleranddefault: 'nodejs20.x'fromruntime. These defaults areinjected into every action invocation by GitHub Actions and end
up echoed in the
with:block of the run log, even when theuser did not write them — which is the exact source of confusion
reported by users seeing
runtime: nodejs20.xin their Imagedeploy logs (where it has no effect). The Zip fallback behavior
is preserved by validations.js, which already falls back to
'index.handler'and'nodejs20.x'when the input is empty —so existing Zip users that omit either input keep getting the
same Lambda runtime/handler. The default values are now
documented in the input descriptions instead.
Tests:
Input Conflict Warnings:dist/index.js is rebuilt with
npm run build(ncc 0.36.1) sincevalidations.js is bundled into it.