Skip to content

Conversation

@grace-rehn
Copy link
Contributor

@grace-rehn grace-rehn commented Oct 3, 2025

Extends tag sets to include environment tagging and update prompting to handle new tag set scopes and types.

[sc-122530]

Added new environment tag command

Manage environments in Octopus Deploy

USAGE
 octopus environment <command> [flags]

CORE COMMANDS
 create:      Create an environment
 delete:      Delete an environment
 list:        List environments
 tag:         Override tags for an environment

INHERITED FLAGS
 -h, --help                   Show help for a command
     --no-prompt              Disable prompting in interactive mode
 -f, --output-format string   Specify the output format for a command ("json", "table", or "basic") (default "table")
 -s, --space string           Specify the space for operations

EXAMPLE
 $ octopus environment list
 $ octopus environment ls

Updated tenant create, tenant tag, environment create and environment tag prompting

Prompt for free text tags

 Both Scopes (Free Text) [current: This is my free text] [? for help] 

Prompt for multi select tags

? Environment Set  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
> [ ]  Environment Set/Critical
  [x]  Environment Set/Production

Prompt for single select tags

? Production (Single Select)  [Use arrows to move, type to filter]
  (None)
> Production/Prod
  Production/Non-prod

Tag type validation

only one tag can be specified for single-select tag set 'Production', but found: [Production/Non-prod Production/Prod]
only one tag can be specified for free text tag set 'Both Scopes', but found: [Both Scopes/54321 Both Scopes/12345]

@grace-rehn grace-rehn requested a review from a team October 6, 2025 22:47
@grace-rehn
Copy link
Contributor Author

grace-rehn commented Oct 8, 2025

Updates

Added feedback if there is only 1 tenant/environment:

Selecting only available environment '{environment name}'.

./octopus environment tag
? You have not specified a Space. Please select one: Test
Selecting only available environment 'TEST ENV'.
? Tag Set (Single Select) Tag Set/123

Successfully updated environment TEST ENV (Environments-61).

Automation Commands:
octopus environment tag --environment 'TEST ENV' --tag 'Tag Set/123' --no-prompt

Added validation:

If the tag set is not scoped to the given resource

./octopus tenant create  --space 'Test' --name 'New Tenant' --tag 'Tag Set/123' --no-prompt

tag 'Tag Set/123' does not belong to any tag set available for this resource

If the tag is not in tag set

 ./octopus environment create  --space 'Test' --name 'New Environment' --tag 'Tag Set/999' --no-prompt

tag 'Tag Set/999' does not exist in tag set 'Tag Set'

@grace-rehn grace-rehn requested a review from hnrkndrssn October 8, 2025 03:03
Copy link
Contributor

@hnrkndrssn hnrkndrssn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 tested locally and the couple of things I picked up yesterday is now working as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants