By decapo01
I’m trying to use doctl with a jenkins pipeline script to push a docker image to my digitalocean image registry and I’m having a lot of trouble.
I’ve downloaded and installed the doctl util via git (since the snap installation wasn’t working) and I’m unable to initialize the authentication.
here is what my steps look like in the script
steps {
sh 'doctl auth init'
sh 'doctl registry login'
}
and this is the error I’m recieving
+ doctl auth init
Error: Unable to read DigitalOcean access token: unknown terminal
I’ve logged into the machine via ssh and switched to the jenkins user and manually initialized auth but unfortunately this doesn’t carry over to the script.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I found the answer here https://github.com/digitalocean/doctl/issues/733#issuecomment-580911169 if you do not specify the token in the command the doctl util will try to determine the terminal. Since this is going through Jenkins there is no terminal so I supplied the token in the script
sh 'doctl auth init -t {token}'
Hi @decapo01,
I see you’ve managed to find the solution in Githut! Thank you for sharing it in the community as well!
That’s a nice trick using it with Jenkins, I’ll have to try it out for myself as well.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.