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

Setting working directory to '/home/jenkins' does not persist

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • kubernetes:1.18.0 and later
    • kubernetes 1.24.0

      Since the change of default working directory from /home/jenkins to home/jenkins/agent (see JENKINS-58705), it is possible to change the working directory back to /home/jenkins but this does not survive a restart.

      This behavior is quite confusing.

      Reproduce

      • Create a pod template and set the working Directory to /home/jenkins
      • Restart Jenkins
      • Check the pod template configuration

      *Expected*

      • The pod template configuration hasn't changed. The working directory is /home/jenkins

      *Actual*

      • The pod template configuration has changed. The working directory is /home/jenkins/agent.

      Source

      The descriptor migrates the value: https://github.com/jenkinsci/kubernetes-plugin/blob/kubernetes-1.21.1/src/main/java/org/csanchez/jenkins/plugins/kubernetes/ContainerTemplate.java#L435-L441

      Workaround

      A reliable way to use /home/jenkins as a working directory use YAML definition to define container templates

          [JENKINS-60977] Setting working directory to '/home/jenkins' does not persist

          Allan BURDAJEWICZ created issue -
          Allan BURDAJEWICZ made changes -
          Link New: This issue is caused by JENKINS-58705 [ JENKINS-58705 ]

          We should at least warn users of such behavior. We may also add a way to control this (for example a system property that allow to disable the migration / enforcement at https://github.com/jenkinsci/kubernetes-plugin/blob/kubernetes-1.21.1/src/main/java/org/csanchez/jenkins/plugins/kubernetes/ContainerTemplate.java#L435-L441)

          Allan BURDAJEWICZ added a comment - We should at least warn users of such behavior. We may also add a way to control this (for example a system property that allow to disable the migration / enforcement at https://github.com/jenkinsci/kubernetes-plugin/blob/kubernetes-1.21.1/src/main/java/org/csanchez/jenkins/plugins/kubernetes/ContainerTemplate.java#L435-L441 )
          Vincent Latombe made changes -
          Assignee New: Vincent Latombe [ vlatombe ]
          Vincent Latombe made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Jesse Glick added a comment -

          Maybe add form validation and/or a runtime warning suggesting users switch to the new value?

          Jesse Glick added a comment - Maybe add form validation and/or a runtime warning suggesting users switch to the new value?
          Vincent Latombe made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Vincent Latombe made changes -
          Remote Link New: This issue links to "PR #713 (Web Link)" [ 24503 ]
          Vincent Latombe made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Fixed but Unreleased [ 10203 ]
          Vincent Latombe made changes -
          Released As New: kubernetes 1.24.0
          Status Original: Fixed but Unreleased [ 10203 ] New: Closed [ 6 ]

            vlatombe Vincent Latombe
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: