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

CLI update-job and POSTing config.xml cannot remove properties

      The custom workspace of a Jenkins job cannot be removed by the CLI using update-job.

      Steps to reproduce:
      1. Have a job with a custom workspace.
      2. Remove the custom workspace using the Jenkins java CLI (having a second job without the custom workspace and doing <cli> -get-job <second job> | <cli> update-job <job> is how we encountered this problem).
      3. Note that the config.xml of the job no longer references a custom workspace.
      4. Open the job in the Web GUI. Note that the custom workspace is there, and a save of the job without doing any updates will put the custom workspace configuration back into the config.xml file for the job.

      Bottom line - to remove the custom workspace, one either needs to do it via the web GUI, or do a restart of the Jenkins instance after doing it via the CLI.

      Side note: the " and some other characters are save differently when updating a job via the CLI vs. the Web GUI.

      Example: double quotes " will be changed to '"' in config.xml through CLI method.

          [JENKINS-21017] CLI update-job and POSTing config.xml cannot remove properties

          Roy Zeng created issue -

          additional-identities plugins has nothing to do with the ticket.
          It's a CLI issue. And a bit of a GUI issue since it's not being updated properly.

          Sagi Sinai-Glazer added a comment - additional-identities plugins has nothing to do with the ticket. It's a CLI issue. And a bit of a GUI issue since it's not being updated properly.
          Sagi Sinai-Glazer made changes -
          Component/s New: cli [ 15624 ]
          Component/s Original: additional-identities [ 17451 ]
          Labels New: gui jenkins
          Jesse Glick made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: cli [ 15624 ]
          Labels Original: gui jenkins New: cli custom-workspace

          Jesse Glick added a comment -

          AbstractItem.updateByXml does not support undefining a field (customWorkspace in this case). I am not even sure how it would be done; XStream does not seem to directly support this.

          Jesse Glick added a comment - AbstractItem.updateByXml does not support undefining a field ( customWorkspace in this case). I am not even sure how it would be done; XStream does not seem to directly support this.
          Daniel Beck made changes -
          Link New: This issue is duplicated by JENKINS-24657 [ JENKINS-24657 ]
          Daniel Beck made changes -
          Affects Version/s Original: current [ 10162 ]
          Environment Original: Red Hat Enterprise Linux Server release 6.4 (Santiago)
          Virtual Machine
          Summary Original: Jenkins CLI update-job misses custom workspace deletion New: Jenkins CLI update-job and POSTing config.xml cannot remove properties

          Daniel Beck added a comment -

          Related Cloudbees issue for their Template plugin experiencing the same problem:
          https://rm.cloudbees.com/issues/1346

          Daniel Beck added a comment - Related Cloudbees issue for their Template plugin experiencing the same problem: https://rm.cloudbees.com/issues/1346
          Daniel Beck made changes -
          Link New: This issue is duplicated by JENKINS-23291 [ JENKINS-23291 ]

            jglick Jesse Glick
            royzeng Roy Zeng
            Votes:
            16 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved: