mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: add template toggle to disable module caching (#21931)
There exists use cases to disable the new module caching behavior of workspace builds. This was the legacy behavior.
This commit is contained in:
@@ -512,13 +512,15 @@ func (s *server) acquireProtoJob(ctx context.Context, job database.ProvisionerJo
|
||||
|
||||
// Fetch the file id of the cached module files if it exists.
|
||||
versionModulesFile := ""
|
||||
tfvals, err := s.Database.GetTemplateVersionTerraformValues(ctx, templateVersion.ID)
|
||||
if err != nil && !xerrors.Is(err, sql.ErrNoRows) {
|
||||
// Older templates (before dynamic parameters) will not have cached module files.
|
||||
return nil, failJob(fmt.Sprintf("get template version terraform values: %s", err))
|
||||
}
|
||||
if err == nil && tfvals.CachedModuleFiles.Valid {
|
||||
versionModulesFile = tfvals.CachedModuleFiles.UUID.String()
|
||||
if !template.DisableModuleCache {
|
||||
tfvals, err := s.Database.GetTemplateVersionTerraformValues(ctx, templateVersion.ID)
|
||||
if err != nil && !xerrors.Is(err, sql.ErrNoRows) {
|
||||
// Older templates (before dynamic parameters) will not have cached module files.
|
||||
return nil, failJob(fmt.Sprintf("get template version terraform values: %s", err))
|
||||
}
|
||||
if err == nil && tfvals.CachedModuleFiles.Valid {
|
||||
versionModulesFile = tfvals.CachedModuleFiles.UUID.String()
|
||||
}
|
||||
}
|
||||
|
||||
var ownerSSHPublicKey, ownerSSHPrivateKey string
|
||||
|
||||
Reference in New Issue
Block a user