Giter VIP home page Giter VIP logo

stage-ci's People

Contributors

amccloud avatar chrisui avatar hugomd avatar jimthedev avatar paulirish avatar zpnk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

stage-ci's Issues

Retry failed deploys

It would be nice to allow the user to trigger a retry of a failed deploy.

I would imagine this implemented as a url that gets set as the target_url on the GitHub error status, with a description of, "Deploy failed, please try" or similar.

To trigger a deploy, we need information about the repo, as well as branch data (ref/sha). This info is included the the initial GitHub pull request event. But it seems we could fetch this data as needed through the GitHub pull request endpoint.

So we could have an endpoint like /retry?repo=zpnk/hello-world&pr=20 that gets set as the GH status in event of an error. This endpoint would get the necessary repo/git info from the GH PR api and retry the deploy.

Improve test coverage

Currently the only tests are for the environment variable helpers.

We need to add tests around the core logic of parsing the github/gitlab events and conducting the deployment & aliasing.

This is extremely important as it will give us confidence when adding new features/improvements.
Also we'll have a reason to setup proper CI for our own pull requests.

I don't think too many tests are a bad thing, so if you feel like writing some please jump in!

Automatically alias commits on master

Let's say I have a pizza-app and deploy using stage-ci. Now I want all commits on master to automatically be deployed to production, i.e. be aliased to pizza-app.com.

Does that work?

Docker: Move from Slim to Alpine

The node slim image by itself is 219 MB, then with all of our build steps it jumps to 321 MB in total.

My recommendation would be that we move to using the node 10-alpine image, which starts at 23 MB, and then install git on top of that, rather than installing it via apt as we do in the slim image:

RUN apt-get -y update && apt-get -y install git

This should reduce overall size and deployment time significantly.

✌️

/usr/bin/node: bad option: --harmony-async-await

I tried deploying via https://deploy.now.sh/?repo=https://github.com/zpnk/stage-ci&env=GITHUB_TOKEN&env=GITHUB_WEBHOOK_SECRET and it failed.

Then I am attempting a manual deploy of stage-ci but it hit this wall.


npm install
✓ Using "yarn.lock"
⧗ Installing 15 main dependencies…
✓ Installed 716 modules [31s]
npm start

> [email protected] start /home/nowuser/src
> node --harmony-async-await ./src/server.js
/usr/bin/node: bad option: --harmony-async-await
npm ERR! code ELIFECYCLE
npm ERR! errno 9
npm ERR! [email protected] start: `node --harmony-async-await ./src/server.js`
npm ERR! Exit status 9
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nowuser/.npm/_logs/2017-06-01T04_34_57_121Z-debug.log

Two PRs with same branch name but different git tree errors Stage-ci.

If you already have a branch in your repo called, let's say patch-1. Stage-ci has run and deployed but we're not yet ready to merge so the PR and the deploy is still out there. This is no problem and stage-ci works wonders.

Now. Time for a bit of chaos. Another user with a fork of the repo creates the same branch name but for a different issue. She puts in a PR and of course stage-ci tries to do a deploy but it errors because there is already a different deploy with that name.

Polish items

Ok last thing. These are a few small tasks you could do to polish up this repo:

  • Add a badge like StageCI Deploy with instructions for how others can add this badge to their repos as well.
  • Add github description & url pointing to https://stage.now.sh
  • Add links between this repo and the docs for state.now.sh and vice versa.
  • Add some getting started information at the top of README.md. Move development/contributing info down.

Support for GitHub Organizations

Would like to see this able to support repos within an organization. I would love to use this at my company. I originally tried to do this for an organization, but to the best of my knowledge organizations and their repos don't have auth tokens. Would there be a way to use stage through a web hook instead?

Problem deploying to PR staging, now-cli: not found

Similar to issue #34,

In my GitHub PR, I get the message:

had a problem deploying to PR staging

This links to a page that says

404: The deployment could not be found

...and in the Zeit logs:

Error: /bin/sh: 1: /stage-ci/now-cli: not found

at Socket.nowProc.stderr.on (/stage-ci/src/core.js:82:49)

I am on [email protected].

My repository is here:

https://github.com/penx/govuk-react-example

My logs are here:

https://zeit.co/penx/stage-ci/kqelcypujt/logs

Example failed PR:

penx/govuk-react-example#9

GitLab Support

I currently self-host GitLab and use it almost exclusively, so I'd love to see support for GitLab. GitLab has its own implementation of webhooks but it I believe it has some compatibility already with GitHub webhooks (you might be able to use a similar request body).

I'll have a look at getting it running with GitLab and make a PR if any changes need to be made.

GitHub deployment events?

