Skip to content

Commit

Permalink
Officially deprecate component group and add messaging to CLI + docs (
Browse files Browse the repository at this point in the history
#2032)

## Description

Officially deprecate component `group` and add messaging to CLI + docs

## Related Issue

Fixes #1792 

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
Racer159 authored Sep 26, 2023
1 parent 4ce9d06 commit 899bf8f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 19 deletions.
16 changes: 0 additions & 16 deletions docs/3-create-a-zarf-package/4-zarf-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -760,22 +760,6 @@ Must be one of:
</blockquote>
</details>

<details>
<summary>
<strong> <a name="components_items_group"></a>group</strong>
</summary>
&nbsp;
<blockquote>

**Description:** Create a user selector field based on all components in the same group

| | |
| -------- | -------- |
| **Type** | `string` |

</blockquote>
</details>

<details open>
<summary>
<strong> <a name="components_items_import"></a>import</strong>
Expand Down
6 changes: 6 additions & 0 deletions src/pkg/packager/deprecated/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package deprecated

import (
"fmt"
"strings"

"slices"
Expand Down Expand Up @@ -67,6 +68,11 @@ func MigrateComponent(build types.ZarfBuildData, component types.ZarfComponent)
}
}

// Show a warning if the component contains a group as that has been deprecated and will be removed.
if component.Group != "" {
warnings = append(warnings, fmt.Sprintf("Component %s is using group which has been deprecated and will be removed in v1.0.0. Please migrate to another solution.", component.Name))
}

// Future migrations here.
return migratedComponent, warnings
}
Expand Down
1 change: 1 addition & 0 deletions src/test/e2e/01_component_choice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestComponentChoice(t *testing.T) {
// We currently don't have a pattern to actually test the interactive prompt, so just testing automation for now
stdOut, stdErr, err := e2e.Zarf("package", "deploy", path, "--components=first-choice,second-choice", "--confirm")
require.Error(t, err, stdOut, stdErr)
require.Contains(t, stdErr, "Component first-choice is using group which has been deprecated", "output should show a warning for group being deprecated.")

// Deploy a single choice and expect success
stdOut, stdErr, err = e2e.Zarf("package", "deploy", path, "--components=first-choice", "--confirm")
Expand Down
2 changes: 1 addition & 1 deletion src/types/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type ZarfComponent struct {

// Key to match other components to produce a user selector field, used to create a BOOLEAN XOR for a set of components
// Note: ignores default and required flags
Group string `json:"group,omitempty" jsonschema:"description=Create a user selector field based on all components in the same group"`
Group string `json:"group,omitempty" jsonschema:"description=[Deprecated] Create a user selector field based on all components in the same group. This will be removed in Zarf v1.0.0.,deprecated=true"`

// (Deprecated) Path to cosign public key for signed online resources
DeprecatedCosignKeyPath string `json:"cosignKeyPath,omitempty" jsonschema:"description=[Deprecated] Specify a path to a public key to validate signed online resources. This will be removed in Zarf v1.0.0.,deprecated=true"`
Expand Down
3 changes: 2 additions & 1 deletion src/ui/lib/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ export interface ZarfComponent {
*/
files?: ZarfFile[];
/**
* Create a user selector field based on all components in the same group
* [Deprecated] Create a user selector field based on all components in the same group. This
* will be removed in Zarf v1.0.0.
*/
group?: string;
/**
Expand Down
2 changes: 1 addition & 1 deletion zarf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
},
"group": {
"type": "string",
"description": "Create a user selector field based on all components in the same group"
"description": "[Deprecated] Create a user selector field based on all components in the same group. This will be removed in Zarf v1.0.0."
},
"cosignKeyPath": {
"type": "string",
Expand Down

0 comments on commit 899bf8f

Please sign in to comment.