Drone 1.0.0-rc5 and Windows setup help needed

Hi,

I am trying to make a pipeline run on a windows agent but the agent does not seem to start correctly…
Here’s my .drone.yml:

kind: pipeline
name: simulator-windows

platform:
  os: windows
  arch: amd64

steps:
- name: setup
  build:
    image: simulator_build_windows
    context: docker
    dockerfile: docker/Dockerfile.windows

- name: build
  image: simulator_build_windows
  commands:
  - ./build_simulator.ps1

Here’s my server log:

2019-01-28T16:13:32.017323353Z {"commit":"313709014ffae8165c010afe7c2a1a38cd4da7a6","event":"push","level":"debug","msg":"webhook parsed","name":"simulator","namespace":"amoran","time":"2019-01-28T16:13:32Z"}
2019-01-28T16:13:32.017685056Z {"commit":"313709014ffae8165c010afe7c2a1a38cd4da7a6","event":"push","level":"debug","msg":"trigger: received","ref":"refs/heads/drone","repo":"amoran/simulator","time":"2019-01-28T16:13:32Z"}
2019-01-28T16:13:34.592587521Z {"fields.time":"2019-01-28T16:13:34Z","latency":2576355086,"level":"debug","method":"POST","msg":"","remote":"172.16.0.60:60000","request":"/hook","request-id":"1GP0dPMqPoEi71pIsK3sIDiQ4lA","time":"2019-01-28T16:13:34Z"}
2019-01-28T16:13:55.189931918Z {"admin":true,"level":"debug","msg":"api: access granted","name":"simulator","namespace":"amoran","read":true,"request-id":"1GP0gIpreuqy2dYO39lpgp8rK60","time":"2019-01-28T16:13:55Z","user.login":"amoran","visibility":"private","write":true}
2019-01-28T16:13:55.190845300Z {"admin":true,"level":"debug","msg":"api: access granted","name":"simulator","namespace":"amoran","read":true,"request-id":"1GP0gKAMeYrDfDk69Ck4yQK8vFU","time":"2019-01-28T16:13:55Z","user.login":"amoran","visibility":"private","write":true}
2019-01-28T16:13:55.190898794Z {"fields.time":"2019-01-28T16:13:55Z","latency":1945097,"level":"debug","method":"GET","msg":"","remote":"172.17.2.129:32874","request":"/api/repos/amoran/simulator","request-id":"1GP0gKAMeYrDfDk69Ck4yQK8vFU","time":"2019-01-28T16:13:55Z"}
2019-01-28T16:13:55.191775882Z {"fields.time":"2019-01-28T16:13:55Z","latency":3334996,"level":"debug","method":"GET","msg":"","remote":"172.17.2.129:32872","request":"/api/repos/amoran/simulator/builds?page=1","request-id":"1GP0gIpreuqy2dYO39lpgp8rK60","time":"2019-01-28T16:13:55Z"}
2019-01-28T16:13:56.867185399Z {"admin":true,"level":"debug","msg":"api: access granted","name":"simulator","namespace":"amoran","read":true,"request-id":"1GP0gLtD6RKqB5PIXLL2SwggES9","time":"2019-01-28T16:13:56Z","user.login":"amoran","visibility":"private","write":true}
2019-01-28T16:13:56.867239452Z {"fields.time":"2019-01-28T16:13:56Z","latency":858563,"level":"debug","method":"GET","msg":"","remote":"172.17.2.129:32872","request":"/api/repos/amoran/simulator","request-id":"1GP0gLtD6RKqB5PIXLL2SwggES9","time":"2019-01-28T16:13:56Z"}
2019-01-28T16:13:56.867334008Z {"admin":true,"level":"debug","msg":"api: access granted","name":"simulator","namespace":"amoran","read":true,"request-id":"1GP0gM6NdBj4ejGkbZ0kW3utDvt","time":"2019-01-28T16:13:56Z","user.login":"amoran","visibility":"private","write":true}
2019-01-28T16:13:56.868421746Z {"fields.time":"2019-01-28T16:13:56Z","latency":1814616,"level":"debug","method":"GET","msg":"","remote":"172.17.2.129:32874","request":"/api/repos/amoran/simulator/builds/4","request-id":"1GP0gM6NdBj4ejGkbZ0kW3utDvt","time":"2019-01-28T16:13:56Z"}

and here’s my agent’s log:

2019-01-28T16:08:12.831488700Z {"level":"info","msg":"starting the build runner","server":"172.17.0.39","threads":2,"time":"2019-01-29T02:08:12+01:00"}

I am trying to build some C++ code using MSBuild/cl.

Have you got any hint, guide or tutorial on how to achieve this?
Thank you so much for your support!

Please enable trace logging on the agent with DRONE_LOGS_TRACE=true and post the logs. This will generate significant output. You may see timeout errors and retries in the logs which may be expected, so we will need to analyze the logs and separate expected errors from unexpected errors prior to coming to any conclusions.

I’m not sure how you are starting the agent but I used the Windows Agent Documentation.

> docker run `
  --volume=//./pipe/docker_engine://./pipe/docker_engine `
  --env=DRONE_RPC_SERVER=$env['DRONE_RPC_SERVER'] `
  --env=DRONE_RPC_SECRET=$env['DRONE_RPC_SECRET'] `
  --env=DRONE_RUNNER_CAPACITY=2 `
  --restart=always `
  --detach=true `
  --name=agent `
  drone/agent:1.0.0-rc.5

You mentioned that you were using 8080 as a port so I would assume you’d have something like this before

> $env['DRONE_RPC_SERVER'] = 'http://drone.mycompany.com:8080';

There are a couple other things of note when using Windows + Docker but I feel like that should be a separate conversation after you get a build running.

Note that the plugins are not all ported to Windows yet. Its an ongoing process that should hopefully be working soon.

Hey, so yes, I was wrong, I put only the address without port, then with port (but the agent did not like it) and finally with http:// and then it seemed to work.
On the other hand, I saw other issues.

When I tried to build an image on windows on a pipeline, I couldn’t and the runner showed this log message:

2019-01-29T11:31:03.930092300Z {"arch":"amd64","build":8,"error":"Error response from daemon: invalid mount config for type \"bind\": invalid mount path: '/var/run/docker.sock'","level":"debug","machine":"3101af17f5ec","msg":"runner: received kill signal","os":"windows","pipeline":"akida-windows","repo":"amoran/Akida_simulator","stage":2,"time":"2019-01-29T21:31:02+01:00"}

So I just tried to skip the setup part of the pipeline, bring up a local docker registry where I pushed the windows imaged and then tried to build it. But then now I am hitting the cl.exe wall.
When I try to compile my project everything stops very soon because of this cmake error:

"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe"
is not able to compile a simple test program.

Talking with don yesterday the problem seems to be due to the fact that drone builds in a mounted volume, and msbuild has some troubles with that. Have you got any hint on how to work around this issue?

invalid mount config for type \"bind\": invalid mount path: '/var/run/docker.sock

The below syntax is unsupported. There is an open github issue where we have been discussing native docker build and docker push syntax, but this is not fully implemented, which is why you are getting an error message.

- name: setup
  build:
    image: simulator_build_windows
    context: docker
    dockerfile: docker/Dockerfile.windows

Hey Brad, yes, thank you for the answer. I ended up building the image outside drone and pushing it to a local registry.
And to work around the msbuild/cl issue, I just ended up telling my build script to build in another directory (c:\build) and it works like a charm.
Thanks for the help and for the project!