我尝试设置一个支持尽可能多的语言/平台的大厅构建服务器(http://concourse-ci.org/)。
我读到过,从Windows Server 2016开始,将有可能使用Windows作为容器。当concourse在其网站上写道支持多种平台(包括Windows)时,我想知道这是否意味着可以使用Windows容器?
如果不能运行Windows容器,我能以某种方式让concourse启动VM而不是容器吗?
发布于 2017-03-06 19:22:02
不幸的是,我只能找到一个页面。我也尝试过使用更简单的管道,比如hello world,但不能让它工作。只是分享一下,也许有人可以从it中受益。
我省略了一些部分,比如生成ssh密钥,准备TSA。
准备Windows Worker
现在,我们将注意力转向Windows服务器,该服务器将转向Concourse worker。
首先,我们需要建立一个目录来存放worker服务的二进制文件及其数据,即C:\concourse
C:\> mkdir concourse
C:\> cd concourse
C:\concourse>现在从concourse下载页面下载Windows Concourse二进制文件(名称类似于"concourse_windows_amd64.exe"),并将其放入我们的工作目录中。此外,我们还希望将"tsakey.pub“和"workerkey”文件复制到那里。
我们将为本地concourse二进制文件提供"tsakey.pub“,这一事实证明了我们从部署中以加密方式信任TSA服务器。
我们现在已经准备好启动worker,并让它向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如果一切顺利,我们应该会看到类似如下的输出:
{"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":""}}新的worker应通过Concourse CLI出现在列表中:
~/ $ fly -t ci workers
name containers platform tags team
2a334e70-c75c 3 linux none none
WORKERSHOSTNAME 0 windows none none测试一些东西
假设.NET框架存在于我们的Worker上,构建工具在path中,我们可以通过构建这个简单的.NET控制台应用程序项目来测试这一点:https://github.com/chrisumbel/DatDotNet.git。
考虑一下管道:
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使用构建任务:
platform: windows
inputs:
- name: code
run:
dir: code
path: msbuild请注意,在构建任务中指定的平台是"windows“。它指示concourse将任务放在Windows工作线程上。
如果一切顺利,我们应该会看到一个成功的构建,输出类似于:
~/ $ 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发布于 2016-08-19 22:36:55
从理论上讲,应该可以通过Garden-Windows来实现这一点,因为Concourse将所有的容器化都委托给了Garden API。
我以前从来没有这样做过,所以我不知道从哪里开始。
https://stackoverflow.com/questions/38324845
复制相似问题