我尝试设置一个支持尽可能多的语言/平台的 concourse 构建服务器 ( http://concourse-ci.org/)。
我读到过,从 Windows Server 2016 开始,可以将 Windows 作为容器。正如 concourse 在其网站上所写的那样,支持多个平台(包括 Windows),我想知道这是否意味着可以使用 Windows 容器?
如果无法运行 Windows 容器,我能否以某种方式让 concourse 启动 VM 而不是容器?
最佳答案
不幸的是,我只能找到一个页面。我也尝试过像 hello world 这样更简单的管道,但无法让它工作。只是分享也许有人可以从中受益 it .
我省略了生成 ssh key 、准备 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”文件复制到那里。
我们将使用“tsakey.pub”提供我们的本地 concourse 二进制文件这一事实表明我们以加密方式信任来 self 们部署的 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
关于windows - 与 Windows 容器汇合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38324845/