Here is a look at the steps involved to build this piece of our pipeline:
Use the Github webhook Api (repo > settings) to send a request to a Stackery Rest Api endpoint whenever a PR is "opened", "edited", or "reopened"
The Rest Api endpoint has a link to a Stackery Function node that receives the response containing everything we need to assemble the build
The Function will clone the PR, run npm commands, then upload a www-ready build (using Stackery.output) to a Stackery Object Store
When finished, the Function will send a request back to Github, adding a comment to the PR with a log of npm run test
output and a url to preview the build that links to the Object Store where the build files were uploaded.
Configure a stack using the Stackery dashboard with 3 nodes: Rest Api -> Function -> Object Store
The Rest Api endpoint will receive a request from a Github webhook when a PR is “opened”, “edited”, or “reopened”.
The Function node runBuild
receives the response as its message
parameter (output from the Rest Api node).
Memory was increased to 1536MB to ensure that the process would complete as quickly as possible. Since execution is infrequent, cost to increase memory is nominal.
Then, runBuild
performs the following steps using a Promise() chain:
Building this tool helped me discover one of the many possibilities of using Stackery as an operational tool and also exposed some unique challenges when performing familiar workflow commands within an AWS Lambda environment. More to come on our blog and guides as we build-out our CI pipeline.