Skip to content

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

Merged
IvanBorislavovDimitrov merged 7 commits intocloudfoundry:masterfrom
karrgov:passing_secrets_during_deployment_new
Feb 20, 2026
Merged

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
IvanBorislavovDimitrov merged 7 commits intocloudfoundry:masterfrom
karrgov:passing_secrets_during_deployment_new

Conversation

@karrgov
Copy link
Contributor

@karrgov karrgov commented Dec 19, 2025

LMCROSSITXSADEPLOY-2301


var jsonObject map[string]interface{}

err2 := json.Unmarshal([]byte(envValue), &jsonObject)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you reuse err?

Copy link
Contributor Author

@karrgov karrgov Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment if not needed.

}
}

func TestCollectFromEnvWhenDuplciateNames(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo

"encryptionKey": encryptionKey,
"keyId": keyID,
}
jsonBody, _ := json.Marshal(upsCredentials)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the error from json.Marshal ignored here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@karrgov karrgov force-pushed the passing_secrets_during_deployment_new branch from 77d8ac3 to 8922dd2 Compare February 2, 2026 18:40
upsCredentials := map[string]string{
"encryptionKey": encryptionKey,
}
jsonBody, _ := json.Marshal(upsCredentials)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handle exception here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

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"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this space typo.

t.Setenv(nameOfEnv, valueOfEnv)
}

func TestCollectFromEnv(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo in descriptor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, fixed :)


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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use http.MethodGet instead of raw strings.

return "__mta-secure-" + mtaId + "-" + namespace + "-" + resultSuffix, nil
}

func setUpSpecificsForDeploymentUsingSecrerts(flags *flag.FlagSet, c *DeployCommand, mtaId, namespace, schemaVersion string, disposableUserProvidedServiceName *string, yamlBytes *[]byte) ExecutionStatus {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo

LMCROSSITXSADEPLOY-2301
@IvanBorislavovDimitrov IvanBorislavovDimitrov merged commit 4e8cfb1 into cloudfoundry:master Feb 20, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments