diff --git a/dashboard/builder/env.go b/dashboard/builder/env.go index b97db998..199e4e6d 100644 --- a/dashboard/builder/env.go +++ b/dashboard/builder/env.go @@ -125,8 +125,12 @@ func (env *goEnv) setup(repo *Repo, workpath, hash string, envv []string) (strin if err := repo.Export(goworkpath, hash); err != nil { return "", fmt.Errorf("error exporting repository: %s", err) } - if err := ioutil.WriteFile(filepath.Join(goworkpath, "VERSION"), []byte(hash), 0644); err != nil { - return "", fmt.Errorf("error writing VERSION file: %s", err) + // Write out VERSION file if it does not already exist. + vFile := filepath.Join(goworkpath, "VERSION") + if _, err := os.Stat(vFile); os.IsNotExist(err) { + if err := ioutil.WriteFile(vFile, []byte(hash), 0644); err != nil { + return "", fmt.Errorf("error writing VERSION file: %s", err) + } } return filepath.Join(goworkpath, "src"), nil }