最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

cakebuild - How to enforce a timeout for calling DockerImageLs in Cake? - Stack Overflow

programmeradmin1浏览0评论

In order to avoid having builds that run for a long time only to fail at the end with docker push because some issue with docker not running (properly), I want builds to fail immediately then and have added a task "FailFastIfDockerIsNotWorking" as the very first task, and it just calls DockerImageLs as a smoke test to see that docker is working.

However recently there was a build that hang on that task until the whole build timed out because of some issue with docker not running properly.

So I would like to add a timeout to DockerImageLs to avoid that happening again. My attempt was the following:

Task("FailFastIfDockerIsNotWorking")
    .Does<Config>((config) =>
{
    // .Docker/DockerAliases/832AACA7
    // .Docker/DockerImageLsSettings/
    var settings = new DockerImageLsSettings();
    // .Core.Tooling/ToolSettingsExtensions/102470BF
    settings.WithToolTimeout(TimeSpan.FromSeconds(30));
    var images = DockerImageLs(settings);
    Information($"{images.Count()} images present");
});

however when running it fails with

========================================
FailFastIfDockerIsNotWorking
========================================
unknown flag: --tool-timeout
See 'docker image ls --help'.
An error occurred when executing task 'FailFastIfDockerIsNotWorking'.
Error: Docker: Process returned an error (exit code 125).

Looking at the implementation of the ToolTimeout setting I expected WithToolTimeout to work and was surprised to discover that it somehow was translated to a command line option instead.

So how do I enforce a timeout when calling DockerImageLs?

发布评论

评论列表(0)

  1. 暂无评论