1

The below command still prompts me for typing in username and password. I would expect it to start building without the prompt as i'm mentioning the source secret.

oc new-app --strategy=docker --code=https://git.abcd.mycompany.com/project/openshift-pipeline-trail.git#development --name=openshift-pipeline --source-secret=robot-cred

I also tried linking the source secret by the below command, still it prompts me for username and password.

oc secrets link builder robot-cred
Bharath
  • 559
  • 11
  • 27

1 Answers1

0

I am guessing your Secret does not have the right format and can therefore not be used by oc new-app. How did you create the secret?

Note that only the following types of secrets can be used as a source secret (Source Clone Secrets):

  • .gitconfig File
  • Basic Authentication
  • SSH Key Authentication
  • Trusted Certificate Authorities

So to have Source Clone Secret with Basic Auth, create the secret like so:

oc create secret generic <secret_name> \
    --from-literal=username=<user_name> \
    --from-literal=password=<password> \
    --type=kubernetes.io/basic-auth
Simon
  • 4,251
  • 2
  • 24
  • 34
  • 1
    Hi @Simon, thanks for your answer. I created the secret via the GUI and yes I can confirm that it is a `source secret` with `basic-auth` and the type is `kubernetes.io/basic-auth`. The weird thing is that, when I use the "deploy using dockerfile" via the GUI with the same secret, it works absolutely fine but with the CLI oc command, it prompts me for the creds. – Bharath May 07 '20 at 08:10
  • Good to hear. Can you maybe add the output of the command with `-v=7` to get detailed debugging output (see https://docs.openshift.com/container-platform/3.11/cli_reference/basic_cli_operations.html#troubleshooting-cli)? Potentially we can see something in the debug output. – Simon May 07 '20 at 10:31
  • same here `oc new-app --image-stream=php:5.5 --strategy=source --code=https:///git/web_cn.git --context-dir=php-webcn --source-secret=vajra-bitbucket` is still trying to clone and analyse the repo, prompting for bitbucket credentials while the short hand method below works as expected i.e without prompting credentials `oc new-app php:5.5~https:///git//web_cn.git --context-dir=php-webcn --source-secret=vajra-bitbucket` – vajravelu Jul 31 '22 at 01:59