netlify / netlifyctl

MIT License
176 stars 34 forks source link

Add support for performing a branch deploy/deploy preview from the CLI #121

Closed jamietanna closed 5 years ago

jamietanna commented 6 years ago

It'd be great to have, as part of CI, a step within the config that's able to run a deploy, instead of going via the Netlify webhook

NullVoxPopuli commented 6 years ago

I'd be a fan. I use gitlab ci for... ci/pipelines, and being able to enable brach/preview deploys would be amazing.

also, how long do those stick around?

lubo commented 6 years ago

We @devinsolutions miss this feature a lot. We deploy several production websites to Netlify, but we use different services (e.g. Google App Engine) for preview deployments because we insist on using our own CI.

calavera commented 6 years ago

Unfortunately, this is not an easy task, although not impossible. The main problem would be to ensure all data required to perform those deploys is present when deploying from a CLI. Deploy Previews for example depend on having a pull request open, and without it, we'd break several assumptions in our API. Branch deploys might be slightly less involved, but they would still require some consideration.

l've opened a ticket in our internal product repository to discuss this feature, but I'm unsure if/when we will implement it.

refextu commented 6 years ago

Our use-case: We would like to run an automated test-runner on base of the just build branch. So we have to options:

  1. Build and Deploy and Test with gitlab-ci. (Which requires this feature)
  2. Build and Deploy with Netlify and then trigger a Test at gitlab-ci. (webhooks seems to not work as expected.)
NullVoxPopuli commented 6 years ago

@calavera couldn't there be an API to hit at netlify that just requires a branch name and PR link/number? or what if we just want to upload a zip of files? (I build my project for production on gitlab's C.I. and then just upload the built files)

thundernixon commented 5 years ago

Just adding to this with my current scenario...

I am making a group portfolio site for a graduating design class. I am making a site with GatsbyJS, which creates image thumbnails on build. This site has many fairly-large images, so it must sometimes be deployed with the CLI if there are updates that the cache isn't being cycled from (say, new images under the same name as old ones). Small updates tend to work okay, because I'm using gatsby-plugin-netlify-cache. This works fine, but only so long as the master branch is the one being deployed to the prod URL, so that I can deploy from the CLI if there is any issue updating the cache.

This leads to my current issue: I have now deployed a "coming soon" countdown to the main URL and put the master behind a branch deploy. Unfortunately, this means I can't find a way to deploy the master from the CLI to its branch URL. I can only deploy either a preview or to --prod. Unfortunately, deploying to --prod puts the work-in-progress master branch onto the public URL.

This is a bit of a complex issue and maybe an edge case, but I hope it shows a scenario in which an option like netlify deploy --branch would be useful.

rybit commented 5 years ago

Hey @thundernixon (and well others on this thread too I guess). I'd recommend putting your issues on the https://github.com/netlify/cli project. It has eclipsed this project and this project is going into maintenance mode.

thundernixon commented 5 years ago

@rybit thanks so much for letting me know! Will do.

thundernixon commented 5 years ago

It seems like https://github.com/netlify/cli/issues/275 is a continuation of this issue, on the current repo.

jamietanna commented 5 years ago

@sw-yx if netlify/cli#275 has this implemented will it also be ported to this project if this issue is not open?

swyxio commented 5 years ago

i wont make any promises about that, this project is in maintenance and we won't be porting things as far as I know. i dont even have a timeline for fixing https://github.com/netlify/cli/issues/275 much less porting a fix. of course, community forks are welcome.

jamietanna commented 5 years ago

Interesting - I thought this project was the future for CLI interactions with Netlify, not vice versa. Thanks for clarification!

swyxio commented 5 years ago

yeah. here's more information about our iteration from js to go back to js: https://www.netlify.com/blog/2018/09/10/netlify-cli-2.0-now-in-beta-/#our-cli-journey