Try to create Node.js
app in OpenShift
in terminal, like this:
./oc new-app https://j4nos@bitbucket.org/j4nos/nodejs.git
Source code in BitBucket
in a private account, how to set credentials? Once it asked for password, but not again. How can I set credentials?
Added annotated secret from GUI: repo-at-bitbucket
I have read Private Git Repositories: Part 2A tutorial, strange that for HTTPD
app there is a Source Secret
filed to select secret, but not when Node.js
+ MongoDB
combo is selected. Why?
Ahh .. need to select pure Node.js
app.
You need to authenticate to the private git repository. This can be done a few different ways. I would suggest taking a few a minutes and reading this blog series which outlines the different methods you can take.
https://blog.openshift.com/private-git-repositories-part-1-best-practices/
After reading first through initial few posts explaining concepts and doing it with GitHub, only then look at the BitBucket example.
https://blog.openshift.com/private-git-repositories-part-5-hosting-repositories-bitbucket/
Those GitHub examples have more explanation which will then make BitBucket example easier to understand.
The likely reason you were prompted for the password when running
oc new-app
is that you used:Specifically, you didn't specify a S2I builder to use. As a result,
oc new-app
will try and checkout the repo locally to analyse it to try and work out what language it uses. This is why it would prompt for the password separately.It is better to specify the builder name on the command as:
This is an abbreviated form of the command and is the same as running:
If you specify the builder, it already knows what to use and doesn't analyse the code so will not prompt for the password, plus you wouldn't need user in the URI.
Either way, when building in OpenShift you still need the
basicauth
secret and should annotate it so it knows to use the secret for that build.