crisward / dokku-clone

a dokku plugin for building an app from a cloned git repo
48 stars 9 forks source link

Allow cloning of repositories at specific commits #23

Open ltalirz opened 3 years ago

ltalirz commented 3 years ago

Some git repositories don't use tags (for example all of heroku's getting started apps), i.e. in order to do reproducible clones you would like to be able to point to a specific commit via its SHA1 hash.

crisward commented 3 years ago

This plugin works by cloning the repo into a temp directory, then pushing it to dokku. So shouldn't be a big deal to update this to allow a hash, however not sure the best syntax for that as the third parameter is already being used for tags & branches. If this isn't a common issue, you could fork the repo you wanted at that commit, and use that.

Or if you want to suggest a nifty commit syntax I'd consider a pull request.

ltalirz commented 3 years ago

What about the approach taken by the ansible git module (see the documentation of the version and refspec parameters): https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html

In essence, the version parameter can be used for branches, tags and sha1 hashes alike.

The refspec parameter is needed only when specifying sha1 hashes that are not reachable by any branch or tag, which is not a use case I have ever encountered. In my view it is fine not to support it until a use case arises.

ltalirz commented 3 years ago

What about the approach taken by the ansible git module (see the documentation of the version and refspec parameters): https://docs.ansible.com/ansible/latest/collections/ansible/builtin/git_module.html

In essence, the version parameter can be used for branches, tags and sha1 hashes alike.

This also seems to be the approach taken by @josegonzalez in the new git:sync feature of dokku 0.23 https://github.com/dokku/dokku/pull/4297

Does this new feature basically replace the dokku-clone plugin?

josegonzalez commented 3 years ago

@ltalirz that was the idea.