Answers: <p>I don’t know of a specific tool but I have setup a lot of webhook handlers on OKD kubernetes to do git driven updates to kubernetes. All the scripts are on GitHub as <a href="https://github.com/ocd-scm/ocd-meta/blob/master/README.md" rel="nofollow noreferrer">OCD</a>. The tools I used are:</p>
  
  <ol>
  <li><p><a href="https://github.com/adnanh/webhook" rel="nofollow noreferrer">adnanh/webook</a> a go binary that you configure to catch git webhooks and run scripts. Here is my <a href="https://github.com/ocd-scm/ocd-builder-webhook/blob/master/hooks.json" rel="nofollow noreferrer">hooks.json</a> config to match GitHub release events and run a build script on openshift kubernetes. Looking at the docs there are <a href="https://developer.github.com/v3/activity/events/types/" rel="nofollow noreferrer">PR events</a> you can match on. So you should be able to setup Webhooks to fire on PRs and trigger s2i builds.</p></li>
  <li><p><a href="https://hub.github.com/hub.1.html" rel="nofollow noreferrer">hub</a> is GitHubs official command-line tool. I put it into my tools image that runs my webhooks. It has some pull request commands. I haven’t checked them against your stated requirements. Hub is just a wrapper to their API so worst case you would need to use curl to update PRs. </p></li>
  <li><p><a href="https://docs.helm.sh" rel="nofollow noreferrer">Helm</a> is the installer/template engine I use for creating apps. <a href="https://github.com/roboll/helmfile" rel="nofollow noreferrer">Helmfile</a> is an excellent extension. So here is a <a href="https://github.com/ocd-scm/ocd-deployer" rel="nofollow noreferrer">generic “deployer”</a> helm chart that can spin up a deployment. So OCD responds to GitHub events of new Helmfile declarative configuration being pushed and deploys or updated any helm releases modified in git. </p></li>
  </ol>
  
  <p>For builds I had to do quite a bit to have an OKD container build tag the final container image with the GitHub release tag which is a <a href="https://github.com/ocd-scm/ocd-release-build" rel="nofollow noreferrer">generic “ocd-release-build”</a> helm chart. I think that is necessary as each PR will need by tagged with the PR number in the container registry to deploy from that specific tag. I haven’t ever tried to get OKD to build a <code>refs/pull</code> but I would be shocked it didn’t work as expected. </p>
  
  <p>So while OCD doesn’t yet spin up builds and deploys based on PR events it appears is likely that it could be extended to do that. We have migrated our apps from our in-house scripts over to OCD. A “PR previews” feature could be a very cool feature to add.  Feel free to raise a feature request. </p>
  
Answers: CC BY-SA 4.0
Answers: 2019-01-11T12:48:07.810Z
Answers: 2019-10-20T14:44:57.690Z
Answers: 2019-10-20T14:44:57.690Z
Answers: simbo1905
Answers: <p>I have not try it myself yet, but <a href="https://github.com/Shopify/kubernetes-deploy" rel="nofollow noreferrer">k8s-deploy</a> looks promising.</p>
  
  <p>Other potential products that I have not tried yet:</p>
  
  <ul>
  <li><a href="https://github.com/argoproj/argo-cd" rel="nofollow noreferrer">https://github.com/argoproj/argo-cd</a></li>
  <li><a href="https://github.com/hasura/gitkube" rel="nofollow noreferrer">https://github.com/hasura/gitkube</a></li>
  <li><a href="https://github.com/oursky/kubernetes-github-authn" rel="nofollow noreferrer">https://github.com/oursky/kubernetes-github-authn</a></li>
  </ul>
  
  <p>My aim is to evaluate these tools and I hope that you could try the same and reply to this post. As soon as I find out what tool works nice I will let you know.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-01-12T15:26:43.643Z
Answers: 2019-01-12T15:34:02.770Z
Answers: 2019-01-12T15:34:02.770Z
Answers: 030
Body: <p>I'm looking for a tool/service that will achieve a similar result as Heroku Review Apps using Google services.</p>
  
  <p>When a new pull-request is created in Github:</p>
  
  <ul>
  <li>Create new Cloud Build trigger for it with a given template configuration.</li>
  <li>When done with build, create new deployment for it in Kubernetes Engine given template configuration.</li>
  <li>Provide the public URL in the Github PR</li>
  </ul>
  
  <p>When PR is closed:</p>
  
  <ul>
  <li>Remove trigger, container and deployment</li>
  <li>Remove public URL from Github pull-request.</li>
  </ul>
  
