Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58705

Change default working dir to /home/jenkins/agent

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • kubernetes-plugin
    • None

      The current default /home/jenkins causes some issues in some scenarios:

      When building a docker image with kaniko that is actually a jnlp agent image, since the specified workingDir is mounted as a volume in all containers in the pod, and it is also the home directory for the jenkins user, it prevents adding any file to /home/jenkins in the docker image.

      Changing the default working directory to /home/jenkins/agent should not have any downside except for users hardcoding stuff to it, while allowing this kind of scenarios in an easier way.

          [JENKINS-58705] Change default working dir to /home/jenkins/agent

          Giuseppe Valente added a comment - - edited

          This required a configuration change, without any changes it causes this error when using docker image::

           

          Error: docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/home/jenkins/agent/workspace/myjob\") set in config.json failed: permission denied": unknown.

           

          It should at least be release-noted.

          Giuseppe Valente added a comment - - edited This required a configuration change, without any changes it causes this error when using docker image: :   Error: docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/home/jenkins/agent/workspace/myjob\") set in config.json failed: permission denied": unknown.   It should at least be release-noted.

          Andrew Feller added a comment - - edited

          This change should have facilitated the use case without breaking backwards compatibility for everyone else as the use of the older working directory should have been noted as a deprecated expectation. It is clear it was made without any thought to the actual impact to others as there are situation where "just use the env var" is not enough of a solution to everything.

          Andrew Feller added a comment - - edited This change should have facilitated the use case without breaking backwards compatibility for everyone else as the use of the older working directory should have been noted as a deprecated expectation. It is clear it was made without any thought to the actual impact to others as there are situation where "just use the env var" is not enough of a solution to everything.

          Adam Olejar added a comment -

          How did you solved that error ?

          Error: docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "chdir to cwd (\"/home/jenkins/workspace/MCO_3.0/custom_test\") set in config.json failed: permission denied": unknown.

          Adam Olejar added a comment - How did you solved that error ? Error: docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "chdir to cwd (\"/home/jenkins/workspace/MCO_3.0/custom_test\") set in config.json failed: permission denied": unknown.

            vlatombe Vincent Latombe
            vlatombe Vincent Latombe
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: