Skip to content

[JENKINS-75087] Provide way to disable mounting Jenkins workspace #726

Description

@jenkins-infra-bot

Currently the Jenkins workspace is always mounted. This might not be desirable in all cases (such as JENKINS-74912). It also prevents users from using their own workdir parameter.

Provide a way do disable the default mounting of the workspace. Example:

docker.image('myregistry.com/myrepository/myimage:latest').inside(mountWorkspace=false) {
    bat 'echo test'
}

Originally reported by mrichar2, imported from: Provide way to disable mounting Jenkins workspace
  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin
  • label(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07
Raw content of original issue

Currently the Jenkins workspace is always mounted. This might not be desirable in all cases (such as JENKINS-74912). It also prevents users from using their own workdir parameter.

Provide a way do disable the default mounting of the workspace. Example:

docker.image('myregistry.com/myrepository/myimage:latest').inside(mountWorkspace=false) {
    bat 'echo test'
}

Activity

  1. jenkins-infra-bot commented on Jan 8, 2025

    @jenkins-infra-bot
    Author
    mrichar2:
    • Comment link
    • Original comment link (no redirect)
    • Raw content of original comment:

      This might not be possible with the current design. The plugin ends up running a DurableTask which in turn uses a FileMonitoringTask.StatusCheck to track the state of the process launched in docker. This looks for a file in $WORKSPACE@tmp/durable-<some_id>/jenkins-result.txt which normally contains the result of the command run in the container written to by the script $WORKSPACE@tmp/durable-<some_id>/jenkins-wrap.bat. There is a log file and a jenkins-main.bat file that ends up there too.

      Basically at least some type of mount is needed since the durable task plugin uses the filesystem for wrapping launched commands and tracking the launched command log and output. Allowing the user to skip mounting the workspace without ensuring they somehow mount it elsewhere will result in the steps executed in the docker image to hang.

    This might not be possible with the current design. The plugin ends up running a DurableTask which in turn uses a FileMonitoringTask.StatusCheck to track the state of the process launched in docker. This looks for a file in $WORKSPACE@​tmp/durable-/jenkins-result.txt which normally contains the result of the command run in the container written to by the script $WORKSPACE@​tmp/durable-/jenkins-wrap.bat. There is a log file and a jenkins-main.bat file that ends up there too.

    Basically at least some type of mount is needed since the durable task plugin uses the filesystem for wrapping launched commands and tracking the launched command log and output. Allowing the user to skip mounting the workspace without ensuring they somehow mount it elsewhere will result in the steps executed in the docker image to hang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions