Concourse with Windows Containers
Asked Answered
C

2

8

I try to setup a concourse build server (http://concourse-ci.org/) that supports as many languages/platforms as possible.

I've read that beginning with Windows Server 2016 it will be possible to have Windows as containers. As concourse writes on its website that multiple platforms are supported (including Windows) I wonder if this means that it is possible to use Windows containers?

If it is not possible to run Windows containers, can I somehow make concourse spin up VMs instead of containers?

Chert answered 12/7, 2016 at 9:25 Comment(1)
Did you ever find a way to make this work? I asked and was told that it isn't supported.Agreeable
C
5

Unfortunately, there is just a page I am able to find. I also tried it with simplier pipelines like hello world, but could not get it work. Just sharing maybe someone can benefit from it.

I left out parts like generating ssh key, preparing TSA.

Preparing The Windows Worker

Now we turn our attention to our Windows server that we'll be turning in to a Concourse worker.

First we'll want to establish a directory to house our binaries for the worker service and its data i.e. C:\concourse

C:\> mkdir concourse
C:\> cd concourse
C:\concourse>

Now download the Windows concourse binary (named something like "concourse_windows_amd64.exe") from the Concourse download page and place it in our working directory. Also, we'll want to copy the "tsakey.pub" and "workerkey" files there as well.

The fact that we'll provide our local concourse binary with "tsakey.pub" establishes that we cryptographically trust the TSA server from our deployment.

We're now ready to start the worker and have it register itself with the TSA.

C:\concourse> .\concourse_windows_amd64.exe worker \
/work-dir .\work /tsa-host <IP of the TSA> \
/tsa-public-key .\tsakey.pub \
/tsa-worker-private-key .\workerkey

If all goes well we should see output similar to:

{"timestamp":"1478361158.394949198","source":"tsa","message":"tsa.connection.forward-worker.register.done","log_level":1
,"data":{"remote":"<IP:SOURCE-PORT of the TSA>","session":"3.1.4","worker-address":"<IP:PORT of this worker>","worker-platform":"windows",
"worker-tags":""}}

and the new worker should appear in the list via the Concourse CLI as such:

~/  $ fly -t ci workers
name            containers  platform  tags  team
2a334e70-c75c   3           linux     none  none
WORKERSHOSTNAME 0           windows   none  none

Testing Things Out

Assuming the .NET framework is present on our Worker with the build tools in the path we could test this out by building this simple .NET Console app project: https://github.com/chrisumbel/DatDotNet.git.

Consider the pipeline:

resources:  
  - name: code  
    type: git  
    source:  
      uri: https://github.com/chrisumbel/DatDotNet.git  
      branch: master  
jobs:  
  - name: build  
    plan:  
    - aggregate:  
      - get: code  
        trigger: true  
    - task: compile  
      privileged: true  
      file: code/Pipeline/compile.yml

with the build task:

platform: windows      
inputs:  
  - name: code  
run:  
  dir: code  
  path: msbuild

Note that the platform specified in the build task is "windows". That instructs concourse to place the task on a Windows worker.

If all went well we should see a successful build with output similar to:

~/ $ fly -t ci trigger-job -j datdotnet/build --watch
started datdotnet/build #8

using version of resource found in cache
initializing
running msbuild
Microsoft (R) Build Engine version 4.6.1085.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 11/5/2016 4:04:00 PM.
...
nces, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [C:\concourse\work\containers\00000arl2se\tmp\build\36d0981b\code\DatDotNet\DatDotNet.csproj]

    3 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.22
succeeded
Cephalothorax answered 6/3, 2017 at 11:22 Comment(2)
This would cause the build to occur on the worker not a container on the worker.Agreeable
how to differentiate from Debug and Release config?Persevere
I
0

In theory it should be possible to do this through Garden-Windows, since Concourse delegates all containerising to the Garden API.

Having never done this before, I'd have no clue where to begin.

Ipswich answered 19/8, 2016 at 14:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.