Skip to content

Commit 3a8d12f

Browse files
MarioCadenasIsaac
andauthored
feat: hide deprecated AppKit plugins from apps init picker (#6834)
## Summary AppKit now emits `deprecated: true` on plugin entries in `appkit.plugins.json` ([AppKit PR #596](databricks/appkit#596)). This makes `databricks apps init` skip deprecated plugins in the "Select features" picker. Two changes in `libs/apps/manifest/manifest.go`: - Add `Deprecated bool` to the `Plugin` struct. - Exclude deprecated plugins in `GetSelectablePlugins()`. A deprecated plugin is then neither selectable nor mandatory, so it drops out of the picker entirely. ## Testing - Added `TestGetSelectablePluginsExcludesDeprecated` in `libs/apps/manifest`. - `go build ./...` - `go test ./libs/apps/... ./cmd/apps/...` This pull request and its description were written by Isaac. --------- Co-authored-by: MarioCadenas <MarioCadenas@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
1 parent db4f0ca commit 3a8d12f

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎libs/apps/manifest/manifest.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ type Plugin struct {
8585
// Stored as a plain string so unknown future values round-trip unchanged.
8686
// See https://github.com/databricks/appkit/pull/264.
8787
Stability string `json:"stability,omitempty"`
88+
89+
// Deprecated plugins are hidden from the init picker.
90+
// See https://github.com/databricks/appkit/pull/596.
91+
Deprecated bool `json:"deprecated,omitempty"`
8892
}
8993

9094
// StabilityLabel returns a user-facing tier label for non-GA plugins.
@@ -153,7 +157,7 @@ func (m *Manifest) GetPlugins() []Plugin {
153157
func (m *Manifest) GetSelectablePlugins() []Plugin {
154158
var selectable []Plugin
155159
for _, p := range m.GetPlugins() {
156-
if !p.RequiredByTemplate {
160+
if !p.RequiredByTemplate && !p.Deprecated {
157161
selectable = append(selectable, p)
158162
}
159163
}

‎libs/apps/manifest/manifest_test.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,24 @@ func TestGetSelectablePlugins(t *testing.T) {
169169
assert.Equal(t, "optional-plugin", selectable[1].Name)
170170
}
171171

172+
func TestGetSelectablePluginsExcludesDeprecated(t *testing.T) {
173+
m := &manifest.Manifest{
174+
Plugins: map[string]manifest.Plugin{
175+
"analytics": {
176+
Name: "analytics",
177+
},
178+
"legacy": {
179+
Name: "legacy",
180+
Deprecated: true,
181+
},
182+
},
183+
}
184+
185+
selectable := m.GetSelectablePlugins()
186+
require.Len(t, selectable, 1)
187+
assert.Equal(t, "analytics", selectable[0].Name)
188+
}
189+
172190
func TestGetMandatoryPlugins(t *testing.T) {
173191
m := &manifest.Manifest{
174192
Plugins: map[string]manifest.Plugin{

0 commit comments

Comments
 (0)