mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
Return template parameters in consistent order (#2975)
* return parameters from Terraform provisioner in sorted order * persist parameter indices in database and return them in correct order from API * don't re-sort parameters by name when creating templates
This commit is contained in:
@ -1027,6 +1027,9 @@ func (q *fakeQuerier) GetParameterSchemasByJobID(_ context.Context, jobID uuid.U
|
||||
if len(parameters) == 0 {
|
||||
return nil, sql.ErrNoRows
|
||||
}
|
||||
sort.Slice(parameters, func(i, j int) bool {
|
||||
return parameters[i].Index < parameters[j].Index
|
||||
})
|
||||
return parameters, nil
|
||||
}
|
||||
|
||||
@ -1555,6 +1558,7 @@ func (q *fakeQuerier) InsertParameterSchema(_ context.Context, arg database.Inse
|
||||
ValidationCondition: arg.ValidationCondition,
|
||||
ValidationTypeSystem: arg.ValidationTypeSystem,
|
||||
ValidationValueType: arg.ValidationValueType,
|
||||
Index: arg.Index,
|
||||
}
|
||||
q.parameterSchemas = append(q.parameterSchemas, param)
|
||||
return param, nil
|
||||
|
Reference in New Issue
Block a user