Comments: CC BY-SA 4.0
Comments: 2019-01-12T15:32:23.953Z
Comments: Are you restricted to github or are other git-servers also an option?
Comments: 030
Comments: CC BY-SA 4.0
Comments: 2019-01-13T16:33:24.207Z
Comments: I am restricted to using Github, but if the tool has support for others as well that would be a plus for any future changes
Comments: mikabytes
Tags: <kubernetes><google-cloud-platform>
Title: Automatic Kubernetes deployments per Github pull-request
UserDisplayName: mikabytes
ThreadText: # Automatic Kubernetes deployments per Github pull-request
  
  (Asked by: username_0 on 2019-01-11)
  
  I'm looking for a tool/service that will achieve a similar result as Heroku Review Apps using Google services.
  
  When a new pull-request is created in Github:
  
  * Create new Cloud Build trigger for it with a given template configuration.
  * When done with build, create new deployment for it in Kubernetes Engine given template configuration.
  * Provide the public URL in the Github PR
  
  When PR is closed:
  
  * Remove trigger, container and deployment
  * Remove public URL from Github pull-request.
  
  **Tags:** kubernetes, google-cloud-platform
  
  > **Comments:**
  > **username_1**: Are you restricted to github or are other git-servers also an option?  
  > **username_0**: I am restricted to using Github, but if the tool has support for others as well that would be a plus for any future changes  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-01-11. Score: 1
  
  I don’t know of a specific tool but I have setup a lot of webhook handlers on OKD kubernetes to do git driven updates to kubernetes. All the scripts are on GitHub as [OCD](https://github.com/ocd-scm/ocd-meta/blob/master/README.md). The tools I used are:
  
  1. [adnanh/webook](https://github.com/adnanh/webhook) a go binary that you configure to catch git webhooks and run scripts. Here is my [hooks.json](https://github.com/ocd-scm/ocd-builder-webhook/blob/master/hooks.json) config to match GitHub release events and run a build script on openshift kubernetes. Looking at the docs there are [PR events](https://developer.github.com/v3/activity/events/types/) you can match on. So you should be able to setup Webhooks to fire on PRs and trigger s2i builds.
  2. [hub](https://hub.github.com/hub.1.html) is GitHubs official command-line tool. I put it into my tools image that runs my webhooks. It has some pull request commands. I haven’t checked them against your stated requirements. Hub is just a wrapper to their API so worst case you would need to use curl to update PRs.
  3. [Helm](https://docs.helm.sh) is the installer/template engine I use for creating apps. [Helmfile](https://github.com/roboll/helmfile) is an excellent extension. So here is a [generic “deployer”](https://github.com/ocd-scm/ocd-deployer) helm chart that can spin up a deployment. So OCD responds to GitHub events of new Helmfile declarative configuration being pushed and deploys or updated any helm releases modified in git.
  
  For builds I had to do quite a bit to have an OKD container build tag the final container image with the GitHub release tag which is a [generic “ocd-release-build”](https://github.com/ocd-scm/ocd-release-build) helm chart. I think that is necessary as each PR will need by tagged with the PR number in the container registry to deploy from that specific tag. I haven’t ever tried to get OKD to build a `refs/pull` but I would be shocked it didn’t work as expected.
  
  So while OCD doesn’t yet spin up builds and deploys based on PR events it appears is likely that it could be extended to do that. We have migrated our apps from our in-house scripts over to OCD. A “PR previews” feature could be a very cool feature to add. Feel free to raise a feature request.
  
  
  ---
  
  ### Answer by username_1 on 2019-01-12. Score: 0
  
  I have not try it myself yet, but [k8s-deploy](https://github.com/Shopify/kubernetes-deploy) looks promising.
  
  Other potential products that I have not tried yet:
  
  * <https://github.com/argoproj/argo-cd>
  * <https://github.com/hasura/gitkube>
  * <https://github.com/oursky/kubernetes-github-authn>
  
  My aim is to evaluate these tools and I hope that you could try the same and reply to this post. As soon as I find out what tool works nice I will let you know.
  
  
  ---
  
  