Skip to content

Conversation

@mcayland-ntx
Copy link

The existing logic in the Decorator class sets hasWorkDir if the docker version is newer than 17.12. In the case where hasWorkDir is false, the fallback logic in the decorate() method updates the starter cmds() but always uses a UNIX-like "sh" command, which causes Jenkins to hang and timeout when using Windows Containers.

Update the logic in the decorate() method to provide an implementation for Windows Containers that prepends the appropriate "cd" command followed by && to the generated command.

Testing done

This change was tested using Jenkins to build Windows Containers using nerdctl/containerd as a Docker replacement using the docker-workflow-plugin. The codepath in question is not normally used, but is triggered because nerdctl reports a version of 2.1.6 which is earlier than 17.12.

Without this patch, Jenkins hangs when executing the bat container step due to the UNIX-style "sh" fallback implemented which blocks and eventually causes the build to timeout.

If the automated test coverage is using the official Docker installer then it is impossible to trigger this codepath because it always reports a version later than 17.12.

Related issues:
https://issues.jenkins.io/browse/JENKINS-75102
#326

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

The existing logic in the Decorator class sets hasWorkDir if the docker
version is newer than 17.12. In the case where hasWorkDir is false, the
fallback logic in the decorate() method updates the starter cmds() but
always uses a UNIX-like "sh" command, which causes Jenkins to hang and
timeout when using Windows Containers.

Update the logic in the decorate() method to provide an implementation
for Windows Containers that prepends the appropriate "cd" command
followed by && to the generated command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant