Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to automate sync between a Github repository and Openshift?

What is the best way to automate syn between Github repository and Openshift ?

I found this documentation in openshift : https://www.openshift.com/forums/openshift/how-to-keep-a-github-repository-and-an-openshift-repository-in-sync For manually doing a syncrhonisation.

like image 606
mcbjam Avatar asked Apr 21 '14 21:04

mcbjam


People also ask

How do I sync my GitHub repository?

On GitHub, navigate to the main page of the forked repository that you want to sync with the upstream repository. Select the Sync fork dropdown. Review the details about the commits from the upstream repository, then click Update branch.

Is it possible to defer sync with the repository as per convenience in git?

In their own local copies of the project, they edit files and commit changes as they would with SVN; however, these new commits are stored locally - they're completely isolated from the central repository. This lets developers defer synchronizing upstream until they're at a convenient break point.


1 Answers

I guess the first question is why you want to automate it? What do you want to achieve? In many cases a manual push to Openshift and GitHub might be preferable.

However, let's explore some possibilities:

  1. Configure a git remote with multiple urls and then just git push all. See also Able to push to all git remotes with the one command?
  2. Use a GitHub Webhook - https://developer.github.com/webhooks/creating/. GutHub will then send a HTTP request to a given URL on each push. You can then setup something on your openshift gear which listens to the request and if it receives one pulls from GitHub. you might then need to restart the app via ctl_app (see https://www.openshift.com/kb/kb-e1055-how-to-restart-an-application)
  3. Last but not least, you could make use of the .openshift/action_hooks/post_deploy deploy hook in OpenShift. I gets triggered after redeploy of your application. In there you should be able to the repo to GitHub as well.

Which approach makes most sense will depend on your use case.

like image 165
Hardy Avatar answered Nov 10 '22 19:11

Hardy