最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin7PV0评论

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?

Post a comment

comment list (0)

  1. No comments so far