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

Function updateProjectVariableValueV1

pkg/cmd/tenant/variables/update/update.go:1000–1024  ·  view source on GitHub ↗
(opts *UpdateOptions, vars *variables.TenantVariables, environmentMap map[string]string)

Source from the content-addressed store, hash-verified

998}
999
1000func updateProjectVariableValueV1(opts *UpdateOptions, vars *variables.TenantVariables, environmentMap map[string]string) (bool, error) {
1001 var environmentId string
1002 for id, environment := range environmentMap {
1003 if strings.EqualFold(environment, opts.Environments.Value[0]) || strings.EqualFold(id, opts.Environments.Value[0]) {
1004 environmentId = id
1005 }
1006 }
1007 for _, v := range vars.ProjectVariables {
1008 if strings.EqualFold(v.ProjectName, opts.Project.Value) {
1009 t, err := findTemplate(v.Templates, opts.Name.Value)
1010 if err != nil {
1011 return false, err
1012 }
1013 value, err := convertValue(opts, t)
1014 if err != nil {
1015 return false, err
1016 }
1017 v.Variables[environmentId][t.ID] = *value
1018
1019 return value.IsSensitive, nil
1020 }
1021 }
1022
1023 return false, fmt.Errorf("unable to find requested variable")
1024}
1025
1026func updateCommonVariableValueV1(opts *UpdateOptions, vars *variables.TenantVariables) (bool, error) {
1027 for _, v := range vars.LibraryVariables {

Callers 1

updateRunV1Function · 0.85

Calls 2

findTemplateFunction · 0.85
convertValueFunction · 0.85

Tested by

no test coverage detected