MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / loadEnvironmentsForDeploy

Function loadEnvironmentsForDeploy

pkg/cmd/release/deploy/deploy.go:938–957  ·  view source on GitHub ↗
(octopus *octopusApiClient.Client, deployableEnvironmentIDs []string, nextDeployEnvironmentID string)

Source from the content-addressed store, hash-verified

936}
937
938func loadEnvironmentsForDeploy(octopus *octopusApiClient.Client, deployableEnvironmentIDs []string, nextDeployEnvironmentID string) ([]*environments.Environment, string, error) {
939 envResources, err := octopus.Environments.Get(environments.EnvironmentsQuery{IDs: deployableEnvironmentIDs})
940 if err != nil {
941 return nil, "", err
942 }
943 allEnvs, err := envResources.GetAllPages(octopus.Environments.GetClient())
944 if err != nil {
945 return nil, "", err
946 }
947
948 // match the next deploy environment
949 nextDeployEnvironmentName := ""
950 for _, e := range allEnvs {
951 if e.ID == nextDeployEnvironmentID {
952 nextDeployEnvironmentName = e.Name
953 break
954 }
955 }
956 return allEnvs, nextDeployEnvironmentName, nil
957}
958
959func selectDeploymentEnvironment(asker question.Asker, octopus *octopusApiClient.Client, deployableEnvironmentIDs []string, nextDeployEnvironmentID string) (*environments.Environment, error) {
960 allEnvs, nextDeployEnvironmentName, err := loadEnvironmentsForDeploy(octopus, deployableEnvironmentIDs, nextDeployEnvironmentID)

Callers 2

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected