heroku / heroku-slugs

CLI Plugin to manage downloading of slugs
38 stars 9 forks source link

Add command to retrieve URL from which to download slug #11

Closed Photonios closed 6 years ago

dmathieu commented 6 years ago

Could you tell us a bit more about the use case for this new command? Also, could you extract the no-extract (pun intended) into a new PR so we can review both changes independently?

Photonios commented 6 years ago

One of the use cases is testing the app in a Docker container. Instead of installing the Heroku CLI into the container and then using it to download the slug, one can grab the URL outside the container and pass it into the container through an ARG or ENV variable.

Sure, I'll split them.

EDIT: I split it into 3 separate PR's.

dmathieu commented 6 years ago

Why event the need for a cli command then? It's just a proxy for something 'curl -n' and jq can do in a one-liner.

Photonios commented 6 years ago

That is true. However, the same argument could be made for this entire plugin, some curl and jq magic and you can replicate the functionality provided by this plugin. But that doesn't mean it isn't useful under certain circumstances.

It also does a bit more than just that. This is very convenient to quickly retrieve the URL for the last release:

heroku slugs:url -a myapp

Doing that with curl and jq would require first making a request to /apps/$APP/releases to get the last release and then pipe that output to another request to /apps/$APP/slugs/$RELEASE.

It's a short cut yes, but a useful one in my opinion. It's up to you of course :-)

dmathieu commented 6 years ago

How about adding a slugs:info command which would retrieve a specific, or the latest slug. That command can then have a --json argument to provide the output as json instead of text. We already do that with a bunch of other commands. eg: apps:info.

Then we wouldn't introduce a command just for retrieving a single attribute, and you would still be able to inject a slug into a container.

Photonios commented 6 years ago

That makes sense. Good observation. I'll get to work :-)

dmathieu commented 6 years ago

Closing this PR. @Photonios, we may come back to the suggested solution later. If you want to set it up before we can do it, feel free to do so.