Skip to content

Commit 186340b

Browse files
Deploying a release to an ephemeral environment will ignore the casing of the environment name and id (#561)
1 parent 4d95272 commit 186340b

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

pkg/cmd/release/deploy/deploy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,12 @@ func findEphemeralEnvironmentIDs(octopus *octopusApiClient.Client, space *spaces
641641

642642
envMap := make(map[string]*ephemeralenvironments.EphemeralEnvironment, len(allEphemeralEnvironments.Items)*2)
643643
for _, ephemeralEnv := range allEphemeralEnvironments.Items {
644-
envMap[ephemeralEnv.ID] = ephemeralEnv
645-
envMap[ephemeralEnv.Name] = ephemeralEnv
644+
envMap[strings.ToLower(ephemeralEnv.ID)] = ephemeralEnv
645+
envMap[strings.ToLower(ephemeralEnv.Name)] = ephemeralEnv
646646
}
647647

648648
for _, envIdentifier := range environments {
649-
ephemeralEnv, found := envMap[envIdentifier]
649+
ephemeralEnv, found := envMap[strings.ToLower(envIdentifier)]
650650
if !found {
651651
return nil, fmt.Errorf("environment '%s' not found in ephemeral environments", envIdentifier)
652652
}

pkg/cmd/release/deploy/deploy_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,6 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
401401
},
402402
})
403403

404-
// doesn't lookup the progression or env names because it already has them
405-
406404
// now it's going to go looking for prompted variables; we don't have any prompted variables here so it skips
407405
api.ExpectRequest(t, "GET", "/api/Spaces-1/variables/"+variableSnapshotNoVars.ID).RespondWith(&variableSnapshotNoVars)
408406

@@ -445,7 +443,7 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
445443
options := &executor.TaskOptionsDeployRelease{
446444
ProjectName: "fire project",
447445
ReleaseVersion: "2.1",
448-
Environments: []string{"Ephemeral Environment"},
446+
Environments: []string{"ephemeral environment"},
449447
}
450448

451449
errReceiver := testutil.GoBegin(func() error {
@@ -483,7 +481,7 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
483481
assert.Equal(t, heredoc.Doc(`
484482
Project Fire Project
485483
Release 2.1
486-
Environments Ephemeral Environment
484+
Environments ephemeral environment
487485
`), stdout.String())
488486
stdout.Reset()
489487

@@ -511,7 +509,7 @@ func TestDeployCreate_AskQuestions(t *testing.T) {
511509
assert.Equal(t, &executor.TaskOptionsDeployRelease{
512510
ProjectName: "Fire Project",
513511
ReleaseVersion: "2.1",
514-
Environments: []string{"Ephemeral Environment"},
512+
Environments: []string{"ephemeral environment"},
515513
GuidedFailureMode: "",
516514
Variables: make(map[string]string, 0),
517515
ReleaseID: release21.ID,

0 commit comments

Comments
 (0)