Is it possible for GitHub to trigger a new test deployment when a pull request is submitted? I'd like for it to create a new folder on the server (Azure preferred) so that a test URL (e.g. http://testserver.com/PR602/) is generated that we can refer to in the pull request.
This would allow anyone to test a pull request without having to clone the repo, check out the branch, and build it locally.
In my initial research I found that Travis CI can deploy all branches, but I'm not clear how this would be triggered. Do I have to write a custom app that's triggered by pull request web hooks? I'm hoping someone has discovered a simpler method.
Do I have to write a custom app that's triggered by pull request web hooks?
Yes, or find someone else who has happened to have written the exact webhook handler you need.
Writing a webhook handler isn't terribly much work. If you don't want to integrate it with your current app, you can use a micro-framework like Flask to do this in only a few lines of code.
Coming back to this in 2022, there is now also the option of Github Actions, which is a first-party CI service. Actions provides a framework for defining what things to do when certain triggers happen, and there's an extensive marketplace of drop-in components, so you may be able to do all of your triggering of other systems without writing any custom code or running a webserver to listen to webhooks.
Related
I'm developing a small website with my dev partner. He's doing the front and and I'm doing the backend (API). I'm imagining a workflow like the following:
We both collaborate on basic API structure and requirements using
Swagger.io
I generate the server stub and publish to a public google cloud service.
Initially this just serves example data from the OpenAPI yaml file.
This gives my partner something to work with as he gets started.
I update the server code to use faker.js data and give him the ability to trigger various server responses like 500, 404, 200 etc... This allows him to further develop the frontend to handle various issue.
I fill in the stub with actual, working, code that we can both test
before going live.
Is this a realistic workflow? If so, any hints on how to approach it? I was hoping I could take the swagger server stub code and easily publish it to some Google Cloud service like Cloud Functions, App Engine, Containers, Cloud Endpoints etc... but nothing seems straightforward.
We are a 2 man show and this will be an iterative process.
If this is too open ended of a question, then I'd like to ask the following:
What is the simplest way to host Swagger Server Stub code on a public server using faker.js data?
Thanks.
I am trying to get my head around web hooks. I receive a web hook from Shopify. I use https://beeceptor.com/ to receive the web hook which looks like the screenshot attached. It is a JSON. I want to use python to process the received POST and take some action. Can I know how I can retrieve this using python? Do I need to use the Flask framework or can I do with request? Here are details from Shopify https://shopify.dev/tutorials/manage-webhooks#verify-webhook
which I am unsure of.
You need to create a web app that can accept incoming HTTP traffic from Shopify - you can do this in Flask/Python or really any other web technology stack. Services like AWS Lambda can also work to receive the webhook and do some processing.
I am trying to configure contentful webhook for auto deploy in netlify.
I am geting 404 during content changes.
Disclaimer: I work for Netlify.
This setup works well for many customers. I assume you have setup a separate build hook in the Build & Deploy settings page and are using it? You cannot use our automatic webhooks that trigger builds from GitHub/GitLab/BitBucket to trigger builds from other external systems like Contentful.
There is no authentication required and a 404 suggests to me a mistyped webhook address as we'll only return 404's when you try to visit something that doesn't exist.
Do make sure that:
your site is setup to build using our continuous deployment system. You can't trigger a site that we can't fetch via git, and only sites fetched via git can be built via our CD.
you use https
you POST (I assume this is the default for Contentful's outgoing hooks but if you can choose - POST is what you want)
your webhook host is api.netlify.com
and in general you use the exact hook address you get from our UI.
If that doesn't show an obvious typo, this is probably something you'll need to contact our Tech Support about, including information like your webhook address and the site you are attempting to trigger a build from.
I have created azure functions with "HTTP trigger" and "generic Webhooks" with Visual studio 2017.The only difference I found that both "triggers" can be triggered by HTTP request.
both functions have "HttpTrigger" as parameter.
so I am confused when should we use one over the other as both triggers allows us to run small piece of code in cloud.
How Is it different from one another ?
An HttpTriggered function can respond to any HTTP verb you configure. However, a webhook only responds to POST and expects the payload to be JSON.
Source: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#responding-to-webhooks
This restricts requests to only those using HTTP POST and with the
application/json content type.
A 'Webhook' is a user defined callback that can be registered on a website in case you want to react to certain events.
For example something that is often done is responding to events in a gtihub repository, like when someone does a check-in or an issue is added. Typically you would want to trigger a build when a check-in happens. You can register a callback/webhook on github which points to a url provided by you that reacts to the HTTP POST called by github.
Azure function can be configured to be triggered by a normal HTTP request or it can be setup as a webhook i.e. it will be called whenever a specific event on some website has occurred. Functions configured as webhooks will respond only to a HTTP POST. There are already built in values to set up an Azure Function as a github or Slack webhook.
If you are not reacting to an external event or cannot register a webhook in the event source just go with the HttpTrigger and explicitly invoke your function.
As per the documentation, the webhooks only work with 1.x version of Azure functions runtime while if you are working with the newer runtime 2.x - it is recommended to use the HttpTrigger instead.
From the documentation,
In version 1.x, webhook templates provide additional validation for
webhook payloads. In version 2.x, the base HTTP trigger still works
and is the recommended approach for webhooks.
I am working on code for a webserver.
I am trying to use webhooks to do the following tasks, after each push to the repository:
update the code on the webserver.
restart the server to make my changes take effect.
I know how to make the revision control run the webhook.
Regardless of the specifics of which revision control etc. I am using, I would like to know what is the standard way to create a listener to the POST call from the webhook in LINUX.
I am not completely clueless - I know how to make a HTTP server in python and I can make it run the appropriate bash commands, but that seems so cumbersome. Is there a more straightforward way?
Setup a script to receive the POST request ( a PHP script would be enough )
Save the request into database and mark the request as "not yet finished"
Run a crontab and check the database for "not yet finished" tasks, and do whatever you want with the information you saved into database.
This is definately not the best solution but it works.
You could use IronWorker, http://www.iron.io, to ssh in and perform your tasks on every commit. And to kick off the IronWorker task you can use it's webhook support. Here's a blog post that shows you how to use IronWorker's webhooks functionality and the post already has half of what you want (it starts a task based on a github commit): http://blog.iron.io/2012/04/one-webhook-to-rule-them-all-one-url.html