Git Product home page Git Product logo

now-pipeline's Introduction

now-pipeline

Single CI command to deploy new code to Zeit Now Includes e2e tests and the alias switch

NPM

Build status semantic-release js-standard-style

What and why

I am super excited about Zeit Now tool; this is the "missing CI tool" for it. A single command now-pipeline

  • deploys new version
  • tests it
  • switches alias to the new deployment
  • takes down the old deployment

Should be enough to automatically update the server or service running in the cloud without breaking anything.

Install and use

npm i -g now-pipeline

Set NOW_TOKEN CI environment variable with a token that you can get from Zeit account page

Add CI command to now-pipeline. By default it will execute npm test and will pass the deployed url as NOW_URL environment variable. You can customize everything.

Example

Simple Travis commands

script:
  # after unit tests
  - npm i -g now-pipeline
  - now-pipeline

Prune existing deploys (if they do not have an alias) and show the deploy.

script:
  - npm i -g now-pipeline
  - now-pipeline-prune
  - now-pipeline
  - now-pipeline-list

Set domain alias if there is no existing one

script:
  - npm i -g now-pipeline
  - now-pipeline --alias foo.domain.com

Pass test command and name of the environment variable for deployed url

script:
  - npm i -g now-pipeline
  - now-pipeline --as HOST --test "npm run e2e"

Example projects

Additional bin commands

  • now-pipeline-list - see the current deploys for the current project
  • now-pipeline-prune - remove all non-aliased deploys for the current project

You can pass custom test command to the pipeline to be used after deploying fresh install using --test "command" argument. The command will get NOW_URL environment variable with new install. For example

npm i -g now-pipeline
now-pipeline --test "npm run prod-test"

where the package.json has

{
  "scripts": {
    "prod-test": "e2e-test $NOW_URL"
  }
}

Details

t="$(npm pack .)"; wc -c "${t}"; tar tvf "${t}"; rm "${t}"

Related

  • next-update is a similar "if tests pass, upgrade" tool for your NPM dependencies.

Small print

Author: Gleb Bahmutov <[email protected]> © 2016

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2016 Gleb Bahmutov <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

now-pipeline's People

Contributors

bahmutov avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.