Integrate github with Openshift - github

I think this question has already been asked but i am still not clear about it.
This is my question:
I already have a Github Account with an existing repo. I want to start a project on Openshift, but Openshift creates it's own git repo in cloud and i have no access to it just like i have to my existing Github account. So what i want to do is integrate existing Github account with Openshift so that openshift will not use it's own git repo.
I think you have understood my question.

Openshift needs to use it's own git repo. That's how you update your Openshift app. From there you create/add a remote (ex. Github) if you want to update that also.
There are examples on how to merge your Github repo to Openshift to start. You will have to google it because I don't have the link handy now. Sorry.

Related

Github webhook is not created when creating a Google Cloud Build trigger

I have many projects which uses Google Cloud Build + Github build pipeline setup. However, there is this one project, which I cannot create a webhook in Github for.
It used to work - but commits to the repository doesn't trigger the build process any more. I deleted the trigger and added it again - but the webhook in Github is not created automatically for this project.
When I run the trigger manually, it picks the wrong, but fixed commit which I did before an year.
Any clue?
Could you try delete a repository on Cloud Source Repositories and setup Google Cloud Build again ?
See:
https://cloud.google.com/cloud-build/docs/running-builds/automate-builds
Note: For external repositories, such as GitHub and Bitbucket, you must have owner-level permissions for the Cloud Platform project with which you're working. When you set up a build trigger with an external repository for the first time, you'll need to set up authorization with that repository.
After you've set up your external repository, Cloud Source Repository creates a mirror of your repository.
https://source.cloud.google.com
https://cloud.google.com/source-repositories/docs/deleting-a-repository
https://cloud.google.com/source-repositories/docs/mirroring-a-github-repository
I am experiencing the same issue. I can create a trigger for a repo, but I cannot connect the repo automatically to cloud build. We also have many projects, and this manual labor is sort of annoying.
Is there any (under the hood) github/gcloud api available in which I can connect a github repo to cloud build? I am aware that this can only be done by someone with admin privileges on a repo or organization in github.
After this, I will be able to run the command gcloud build triggers create github [NAME]

How do I set up a gitlab integration in Bluemix DevOps ToolChain?

IBM Bluemix DevOps ToolChain allows source code repositories to be only github and IBM version gitlab. My repo is in the public gitlab cloud and i do not intend to move it to IBM's gitlab cloud. How do I set up my Toolchain?
Update: It is now possible to add gitlab.com repositories (or repositories from any other GitLab server on the public internet) to Bluemix DevOps Toolchains. More details are available in the Bluemix Documentation.
Original (outdated) answer:
It is not currently possible to add repositories on gitlab.com or other public GitLab servers to an IBM Bluemix DevOps toolchain. However, that capability is actively under development.
Until that feature is available, you could proceed by duplicating your repository to one of the supported Git providers. There are instructions for duplicating a repository at https://help.github.com/articles/duplicating-a-repository/. In short:
git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
The example uses github.com, but this approach would work for any git repository.
I think this has been added recently, you can just pick it when you add a tool to your toolchain. There's also a blog post about it https://serifandsemaphore.io/build-a-serverless-api-in-seconds-with-go-c504398d86f6

Automatically mirroring a Gitlab repo onto Github on push

I'm looking for a way to automatically mirror my Gitlab repos to Github, on push. I use Gitlab repos as my main repos, and would rather have to push to only one remote. But, I want my code to be browsable on Github also.
I found similar questions on StackOverflow, such as this one.
But the answers are always the same: one should add a custom post-receive git hook to the gitlab repo. This requires a shell access to the server running Gitlab. As I'm hosting a community edition Gitlab for many users, and not only me, they can't have easy access to a shell (and this isn't the most user-friendly way to do this), so it does not fit my needs.
I thought about two ways to implement it:
Either a MirrorOnPush project service, implementing such a git hook in Ruby, as the EmailOnPush project service currently do.
Or use a custom server to clone and push the repo, using a webhook.
The first one seems to be the cleaner to me, but I can't find any doc about Gitlab project service and code structure… On the other hand, the second is a bad and ugly hack, but is almost straightforward.
I'd rather implement a project service to handle it. Do you have any doc or leads on how to write a project service for Gitlab (without having to read all the Gitlab source code, as there seems to be no dev doc…) ?
Thanks !
one should add a custom post-receive git hook to the gitlab repo.
Actually, that was the best solution, up until 7.x GitLab, as I detailed in "Gitlab repository mirroring";
A true project service for repo mirroring is requested, but not voted up enough: suggestion: suggestion 4614663.
The main documentations remains:
the app models project services folder,
the spec models project services folder,
the doc/project_services,
the project services scenarios.
This isn't much, as the OP noted before.
Since it That leaves you with the hack approach.

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.
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:
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?
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)
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.

How do I set up my AWS EC2 Elastic Beanstalk project to collaborate with others?

I have been working on AWS EC2 using Elastic Beanstalk for a few months now. Everything is going well. Now, the client wants to add another developer to the project. I am a little unclear as to how to do this. It seems that Elastic Beanstalk is using git in the background and is push only. I can't clone the repo. I am not even sure where to go to find the repo.
So, my question is, how to I set things up (or have others set things up) so they can collaborate with me?
EDIT: I suppose another way of asking this question is: If Elastic Beanstalk has set up my Git repo for me, how to I check that Repo out and share it with others?
I am using Visual Studio 2010 (with AWS tools installed) on a Windows 7 machine and the remote instance is Windows.
Thanks.
Elastic Beanstalk doesn't have any concept of a repo. An application version is just bundle that's stored on S3.
What you'll have to do is host a repo at someplace like Github or Bitbucket. Then you share your changes as you would any other project. When it comes time to deploy a version to Elastic Beanstalk, you'd execute git aws.push rather than something like git push origin. Of course this assumes that you've already set up the AWS git dev tools.
As an aside, I'd recommend that you set up an IAM user account for each developer so everyone has their own set of AWS access keys. This would allow you to revoke deployment access to a person without affecting anyone else.