Skip to content

Clean up deployer temporary directories when no envrc was written #322

Open

Description

@coderabbitai

Summary

Track temporary-directory retention separately from the configured envrc path.

Deployer.New() creates a temporary directory for each invocation. Deployer.Cleanup() currently retains that directory whenever envrc output is configured, even if the invocation never successfully writes an envrc. This can leave unused temporary directories after deployments without Central, failed deployments, failed envrc writes, or teardown when the loaded configuration includes roxie.envrc.

Requested by @mclasmeier as a follow-up outside the scope of PR #320. The requester identified the underlying cleanup issue as pre-existing.

Required changes

Affected area: internal/deployer/deployer.go, particularly Deployer.Cleanup(), Deployer.deployCentral(), and Deployer.writeEnvrcFile().

  • Track whether this deployer instance successfully wrote an envrc.
  • Retain its temporary directory only after a successful envrc write, because the envrc can reference temporary CA certificate files.
  • Otherwise remove the temporary directory during cleanup, regardless of whether an envrc path is configured.
  • Add regression coverage for successful writes, failed writes, and invocations that do not write an envrc.

Acceptance criteria

  • A successful envrc write preserves the temporary files needed by that envrc.
  • A configured envrc path alone does not prevent cleanup.
  • Failed envrc writes and deployments that fail before writing an envrc do not retain unused temporary directories.
  • Teardown and deployments without Central clean up their newly created temporary directories when no envrc is written.
  • Cleanup remains safe when the temporary-directory path is empty.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions