mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
feat!: drop support for legacy parameters (#7663)
This commit is contained in:
@ -140,7 +140,7 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error {
|
||||
return xerrors.Errorf("initialize terraform: %w", err)
|
||||
}
|
||||
s.logger.Debug(ctx, "ran initialization")
|
||||
env, err := provisionEnv(config, request.GetPlan().GetParameterValues(), request.GetPlan().GetRichParameterValues(), request.GetPlan().GetGitAuthProviders())
|
||||
env, err := provisionEnv(config, request.GetPlan().GetRichParameterValues(), request.GetPlan().GetGitAuthProviders())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -193,23 +193,13 @@ func (s *server) Provision(stream proto.DRPCProvisioner_ProvisionStream) error {
|
||||
|
||||
func planVars(plan *proto.Provision_Plan) ([]string, error) {
|
||||
vars := []string{}
|
||||
for _, param := range plan.ParameterValues {
|
||||
switch param.DestinationScheme {
|
||||
case proto.ParameterDestination_ENVIRONMENT_VARIABLE:
|
||||
continue
|
||||
case proto.ParameterDestination_PROVISIONER_VARIABLE:
|
||||
vars = append(vars, fmt.Sprintf("%s=%s", param.Name, param.Value))
|
||||
default:
|
||||
return nil, xerrors.Errorf("unsupported parameter type %q for %q", param.DestinationScheme, param.Name)
|
||||
}
|
||||
}
|
||||
for _, variable := range plan.VariableValues {
|
||||
vars = append(vars, fmt.Sprintf("%s=%s", variable.Name, variable.Value))
|
||||
}
|
||||
return vars, nil
|
||||
}
|
||||
|
||||
func provisionEnv(config *proto.Provision_Config, params []*proto.ParameterValue, richParams []*proto.RichParameterValue, gitAuth []*proto.GitAuthProvider) ([]string, error) {
|
||||
func provisionEnv(config *proto.Provision_Config, richParams []*proto.RichParameterValue, gitAuth []*proto.GitAuthProvider) ([]string, error) {
|
||||
env := safeEnviron()
|
||||
env = append(env,
|
||||
"CODER_AGENT_URL="+config.Metadata.CoderUrl,
|
||||
@ -225,16 +215,6 @@ func provisionEnv(config *proto.Provision_Config, params []*proto.ParameterValue
|
||||
for key, value := range provisionersdk.AgentScriptEnv() {
|
||||
env = append(env, key+"="+value)
|
||||
}
|
||||
for _, param := range params {
|
||||
switch param.DestinationScheme {
|
||||
case proto.ParameterDestination_ENVIRONMENT_VARIABLE:
|
||||
env = append(env, fmt.Sprintf("%s=%s", param.Name, param.Value))
|
||||
case proto.ParameterDestination_PROVISIONER_VARIABLE:
|
||||
continue
|
||||
default:
|
||||
return nil, xerrors.Errorf("unsupported parameter type %q for %q", param.DestinationScheme, param.Name)
|
||||
}
|
||||
}
|
||||
for _, param := range richParams {
|
||||
env = append(env, provider.ParameterEnvironmentVariable(param.Name)+"="+param.Value)
|
||||
}
|
||||
|
Reference in New Issue
Block a user