Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concourse with Windows Containers

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?

like image 598
Nathan Nash Avatar asked Jul 12 '16 09:07

Nathan Nash


People also ask

Does Windows container run on Linux?

Q: Can Windows containers run on Linux? A: No. They cannot. Containers are using the underlying operating system resources and drivers, so Windows containers can run on Windows only, and Linux containers can run on Linux only.

What is Windows server base with containers?

A Windows Server Container is a recourse controlled, isolated and portable operating environment. The container shares some operating system kernel code with the underlying Windows Server operating system. But other than that it is truly an autonomous operating system environment.

What is container window?

Containers are a technology for packaging and running Windows and Linux applications across diverse environments on-premises and in the cloud. Containers provide a lightweight, isolated environment that makes apps easier to develop, deploy, and manage.

What is ATC concourse?

ATC. Runs an HTTP server that: Runs the Concourse web UI. Serves the Concourse API on port 8080, to support the Fly CLI and other tools. Schedules pipelines to run on worker VMs.


1 Answers

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
like image 60
celebi Avatar answered Sep 20 '22 21:09

celebi