-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate into a fully separated peril system, by using AWS Lambda for a Danger run #159
Comments
I ran through the serverless tutorial, and then took a look at how AWS lambdas work in the docs. The idea seems to fit, there's a limit to data sent to a job at 6MB, which I think we can keep the DSL under. https://hd6geu40s4.execute-api.us-east-1.amazonaws.com/dev/api/danger/run |
Bit worried about the re-use though: https://aws.amazon.com/blogs/compute/container-reuse-in-lambda/ |
Though I could do this:
|
I spent a bit more time thinking out loud about this with @craigspaeth I'd like the role of the "peril" server here to be about setup and execution of jobs, so perhaps it makes sense to move more of the logic into AWS. Here's how it could work.
The advantage being that the "hard work" is completely moved out of Peril. Generating a DSL requires many API calls to GitHub, and a good chunk of number crunching on the diff JSON. Moving this out into lambda makes Peril effectively a router and not a work machine, which should make it more feasible to scale. This is blocked by danger/danger-js#395 which provides a lot of tooling/typing inside danger for handling process separated JS. |
TBH, https://hyper.sh looks like a better option then AWS lambda |
WIP happening, it's got merged and is building on https://hub.docker.com/r/dangersystems/peril/ |
This has been working for 2 months on the danger org, I’ve started looking at moving this infra to be on a staging env |
Hey @orta, I got a little bit lost in this thread. Is the reasoning behind this for security concerns of executing the dangerfile? Essentially, you're allowing users to run the dangerfile in their own environment? What I'm looking into is using peril to trigger some heavier work to be done on a remote machine where I need to download resources from multiple repositories |
This issue revolves around the idea of allowing multiple orgs to eval code without being able to access other org settings, lamba didn't work for that due to the sharing of runtime environments between runs. I think that makes more sense to have the dangerfile trigger a webhook via an exposed API, if you wanted to do it for every dangerfile this is the current API |
This is now done and sorted. |
I once had a great chat with @bkeepers once about Lamba as a option for user security, today this really clicked into place as to how this could work with Peril.
In Danger JS, there is a tool called
danger process
- http://danger.systems/js/usage/danger-process - by separating the danger setup, vs the danger run then it allows any language to create their own runtime without all the faffing.By the same process, Peril can do all the setup, and lambda can handle running the dangerfile. This could handle my two biggest problems: Handling running a lot of dangerfiles and the security issues around running a Dangerfile safely.
In this setup:
Questions for me to figure:
The text was updated successfully, but these errors were encountered: