Skip to content

Support unsetting --git* flags by passing empty string ( "" ) #424

@heyjcollins

Description

@heyjcollins

Description of problem

workload create/apply supports setting a handful of string-based workload object values via flags.
Once any of those flag/values have been set, the only way to unset them today is to pass a --file workload.yaml with those properties/values removed and use --update-strategy replace.

For someone who prefers to manage/configure their workload via apps commands/flags or someone unfamiliar with the workload object and/or yaml, this is inconvenient toil.

This initial issue will focus only on the --git* flag subset.

Proposed solution

Enable unsetting of --git* flags by passing an empty string.

swapping one git flag for another:

Given I've created a workload via command such as `tanzu apps workload create my-app --git-repo github.com/foo/bar --git-branch main --limit-cpu 500m`
When I run an update command such as `tanzu apps workload create my-app --git-repo github.com/foo/bar --git-branch "" --git-commit 1234`
Then the "git-branch" value gets removed from my workload object

removing git-repo (should remove all git references since they don't make sense in absence of a repo URL):

Given I've created a workload via command such as `tanzu apps workload create my-app --git-repo github.com/foo/bar --git-branch main`
When I run an update command such as `tanzu apps workload create my-app --git-repo ""
Then the "git-repo" AND "git-branch" property/values get removed from my workload object

help output

Given I'm looking at the output for  `tanzu apps workload create/apply --help`
When I view any help line for a flag in the list of flags to be updated as per this issue
Then I see `(to unset, pass empty string "")` appended to the each "--git*" flag description

List of flags to update

  1. --git-branch
  2. --git-commit
  3. --git-repo
  4. --git-tag

And these already have this feature enabled:

  1. --service-account
  2. --sub-path

Additional context

Once we have this in place we can consider making changes to the --git* flag UX as related to the changes made in fluxCD which set precedence order which favors the most discreet reference over lessors (e.g. if a --git-tag and --git-commit are provided, FluxCD will favor the commit).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions