Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add export in createapp.env #3518

Merged
merged 1 commit into from
Apr 17, 2024
Merged

add export in createapp.env #3518

merged 1 commit into from
Apr 17, 2024

Conversation

bitoku
Copy link
Collaborator

@bitoku bitoku commented Apr 11, 2024

Which issue this PR addresses:

N/A

What this PR does / why we need it:

The doc says we need to run source clusterapp.env but it doesn't work because clusterapp.env doesn't have export with each env, and the env variables aren't passed to hack/cluster create.

Test plan for issue:

Test it locally

Is there any documentation that needs to be updated for this PR?

N/A
Change the code according to the doc.

How do you know this will function as expected in production?

Copy link

@AldoFusterTurpin AldoFusterTurpin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks. I left an optional simple suggestion to improve the readability as that line is really long

@@ -152,7 +152,7 @@ func (c *Cluster) CreateApp(ctx context.Context, clusterName string) error {
return err
}

return os.WriteFile("clusterapp.env", []byte(fmt.Sprintf("AZURE_CLUSTER_SERVICE_PRINCIPAL_ID=%s\nAZURE_CLUSTER_APP_ID=%s\nAZURE_CLUSTER_APP_SECRET=%s", spID, appID, appSecret)), 0o600)
return os.WriteFile("clusterapp.env", []byte(fmt.Sprintf("export AZURE_CLUSTER_SERVICE_PRINCIPAL_ID=%s\nexport AZURE_CLUSTER_APP_ID=%s\nexport AZURE_CLUSTER_APP_SECRET=%s", spID, appID, appSecret)), 0o600)
Copy link

@AldoFusterTurpin AldoFusterTurpin Apr 12, 2024

Choose a reason for hiding this comment

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

Now that we are touching this line, it could be a good idea to make a small change and replace this single line with something easier to read (the current line is long and contains multiple parentheses). We could have something like:

content := fmt.Sprintf("export AZURE_CLUSTER_SERVICE_PRINCIPAL_ID=%s\nexport AZURE_CLUSTER_APP_ID=%s\nexport AZURE_CLUSTER_APP_SECRET=%s", spID, appID, appSecret)
contentBytes := []byte(content)
return os.WriteFile("clusterapp.env", contentBytes, 0o600)

@tiguelu
Copy link
Contributor

tiguelu commented Apr 12, 2024

/azp run ci

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@hawkowl hawkowl merged commit d6fc9fc into master Apr 17, 2024
18 checks passed
@hawkowl hawkowl deleted the fix-createapp branch April 17, 2024 01:39
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.

4 participants