Rancher cli in a pipeline

Hi!

I’m tryingto embed a rancher app update/upgrade directly via CI/CD pipeline.

The trouble is that it’s necessary to manually answer questions on rancher login command.

Are there a workaround to “rancher app upgraded” works via CI/CD pipeline?

Thanks in advance.

Hi,

What manual questions?
it is not necessary to manually provide credentials, you can use:

$ rancher login https://rancher.example.com -t userabc:tokenxyx --context clusterabc:projectxyz

Unfortunately you have to create a token before within Rancher once (has anyone managed to automate that, or get it via API?), and figure out the context with rancher projects

hope this helps a bit,
Damian

Thanks by your feedback!

Those parameters you mention I already tried.

The question I always need to answer manually is:

Cert chain is : [Certificate:
...]
Do you want to continue connecting (yes/no)?

That certificate is the one created and self-signed by RKE installation process.

How do I workaround this?

Hey there, I had the same problem… So as a test I piped an echo out to the command and it worked this is what I used:

sh echo "y" | ./rancher login $rancherServerURL -t $rancher_API_Token --context $clusterContext

Hope that works for you too!

That’s also was my workraound!

Hi, folks!

Rancher CLI new version (2.2.0) has new a new login parameter (--skip-verify) that you can bypass CAcerts verification.

rancher login --skip-verify ...

Have fun!