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

In order to avoid having builds that run for a long time only to fail at the end with docker push becau

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?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745622233a4636589.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信