Adding a new flag to the deploy command and the related new functionality in order to support the collecting of secrets and sending them to the backend#252
Conversation
|
|
||
| var jsonObject map[string]interface{} | ||
|
|
||
| err2 := json.Unmarshal([]byte(envValue), &jsonObject) |
There was a problem hiding this comment.
can you reuse err?
There was a problem hiding this comment.
I know that reusing the same err is not recommended- I will just change the names and make them more descriptive instead of a plain err2 :)
| Type typeOfValue | ||
| StringContent string | ||
| JSONContent interface{} | ||
| //ObjectContent map[string]interface{} |
There was a problem hiding this comment.
Remove this comment if not needed.
| } | ||
| } | ||
|
|
||
| func TestCollectFromEnvWhenDuplciateNames(t *testing.T) { |
commands/deploy_command.go
Outdated
| "encryptionKey": encryptionKey, | ||
| "keyId": keyID, | ||
| } | ||
| jsonBody, _ := json.Marshal(upsCredentials) |
There was a problem hiding this comment.
Why is the error from json.Marshal ignored here?
There was a problem hiding this comment.
Thanks for the suggestion :)
…lity in order to support the collecting of secrets and sending them to the backend LMCROSSITXSADEPLOY-2301
LMCROSSITXSADEPLOY-2301
LMCROSSITXSADEPLOY-2301
LMCROSSITXSADEPLOY-2301
77d8ac3 to
8922dd2
Compare
commands/deploy_command.go
Outdated
| upsCredentials := map[string]string{ | ||
| "encryptionKey": encryptionKey, | ||
| } | ||
| jsonBody, _ := json.Marshal(upsCredentials) |
There was a problem hiding this comment.
handle exception here
LMCROSSITXSADEPLOY-2301
| Guid string `json:"guid"` | ||
| Name string `json:"name"` | ||
| OfferingGuid string `jsonry:"relationships.service_offering.data.guid,omitempty"` | ||
| OfferingGuid string `jsonry:"rela tionships.service_offering.data.guid,omitempty"` |
| t.Setenv(nameOfEnv, valueOfEnv) | ||
| } | ||
|
|
||
| func TestCollectFromEnv(t *testing.T) { |
There was a problem hiding this comment.
This test checks too many behaviors (json, cert etc.). Consider splitting the different checks into smaller tests.
| yamlResult, err := BuildSecureExtension(parameters, "test-mta", "") | ||
|
|
||
| if err != nil { | ||
| t.Fatalf("Error while building the secure extension descriotor: %s", err.Error()) |
|
|
||
| getAppProcessStatsUrl := fmt.Sprintf("%s/%sapps/%s/processes/web/stats", apiEndpoint, cfBaseUrl, appGuid) | ||
| body, err := executeRequest(getAppProcessStatsUrl, token, c.isSslDisabled) | ||
| body, err := executeRequest("GET", getAppProcessStatsUrl, token, c.isSslDisabled, nil) |
There was a problem hiding this comment.
Use http.MethodGet instead of raw strings.
| var result []T | ||
| for url != "" { | ||
| body, err := executeRequest(url, token, isSslDisabled) | ||
| body, err := executeRequest("GET", url, token, isSslDisabled, nil) |
There was a problem hiding this comment.
Use http.MethodGet instead of raw strings.
| var result []T | ||
| for url != "" { | ||
| body, err := executeRequest(url, token, isSslDisabled) | ||
| body, err := executeRequest("GET", url, token, isSslDisabled, nil) |
There was a problem hiding this comment.
Use http.MethodGet instead of raw strings.
commands/deploy_command.go
Outdated
| return "__mta-secure-" + mtaId + "-" + namespace + "-" + resultSuffix, nil | ||
| } | ||
|
|
||
| func setUpSpecificsForDeploymentUsingSecrerts(flags *flag.FlagSet, c *DeployCommand, mtaId, namespace, schemaVersion string, disposableUserProvidedServiceName *string, yamlBytes *[]byte) ExecutionStatus { |
LMCROSSITXSADEPLOY-2301
LMCROSSITXSADEPLOY-2301
4e8cfb1
into
cloudfoundry:master
LMCROSSITXSADEPLOY-2301