Repository navigation
Add --env flag for generate --from-store - #1033
Merged
Merged
Conversation
Users scaffolding a stack.yaml for a store function typically need to add environment variables, such as OAuth settings, before running deploy. Allow one or more --env / -e ENVVAR=VALUE flags, merged over the store item's environment with the user's values taking precedence. Applies to both the stack.yaml and CRD outputs. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
AI Pull Request OverviewDisclaimer: This review was generated by automated AI and may contain errors. Do not trust its outputs without human verification. Summary
Approval rating (1-10)9/10. The change is small, consistent with existing patterns, and covered across the relevant output modes. Summary per fileSummary per file
Overall AssessmentThe scoped changes are straightforward and align with the existing Detailed ReviewDetailed ReviewNo findings. AI agent details. |
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.
Description
Adds
--env/-e ENVVAR=VALUEtogenerate, for use with--from-store.Users scaffolding a stack.yaml for a store function typically need to add environment variables, such as OAuth settings, before running deploy. Until now the from-store path only supported
--labeland--annotation, so environment variables could only be added by editing the generated file by hand.--envflags are accepted, parsed with the sameutil.ParseMappattern used by--label/--annotation, with malformed values rejected before any store request is madefprocessis folded in before the merge so it survives unless explicitly overridden--output stack.yamlscaffold and the Function CRD pathNote: the same change also landed on master directly (0e4bcb9) before the PR was raised; this branch carries the identical diff for review.
Motivation and Context
Completes flag parity for the
--output stack.yamlscaffold, which is aimed at overriding pre-built deployments such as adding OAuth environment variables and secrets before running deploy.How Has This Been Tested?
Test_runGenerate_FromStoreEnvrunsrunGenerateend-to-end against a test store, asserting store env override, new env keys, andfprocessretention in stack output, plus the merged env in CRD outputTest_runGenerate_FromStoreEnvParseErrorcovers malformed--envvaluesgo test ./commands/...passes; verified live against the store withfaas-cli generate --from-store nodeinfo --output stack.yaml --env read_timeout=120 -e plain_text=EnabledTypes of changes
Checklist: