Reputation: 1356
I'm having a hard time getting OpenShift V3 connected with my Github repo. I tried to follow a tutorial on https://learn.openshift.com but they don't elaborate credentials issues between OpenShift and Github
Then, I tried to run the new app process through the CLI. No success either.
>oc new-app https://github.com/<repo>
--> Found image da99a88 (4 weeks old) in image stream "openshift/nodejs" under tag "6" for "nodejs"
Node.js 6
---------
Node.js 6 available as docker container is a base platform for building and running various Node.js 6 applications and frameworks. Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Tags: builder, nodejs, nodejs6
* The source repository appears to match: nodejs
* A source build using source code from https://github.com/<repo> will be created
* The resulting image will be pushed to image stream "appname:latest"
* Use 'start-build' to trigger a new build
* WARNING: this source repository may require credentials.
Create a secret with your git credentials and use 'set build-secret' to assign it to the build config.
* This image will be deployed in deployment config "appname"
* Port 8080/tcp will be load balanced by service "appname"
* Other containers can access this service through the hostname "appname"
--> Creating resources ...
imagestream "appname" created
buildconfig "appname" created
deploymentconfig "appname" created
service "appname" created
--> Success
Build scheduled, use 'oc logs -f bc/<repo>' to track its progress.
Run 'oc status' to view your app.
When I look on the log it says that Openshift could not connest the repo on the Github side
Cloning "https://github.com/<repo>" ...
error: build error: failed to fetch requested repository "https://github.com/<repo>" with provided credentials
Update:
Following very helpful answers and comments by user2983542 and Graham Dumpleton, I created public and private SSH keys
with the following tutorial. I created the key with a passphase, but I'm a bit confused with the following statement at OpenShift blog:
One saving grace is that OpenShift will not allow you to use a key-pair where the private key has a passphrase. A best practice, which I am sure you are following, is that your primary identity SSH key should always have a passphrase; this will prevent you from inadvisedly using your primary identity SSH key.
Anyway, I'm trying to proceed with passphase… I deployed the public key on Github end. Afterwards, I created secret
of type kubernetes.io/ssh-auth
on OpenShift and linked it to the deployment as an environmental variable.
The Github section of BuildConfig looks as the following:
triggers:
- github:
secret: M6_whatever...
type: GitHub
Deployment fails with the following message:
--> Scaling myappname-1 to 1
--> Waiting up to 10m0s for pods in rc myappname-1 to become ready
error: update acceptor rejected myappname-1: pods for rc "myappname-1" took longer than 600 seconds to become ready
Could you, please, point me, what I'm doing wrong?
Upvotes: 2
Views: 1474
Reputation: 11
I hope I'm not too late to this thread, but I couldn't get a proper solution anywhere & struggled for quite sometime. I am trying UI for the same, followed the exact steps from creating the SSH key to creating the secret key for the account 'builder', but end up with same error. following step may be helpful for people still looking for a solution
What worked for me is using repo url from "Clone with SSH" instead of "Clone with HTTPS"
Upvotes: 1
Reputation: 1779
You will need to create a source clone secret. Depending on what version of OpenShift you are running there may be different options available to you. SSH key authentication should be standard across all versions.
You should generate a new SSH key pair and upload your public key to Github. See the docs at Github for instructions You will just need to create a secret with your private key. Example:
oc secrets new-sshauth sshsecret \
--ssh-privatekey=$HOME/.ssh/id_rsa_examplekey
You may then need to link this secret to the builder
service account using oc secrets link new-sshauth
See the OpenShift docs here for more info and options for 3.6 but refer to your own version as required
Finally you will need to update the BuildConfig object to reference the new secret. oc set build-secret --source bc/example-build sshsecret
Upvotes: 2