Rancher cli in a pipeline

#1

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.

#2

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

#3

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?

#4

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!

#5

That’s also was my workraound!