小编Fre*_*ier的帖子

YamlDotNet - 自定义序列化

我有一个 .NET 类,它代表 RPC 方法调用,如下所示:

class MethodCall
{
    public string MethodName { get; set; }
    public Collection<object> Arguments { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我想将 a 序列Collection<MethodCall>化为 YAML。我正在使用 YamlDotNet 来实现此目的。

默认情况下,YamlDotNet 将像这样序列化这些对象:

methodName: someName
arguments:
- arg1
- arg2
- ...
Run Code Online (Sandbox Code Playgroud)

我想将生成的 YAML 简化为:

someName:
- arg1
- arg2
Run Code Online (Sandbox Code Playgroud)

有什么简单的方法可以实现这一目标吗?请注意,参数可以是复杂的对象(即不是简单的标量)。

.net c# yaml yamldotnet

6
推荐指数
1
解决办法
6188
查看次数

Azure DevOps 管道 - 规模集代理:安装 Docker

我们最近重新配置了我们的构建过程以完全在容器中运行,我们现在希望从本地构建代理迁移到在 Azure 规模集中使用代理。

我们希望避免为 Azure 规模集维护自己的 VM 映像,并选择使用 Azure 中提供的默认 Ubuntu 18.04 LTS 映像。

此映像不包含 Docker,因此我们已将 Azure 规模集配置为使用 cloud-config 脚本,该脚本将在 VM 首次启动时安装 Docker:

#cloud-config

apt:
  sources:
    docker.list:
      source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable
      keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88

packages:
  - docker-ce
  - docker-ce-cli

groups:
  - docker
Run Code Online (Sandbox Code Playgroud)

这似乎运行良好,但有时构建作业会失败:

Starting: Initialize containers
/usr/bin/docker version --format '{{.Server.APIVersion}}'
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
'
##[error]Exit code 1 returned from process: file name '/usr/bin/docker', arguments 'version --format '{{.Server.APIVersion}}''.
Finishing: Initialize …
Run Code Online (Sandbox Code Playgroud)

azure-devops azure-vm-scale-set azure-devops-pipelines

2
推荐指数
1
解决办法
1405
查看次数