I wanted to share with the community a little beginner’s guide by a beginner for getting drone working locally on Windows. I’m not a systems person and a true newbie with Drone so this comes from the perspective of recently knowing nothing.
Preamble
Setting up with drone.io was extremely easy. I was up and running in minutes, connecting to my public github repo and running a basic yml script. However as the drone yml got more complex, I found myself committing “drone yml attempt 45”, because there was no way for me to try anything locally.
The installation guides looked great for linux and mac, but I’m on Windows, and the guides fell short for me. They were clearly written by a Linux user much smarter than myself.
So here we go, a guide for Windows newbies.
Drone Exec for Windows 10 - The Lost Chapters
Chapter 1 - Virtualization Required
Drone relies on Docker, and Docker for Windows relies on Virtualization, and Virtualization relies on Windows 10 Professional. If you have Windows 10 Home, you’ll need to upgrade to Professional ($100).
*disclaimer - You might want to do your own research to make sure your bios supports virtualization, I’m not responsible if you upgrade and this newbie guide doesn’t work for you.
To upgrade:
Select the Start button, then select Settings > Update & Security > Activation
Enable Virtualization
Once you have pro, you’ll need to enable virtualization in your BIOS.
To check if virtualization is on, go to Task Manager > Performance tab > Virtualization: Enabled/Disabled
If disabled, we’ll need to enable it in the BIOS. First look up where the setting is for your BIOS. It’ll be under Advanced Processor settings or something like that.
Restart your computer with Recovery > Advanced Startup
so that you can edit your BIOS settings.
Docker for Windows
Install Docker for Windows. Note that even if you wanted to use the Windows Linux Subsystem, we’ll still need Docker for Windows [citation needed].
Go to docker settings (there should be a tray icon after installation), share a drive under Shared Drives
. Note that this will require you to set a windows password if you don’t already have one.
Enable General > Expose daemon on tcp://localhost:2375 without TLS
(If you don’t, you’ll see 2019/12/11 14:14:16 Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: read udp 192.168.65.3:53034->192.168.65.1:53: i/o timeout)
I also needed to increase the container’s memory under Advanced, as my build is quite large.
** Side Note: If you want this to work in the Ubuntu subsystem (WLS) as opposed to PowerShell, you’ll need to add the following line to ~/.bash_profile
export DOCKER_HOST=tcp://localhost:2375
Drone for Windows
You’ll need Drone CLI for Windows - Installation | Drone
The download will be a tarball, which isn’t very windows friendly, but you can unzip this with 7zip.
Inside the tarball you’ll find drone.exe. You can place this in your system32 folder so you can access it from powershell without having to type in the full path.
Run
Now if everything is cherries and chocolate you should be able to run. Open up PowerShell to the folder of your .drone.yml (shift + right click the folder and select Open PowerShell window here) and run:
drone exec
If you have secrets, you can make a properties file with your secrets and do:
drone exec --secret-file=c:\secrets.txt