Skip to content

Commit

Permalink
implement cli part, testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tommartensen committed Jan 8, 2024
1 parent e6b377f commit 74ff487
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chart/infra-server/static/flavors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@
value: "true"
kind: optional
help: |
Run as ROSA HCP? Setting this to `false` will create a
Run as ROSA HCP? Setting this to `false` will create a
ROSA Classic cluster instead of HCP/Hypershift.
- name: subnet-ids
Expand All @@ -833,7 +833,7 @@
kind: optional
help: |
Set like "public_subnet,private_subnet"
It will be placed in the command like `rosa create cluster --subnet-ids $SUBNET_IDS`
It will be placed in the command like `rosa create cluster --subnet-ids $SUBNET_IDS`
Set empty for the installer to create a new empty vpc and subnets.
- name: rosa-args
Expand Down Expand Up @@ -992,6 +992,9 @@
name: Test Connect Artifact
description: Test Connect Artifact
availability: stable
aliases:
- test-alias-1
- test-alias-2
workflow: configuration/test-connect-artifact.yaml
parameters:
- name: name
Expand Down
1 change: 1 addition & 0 deletions cmd/infractl/flavor/get/fancy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func (p prettyFlavor) PrettyPrint(cmd *cobra.Command) {
cmd.Printf("Name: %s\n", p.Name)
cmd.Printf("Description: %s\n", p.Description)
cmd.Printf("Availability: %s\n", p.Availability)
cmd.Printf("Aliases: %s\n", p.Aliases)

// Skip printing header/newlines if there are no parameters.
if len(p.Parameters) == 0 {
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ type FlavorConfig struct {

// WorkflowFile is the filename of an Argo workflow definition.
WorkflowFile string `json:"workflow"`

// Aliases are alternative IDs of the flavor.
Aliases []string `json:"aliases"`
}

// parameter represents a single parameter that is needed to launch a flavor.
Expand Down
1 change: 1 addition & 0 deletions flavor/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func NewFromConfig(filename string) (*Registry, error) {
Availability: v1.FlavorAvailability(availability),
Parameters: parameters,
Artifacts: artifacts,
Aliases: flavorCfg.Aliases,
}

// Parse the references Argo workflow file.
Expand Down
13 changes: 13 additions & 0 deletions flavor/workflow_templates.bats
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ setup_file() {
assert_equal "$order" "7"
}

# Aliases
@test "can find flavor via alias" {
flavor="$(infractl flavor get test-alias-1 --json)"
assert_success
name="$(echo "$flavor" | jq -r '.Name')"
assert_equal "$name" "test-connect-artifact"
}

@test "errors if no flavor can be found via alias" {
flavor="$(infractl flavor get test-alias-not-set --json)"
assert_failure
}

infractl() {
bin/infractl -e localhost:8443 -k "$@"
}
Expand Down

0 comments on commit 74ff487

Please sign in to comment.