semaphoreci / cli

Semaphore 2.0 Command Line Interface
Apache License 2.0
25 stars 13 forks source link

feat: add support for agent type name settings #224

Closed lucaspin closed 7 months ago

lucaspin commented 7 months ago

This pull request adds a spec field to the agent type model. For now, the spec will only contain an agent_name_settings field, with the following properties:

Here's an example of an agent type with assignment_origin_agent:

apiVersion: v1alpha
kind: SelfHostedAgentType
metadata:
  name: s1-testing
  create_time: 1700679079
  update_time: 1700679079
spec:
  agent_name_settings:
    assignment_origin: assignment_origin_agent
    release_after: 0

And here's an example of a assignment_origin_aws_sts agent type:

apiVersion: v1alpha
kind: SelfHostedAgentType
metadata:
  name: s1-aws-only
  create_time: 1699034152
  update_time: 1699038879
spec:
  agent_name_settings:
    assignment_origin: assignment_origin_aws_sts
    aws:
      account_id: "1234567890"
      role_name_patterns: role1,role2
    release_after: 0

Changes in commands

  1. The create command changed to include four new flags:
      --aws-account-id string           required if -o AWS_STS is used; AWS account ID to allow registrations
      --aws-roles string                required if -o AWS_STS is used; comma-separated list of AWS role names
  -o, --name-assignment-origin string   from where agents will get their names when they register. Possible values: [assignment_origin_agent, assignment_origin_aws_sts] (default "assignment_origin_agent")
  -r, --release-name-after int          how long to hold the agent name after disconnection, in seconds; if not specified, 0 is used.
  1. Support for the SelfHostedAgentType type was added to the apply command.
  2. The get command command was updated to reflect the changes in the agent type model.