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

Allow pinning of templates to version via SHA/branch or tag (release) #573

Closed
alexellis opened this issue Dec 17, 2018 · 7 comments · Fixed by #576
Closed

Allow pinning of templates to version via SHA/branch or tag (release) #573

alexellis opened this issue Dec 17, 2018 · 7 comments · Fixed by #576

Comments

@alexellis
Copy link
Member

alexellis commented Dec 17, 2018

Expected Behaviour

I should be able to pin a template to a specific version via SHA/branch or tag (release) so that I can control my build pipeline and keep it reproducible.

Current Behaviour

I can clone and checkout a templates repo manually, but not via faas-cli template pull.

Possible Solution

faas-cli template pull https://cdn.com/repo.git#0.1.0

faas-cli template pull https://cdn.com/repo.git#dev

faas-cli template pull https://cdn.com/repo.git#d22af7cf74b7e24b37f46f8c60cb912751e93eab

If no # is given then the behaviour should default to the current functionality.

@alexellis
Copy link
Member Author

cc @LucasRoesler who wrote the original code

@LucasRoesler
Copy link
Member

dep uses this format with an @ instead of # dep ensure -add github.com/pkg/foo@^1.0.1

NPM also uses the same format. Should we also use that?

@alexellis
Copy link
Member Author

That works for me 👍

@alexellis
Copy link
Member Author

Not sure if we should try to support the full semantics though like ^0.1.0 etc

@LucasRoesler
Copy link
Member

I agree, we should start with only pinning specific names or shas

@alexellis
Copy link
Member Author

Sounds good to me

@LucasRoesler
Copy link
Member

@alexellis i ran into a small issue with using @ for the pinning. It is really hard to determine how to parse an ssh based url, e.g. ssh://user@host.xz/path/to/repo.git/ and ssh://user@host.xz/path/to/repo.git@feature/branch. I have the tests all setup and that is the one that keeps failing. This is mostly an issue because if we support branch names, then we can't easily distinguish between a branch or a host with path.

We could exclude ssh urls that do not include the username, ie require ssh://user@host.xz/path/to/repo.git or we could switch back to the # format, since # character isn't used throughout the rest of the url and is not even allowed in github urls (at least all of my attempts to clone a known repo with a url fragment added failed).

Or, perhaps someone might have a suggestion about how to distinguish ssh://user@host.xz/path/to/repo from ssh://host.xz/path/to/repo@feature/branch, so that the first is recognized as a repo url without a pin and the second as a pinned url.

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

Successfully merging a pull request may close this issue.

2 participants