feat: add config (ConfigMap) CLI commands#678
Conversation
📝 Changelog previewBelow is a preview of the Changelog that will be added to the next release. Only commit messages that follow the Conventional Commits specification will be included in the Changelog. v5.18.0 - 2026-03-19Full Changelog: v5.17.0...v5.18.0 🚀 Features
🐛 Bug Fixes
⚙️ Miscellaneous Changes |
There was a problem hiding this comment.
Pull request overview
Adds a new nais configs command group to manage ConfigMaps via the Nais GraphQL API, following the existing “secrets” command structure while regenerating schema/genqlient types to include config and credential-related additions.
Changes:
- Introduces
internal/configAPI client + formatting helpers (CRUD value ops + activity log support). - Adds
internal/config/commandwithlist/get/create/delete/set/unset/activitysubcommands and flags/autocomplete behavior. - Updates GraphQL schema and genqlient operation config, and wires the new command into the CLI root.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| schema.graphql | Regenerated schema to include Config types/mutations and some activity log enum/resource updates. |
| genqlient.yaml | Includes internal/config/**/*.go in genqlient operations. |
| internal/application/application.go | Registers the new configs command group in the CLI. |
| internal/config/config.go | Implements config GraphQL queries/mutations, formatting helpers, and LastModified rendering/JSON. |
| internal/config/config_test.go | Unit tests for formatting helpers and LastModified. |
| internal/config/activity.go | Implements config activity log fetching + mapping into CLI output models. |
| internal/config/activity_test.go | Unit tests for activity log mapping/filtering behavior. |
| internal/config/command/command.go | Adds configs command group and shared arg/metadata/autocomplete helpers. |
| internal/config/command/list.go | Implements nais configs list table/JSON output and environment filtering. |
| internal/config/command/list_test.go | Unit tests for list summarization helper. |
| internal/config/command/get.go | Implements nais configs get with environment resolution and table/JSON output. |
| internal/config/command/create.go | Implements nais configs create. |
| internal/config/command/delete.go | Implements nais configs delete with confirmation flow. |
| internal/config/command/set.go | Implements nais configs set with direct value or stdin input support. |
| internal/config/command/unset.go | Implements nais configs unset with confirmation flow. |
| internal/config/command/activity.go | Implements nais configs activity with filters and output formatting. |
| internal/config/command/environment.go | Environment resolution + CLI --environment occurrence handling helpers. |
| internal/config/command/environment_test.go | Unit tests for environment selection logic. |
| internal/config/command/flag/flag.go | Defines flags and autocomplete behavior for the new command group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Adds first-class ConfigMap (“config”) support to the CLI by introducing a new config-focused client package and a full set of CLI subcommands, alongside regenerated GraphQL schema/types to support the new API.
Changes:
- Regenerates
schema.graphqland genqlient operations/types to include Config and credentials-related GraphQL API surface. - Introduces
internal/config(API client + formatting + activity) andinternal/config/command/*(list/get/create/delete/set/unset/activity). - Updates a few secret command autocomplete messages and registers the new config command in the application command set.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| schema.graphql | Regenerated schema adding Config/ConfigValue CRUD + activity types/resource types and credentials types/mutations. |
| internal/secret/command/flag/flag.go | Updates missing-team autocomplete guidance text. |
| internal/secret/command/command.go | Updates missing-team autocomplete guidance text. |
| internal/secret/command/activity.go | Updates missing-team autocomplete guidance text. |
| internal/config/config.go | New Config API client + helpers + table/JSON formatting. |
| internal/config/config_test.go | Unit tests for formatting and LastModified rendering/JSON. |
| internal/config/activity.go | New Config activity query + transformation logic. |
| internal/config/activity_test.go | Unit tests for activity transformation logic. |
| internal/config/command/command.go | New top-level command wiring for config CRUD + helpers/autocomplete. |
| internal/config/command/*.go | Implements list/get/create/delete/set/unset/activity CLI subcommands. |
| internal/config/command/*_test.go | Unit tests for env selection and list summarization. |
| internal/config/command/flag/flag.go | Flags + autocomplete support for config commands. |
| internal/application/application.go | Registers the new config command in the root CLI. |
| genqlient.yaml | Adds internal/config/**/*.go to genqlient operations scanning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add full ConfigMap management support via 'nais configs' command with subcommands: list, get, create, delete, set, unset, and activity. Follows the existing secret implementation pattern but simplified — config values are not sensitive, so no --with-values/--reason flags or RBAC elevation is needed.
- Rename CLI command from 'configs' to 'config' for consistency with Console UI - Add missing sort.SliceStable in buildConfigActivity (newest-first, matching secrets) - Update stale 'nais config set team' references to 'nais defaults set team' in both config and secret packages
Summary
configcommand group with full CRUD support for ConfigMaps:list,get,create,delete,set,unset, andactivity--with-values/--reasonflags (ConfigMap values are not sensitive)Commands
nais config listnais config getnais config createnais config deletenais config setnais config unsetnais config activityNotes
config(singular) — consistent with Console UI naming. The naistrix framework's built-inconfigcommand was renamed todefaultsin naistrix v0.22.1, freeing the name.'nais config set team'references to'nais defaults set team'in both config and secret packages.