(ctx context.Context, env string, vars map[string]string, repo drivers.RepoStore)
| 344 | } |
| 345 | |
| 346 | func writeEnv(ctx context.Context, env string, vars map[string]string, repo drivers.RepoStore) error { |
| 347 | var path string |
| 348 | if env == "" { |
| 349 | path = ".env" |
| 350 | } else { |
| 351 | path = fmt.Sprintf(".%s.env", env) |
| 352 | } |
| 353 | contents, err := godotenv.Marshal(vars) |
| 354 | if err != nil { |
| 355 | return fmt.Errorf("failed to marshal env vars: %w", err) |
| 356 | } |
| 357 | err = repo.Put(ctx, path, strings.NewReader(contents)) |
| 358 | if err != nil { |
| 359 | return fmt.Errorf("failed to write %q: %w", path, err) |
| 360 | } |
| 361 | _, err = gitutil.EnsureGitignoreHas(ctx, repo, path) |
| 362 | if err != nil { |
| 363 | return fmt.Errorf("failed to update .gitignore for %q: %w", path, err) |
| 364 | } |
| 365 | return nil |
| 366 | } |
| 367 | |
| 368 | func instanceAnnotationsToAttribs(instance *drivers.Instance) []attribute.KeyValue { |
| 369 | attrs := make([]attribute.KeyValue, 0, len(instance.Annotations)+2) |
no test coverage detected