Hello,
I’m currently trying to build my projects usings Jenkins. I’ve managed to configure Jenkins to pull from my GitLab repositories but I’m struggling to figure out a way make it build on a Droplet.
Does anyone know of any simple solutions for achieving this?
Thanks, Luke
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 have set up a Jenkins configuration that needed to build droplets on the fly. I achieved this by creating a couple scripts on the Jenkins server that I could call at build time. A more generic setup could be achieved by using doctl.
With doctl installed on your server and configured with your API keys your Jenkins instance will be able to manage droplets by running local commands.
When you have installed jenkins in the DO droplet, you will have an user jenkins in your system. Use that user to run a shell script to build and run the project after pulling latest code from repository.
here are the steps:
su jenkinsssh-keygen -t rsacat ~/.ssh/id_rsa.pubsu ,replace <DEV-SERVER-USER> with your user that belongs to your development servernano ~/.ssh/authorized_keys
In this way, the jenkins will be able to log into your droplet and do exactly the things you would do by writing manual commands.chmod +x scriptnamethere might be some issues regarding the ssh to your repository , in that case if you cannot solve it by yourself, you may try eval `ssh-agent```` and then run ssh-add ~/.ssh/id_rsa.pub``` .
Hope it helps.
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.