mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Wait for Helm v4 before raising when platformCommand and Command are set
same for `PlatformHooks` and `hooks`. When backporting a feature for Helm v3 we forgot to mark as deprecation validations that will enforced in v4. See (search for "Remove in Helm 4."): - https://github.com/helm/helm/pull/13592/files#diff-fc137d62147eb6a9c89c0566479ff219320ca691f2505631ebacbe513bcc8108R268-R270 Fix: Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
This commit is contained in:
parent
e6122aba27
commit
5d9d9a0fb8
2 changed files with 5 additions and 5 deletions
|
|
@ -84,7 +84,7 @@ type Metadata struct {
|
|||
PlatformCommand []PlatformCommand `json:"platformCommand"`
|
||||
|
||||
// Command is the plugin command, as a single string.
|
||||
// Providing a command will result in an error if PlatformCommand is also set.
|
||||
// Providing a command will result in an deprecation warning if PlatformCommand is also set.
|
||||
//
|
||||
// The command will be passed through environment expansion, so env vars can
|
||||
// be present in this command. Unless IgnoreFlags is set, this will
|
||||
|
|
@ -266,11 +266,11 @@ func validatePluginData(plug *Plugin, filepath string) error {
|
|||
plug.Metadata.Usage = sanitizeString(plug.Metadata.Usage)
|
||||
|
||||
if len(plug.Metadata.PlatformCommand) > 0 && len(plug.Metadata.Command) > 0 {
|
||||
return fmt.Errorf("both platformCommand and command are set in %q", filepath)
|
||||
fmt.Printf("both platformCommand and command are set in %q. It's deprecated and will not be possible in Helm v4\n", filepath)
|
||||
}
|
||||
|
||||
if len(plug.Metadata.PlatformHooks) > 0 && len(plug.Metadata.Hooks) > 0 {
|
||||
return fmt.Errorf("both platformHooks and hooks are set in %q", filepath)
|
||||
fmt.Printf("both platformHooks and hooks are set in %q. It's deprecated and will not be possible in Helm v4\n", filepath)
|
||||
}
|
||||
|
||||
// We could also validate SemVer, executable, and other fields should we so choose.
|
||||
|
|
|
|||
|
|
@ -496,8 +496,8 @@ func TestValidatePluginData(t *testing.T) {
|
|||
{false, mockMissingMeta}, // Test if the metadata section missing
|
||||
{true, mockNoCommand}, // Test no command metadata works
|
||||
{true, mockLegacyCommand}, // Test legacy command metadata works
|
||||
{false, mockWithCommand}, // Test platformCommand and command both set fails
|
||||
{false, mockWithHooks}, // Test platformHooks and hooks both set fails
|
||||
{true, mockWithCommand}, // Test platformCommand and command both set pass until v4
|
||||
{true, mockWithHooks}, // Test platformHooks and hooks both set pass until v4
|
||||
} {
|
||||
err := validatePluginData(item.plug, fmt.Sprintf("test-%d", i))
|
||||
if item.pass && err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue