8

我尝试设置一个支持尽可能多的语言/平台的大厅构建服务器( http://concourse-ci.org/ )。

我读过从 Windows Server 2016 开始,可以将 Windows 作为容器。正如 concourse 在其网站上写道支持多个平台(包括 Windows),我想知道这是否意味着可以使用 Windows 容器?

如果无法运行 Windows 容器,我能否以某种方式让大厅启动虚拟机而不是容器?

4

2 回答 2

5

不幸的是,我只能找到一个页面。我还尝试使用 hello world 等更简单的管道,但无法正常工作。只是分享也许有人可以从中受益。

我省略了生成 ssh 密钥、准备 TSA 等部分。

准备 Windows Worker

现在我们将注意力转向我们的 Windows 服务器,我们将把它交给 Concourse 工作人员。

首先,我们要建立一个目录来存放我们的工作服务及其数据的二进制文件,即 C:\concourse

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

现在从 Concourse 下载页面下载 Windows concourse 二进制文件(命名为“concourse_windows_amd64.exe”)并将其放在我们的工作目录中。此外,我们还想将“tsakey.pub”和“workerkey”文件复制到那里。

我们将为我们的本地大厅二进制文件提供“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":""}}

并且新工作人员应该通过 Concourse CLI 出现在列表中,如下所示:

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

测试事物

假设 .NET 框架存在于我们的 Worker 上,构建工具在路径中,我们可以通过构建这个简单的 .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”。这指示大厅将任务放在 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
于 2017-03-06T11:22:01.513 回答
0

理论上,应该可以通过Garden-Windows做到这一点,因为 Concourse 将所有容器化委托给 Garden API。

以前从未这样做过,我不知道从哪里开始。

于 2016-08-19T14:36:55.447 回答