Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support remote (infra) templates #4

Open
doshitan opened this issue Nov 12, 2024 · 1 comment
Open

Support remote (infra) templates #4

doshitan opened this issue Nov 12, 2024 · 1 comment

Comments

@doshitan
Copy link
Contributor

doshitan commented Nov 12, 2024

Copier natively supports this and our CLI help for --template-uri in nava-platform infra commands indicate you can use a URL, but you can not. Currently the infra template must be a local path.

Most projects should probably reference a remote copy ultimately (to avoid needing to maintain a local copy of every template and conflicting local paths saved to the answers file).

With recent work to switch the include/exclude logic to a custom worker/src path based/more statically defined, the only remaining bits in InfraTemplate that depend having a local git copy are the version/short_version properties, which shouldn't be needed for typical install/update processes. So should be able to just remove:

git_project = git.GitProject.from_existing(template_dir)
if git_project is None:
raise ValueError("Infra template must be a git working directory")

But more of a question about when we are ready to commit to supporting remote URLs from a product perspective.

This might present some issues for anyone running the tool under docker (and wanting to use ssh/git URLs instead of HTTP ones).

Couple different approaches:

  1. Avoid ever interacting with git for a template outside of copier itself (maybe not realistic long-term, but possibly viable for a while)
  2. Use copier's local checkout logic (or re-implement ourselves) within our template code to do the git interactions we need before passing to copier (we probably can't pass the temporary checkout to copier to use directly as that would get saved to the answers file, so would have to let copier copy the remote again?)
@doshitan doshitan changed the title Support remote templates Support remote (infra) templates Nov 12, 2024
@doshitan
Copy link
Contributor Author

Initial work complete in 18a1bf7 and 5e2759e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant