mirror of
https://github.com/coder/coder.git
synced 2025-07-23 21:32:07 +00:00
Pass git configuration variables via terraform (#3034)
* Pass workspace owner email address to provisioner * Remove owner_email and owner_username fields from agent metadata * Add Git environment variables to example templates * Remove "owner_name" field from provisioner metadata, use username instead * Remove Git configuration from most templates, add documentation * Proofreading/typo fixes from @mafredri * Update example templates to latest version of terraform-provider-coder
This commit is contained in:
@ -56,8 +56,6 @@ type Options struct {
|
||||
|
||||
type Metadata struct {
|
||||
WireguardAddresses []netaddr.IPPrefix `json:"addresses"`
|
||||
OwnerEmail string `json:"owner_email"`
|
||||
OwnerUsername string `json:"owner_username"`
|
||||
EnvironmentVariables map[string]string `json:"environment_variables"`
|
||||
StartupScript string `json:"startup_script"`
|
||||
Directory string `json:"directory"`
|
||||
@ -386,12 +384,6 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
|
||||
// If using backslashes, it's unable to find the executable.
|
||||
unixExecutablePath := strings.ReplaceAll(executablePath, "\\", "/")
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_SSH_COMMAND=%s gitssh --`, unixExecutablePath))
|
||||
// These prevent the user from having to specify _anything_ to successfully commit.
|
||||
// Both author and committer must be set!
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_AUTHOR_EMAIL=%s`, metadata.OwnerEmail))
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_COMMITTER_EMAIL=%s`, metadata.OwnerEmail))
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_AUTHOR_NAME=%s`, metadata.OwnerUsername))
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_COMMITTER_NAME=%s`, metadata.OwnerUsername))
|
||||
|
||||
// Load environment variables passed via the agent.
|
||||
// These should override all variables we manually specify.
|
||||
|
Reference in New Issue
Block a user