Skip to content

[pre-check] knative/func#3826 rebased (config add partial flags) - #263

Closed
lkingland wants to merge 6 commits into
mainfrom
pr-3826-rebased
Closed

lkingland wants to merge 6 commits into
mainfrom
pr-3826-rebased

Conversation

@lkingland

@lkingland lkingland commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Fork-internal pre-check of the rebased contributor branch for knative#3826 (author: @Ankitsinghsisodya; their three commits are unchanged apart from the rebase).

Purpose: run the full Actions suite on our fork before any force-push to the contributor's branch. Not for merge. Close this once the upstream push happens.

Tip: 94f1f1f1c48e on current main 6bbfab4f2. The patch is the same as 27f29856c73c; git range-diff shows an empty interdiff.

On top of the rebased contributor commits:

  • Success-path tests: config envs add and config labels add with both --name and --value call Save. The labels checks for a missing flag run only after that both-flags path returns.
  • config envs add validates the new entry with ValidateEnvs before Save. A plain --value with no --name is rejected. A whole {{ secret:NAME }} or {{ configMap:NAME }} value with no name is still saved.
  • --name without --value still returns the contributor's message: --value is required when --name is provided.

Ankitsinghsisodya and others added 6 commits October 30, 2026 23:45
Added validation to ensure that the --name flag cannot be provided without the --value flag, and vice versa, in both environment and label commands. This prevents the creation of invalid configurations. Added corresponding unit tests to verify the expected error behavior when these flags are misused.
Updated error handling in the label command to use errors.New instead of fmt.Errorf for consistency in flag validation messages. This change improves clarity and maintains uniformity in error reporting when required flags are missing.
Replaced the buffer writer in the config command setup from ci.NewBufferWriter to github.NewBufferWriter for improved integration. Additionally, introduced a test CI generator factory using fnCmd.NewTestCIGeneratorFactory to enhance testing capabilities for the command. This change aims to streamline the configuration setup process and improve test reliability.
The partial-flag tests only check the error paths. Labels add
with both --name and --value returns before those checks, so a
regression that rejects the pair would not be caught.

Assert Save runs for envs and labels when both flags are set.
Share one config command helper for those tests.
config envs add --value=plain saved an entry with no name.
ValidateEnvs allows a nil name only for a whole secret or
configMap reference, so that func.yaml failed later at build.

Validate the new entry before Save. The same rules cover a
missing value and an invalid name.
ValidateEnvs says "env entry #0 is missing value field", which
means nothing at the CLI and drops the contributor's wording.

Check --name without --value first and keep that sentence.
ValidateEnvs still rejects a plain value with no name.
@lkingland lkingland closed this Nov 24, 2026
@lkingland
lkingland deleted the pr-3826-rebased branch November 24, 2026 05:54
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.

2 participants