zpnk / stage-ci Goto Github PK
View Code? Open in Web Editor NEWAutomatic deploy previews for your PRs using zeit.co/now.
Home Page: https://stage.now.sh
License: MIT License
Automatic deploy previews for your PRs using zeit.co/now.
Home Page: https://stage.now.sh
License: MIT License
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.
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!
now
only supports a certain amount of characters. If the total amount exceeds 70 characters the alias fails.
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?
Error: /home/nowuser/src/now-cli: at Socket.nowProc.stderr.on (/home/nowuser/src/src/core.js:85:49)
is [...]/src/src/[...]
the intended path?
This is happening here: styled-components/styled-components-website#158
/cc @hugomd this is on your branch, maybe related?
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:
Line 3 in 408f6a0
This should reduce overall size and deployment time significantly.
✌️
In the latest version (1.2.0), I get TypeError: deploy is not a function
.
This is as a result of the new GitHub deployments support, in #26
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
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.
Ok last thing. These are a few small tasks you could do to polish up this repo:
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?
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:
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.
stage.now.sh links to https://zeit.co/account#api-tokens, but I think it should be https://zeit.co/account/tokens.
Really cool app. I'm in the process of settings everything up, but I have a question:
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:
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.
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:
What I did wrong? OR anyone here already faced that?
Love this but would you mind adding a license? MIT or Apache2 would be ideal IMO.
We are currently depending on now v0.28.0. The latest version is ~v6.3.1.
We should upgrade. 👍
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?
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.
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?
The current alias structure is of the form: {repo-name}-{my-branch}
.
I think we should add the repo owner to the alias, for example: zpnk-hello-world-some-changes
.
This will prevent collisions on project forks, etc.
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.
Originally raised here.
The npm build
script isn't being run in Docker, it simply installs and then runs.
Line 10 in 408f6a0
Lines 7 to 14 in 408f6a0
When now spins up a new deployment, it runs the build
step automatically.
I can see two ways to fix this:
build
script to preinstall
✌️
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)
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)
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. :)
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)
I followed the procedure on stage.now.sh, but got this error message without further information. Any tips? This repo looks quite promising, if only it could work! 🙂
Thanks a lot
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)"""
I just set up the new version of stage-ci and pushed to a PR, this is what I got:
This links to <reponame>-<branchname>.now.sh
which is great except that URL just shows a Zeit 404. 😢
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.