Really cool app. I'm in the process of settings everything up, but I have a question:

  • Does stage-ci (or Now) use GitHub's deployments API to send deployment events to GitHub by chance?

I have a tool called assertible (https://github.com/integrations/assertible) that uses GitHub's deployment status events to run automated acceptance tests against staging/qa/dev/prod environments immediately after they are deployed. The end result ends up looking like this image, a Heroku Review Apps deployment:

image

I'm a little new to Now so any help would be appreciated! My ultimate goal is to make sure Assertible can support stage-ci.

Github Webhooks returning 404 Not Found

Hey guys, how are you?

I've tried to follow these steps: https://stage.now.sh/
After I deploy to my now account I went to step 4 and forward. I did everything as the website says but when github creates the webhook, this is happening:

error1

What I did wrong? OR anyone here already faced that?

Add LICENSE

Love this but would you mind adding a license? MIT or Apache2 would be ideal IMO.

Move to GitHub org?

Opening this up to start a discussion about the benefits/logistics of moving this project to it's own GitHub org.

Ideally, the org could also house the deploy.now project.

While we're at it, it's probably worth merging stage.now (website/docs) and stage-ci (server) projects into a single repo.

Tagging in folks who have been active in the project: @jimthedev @paulirish @amccloud @mxstbr @hugomd

What are everyone's thoughts on this?

Discussion: Building for static deployments

Static deployments on now come with some benefits, namely, that the instances are never put to sleep and dont count against your instances limit.

In my personal uses of stage-ci, I mostly just want static assets hosted. I don't have a custom webserver I need stood up. I'm thinking we could make this easier to pull off when using stage-ci.

Proposal:

If your package.json has an npm script named stage-build_static, stage-ci will run it and expect that it creates a new folder named _static which contains an index.html and all the assets. stage-ci will then have now deploy that _static folder.


Obviously we're relying on two naming conventions here, but since now-start and now-build are a thing, it seems reasonable. I'm totally open to names being different, or another approach entirely. Thoughts?

add secret token

It would be awesome to be able to place a secret token in stage-ci to take advantage of the webhook secret token functionality that github offers.

Docker deployments fail

Originally raised here.

The npm build script isn't being run in Docker, it simply installs and then runs.

"build": "node ./src/build.js",

stage-ci/Dockerfile

Lines 7 to 14 in 408f6a0

COPY package.json .
RUN npm install --production
ADD . .
EXPOSE 3000
CMD npm start

When now spins up a new deployment, it runs the build step automatically.

I can see two ways to fix this:

  1. Update the Dockerfile to include the build step
  2. Rename the build script to preinstall

✌️

Sharing deployment logs with the user for pending/error

After working on #26 I identified some followup work I think would improve the experience. (TBH it seems equally valuable both in commit status API and deployments API)

User story

If there's a failure in the deployment, you'd want to see the logs from now.sh.
The Github deployment API has thought of this and its "log_url" property can be supplied the http://****.now.sh/_logs/ URL. The pending status will then be user visible where they can click through and monitor the build.

This also is valuable if there's a failure in the now build. (I experienced one of these in one of my projects---the root cause: .gitignore & compiled files)

Implementation

Essentially, the moment we have a non-aliased now URL, we want to update the pending status to include this _logs url.
The challenge is that the stage method in core doesn't allow for exiting twice: First, with url so we can setStatus with it. Then, once the process's close has fired and alias'ing completes.

I gave it a shot but nothing really felt right.. so @zpnk you're probably the best to take a look at this. :)

had a problem deploying to PR staging Error

Hi, when opening a PR i get this Error message

it links me to [repro-name]-[branch-name].now.sh but ends in a 404.
no now deployment was created on my account

did i mess up my stage-ci setup?

Edit:
found this in the logs of my stage-ci deployment

Error: /bin/sh: 1: /stage-ci/node_modules/now/build/bin/now: not found

    at Socket.nowProc.stderr.on (/stage-ci/src/core.js:34:49)
    at emitOne (events.js:101:20)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:561:20)

Cannot deploy Github branch

Upon clicking on Deploy, nothing happens. Checking in the console, there is a request with a 500 error status code, and the body contains the message "error
:
""Response code 404 (Not Found)"""

404 deploys

I just set up the new version of stage-ci and pushed to a PR, this is what I got:

stage-ci-issue

This links to <reponame>-<branchname>.now.sh which is great except that URL just shows a Zeit 404. 😢

404-deployment-not-found

Looking at the webhook everything is green, the stage-ci server replied with 200 OK. Any ideas what the culprit could be? /cc @paulirish

Sidenote: Now that we have the deployment API and have links to the deploys (:tada:) maybe there could be a way to turn off the "nice" names? For obfuscation reason I'd rather like having the default now pseudo-random URLs.

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.