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

Post build step not removed from generated Maven job

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: job-dsl-plugin
    • Labels:
      None
    • Environment:
      core 1.609.3
      job-dsl-plugin 1.38
      maven-plugin 2.12
    • Similar Issues:

      Description

      Removing postBuildSteps block from a job-dsl script does not remove the post build step on the generated job. To reproduce, create a job-dsl seed job with this script:

      mavenJob('example') {
        goals 'clean install'
        postBuildSteps { maven { goals "sonar:sonar -Psonar" } }
      }
      

      Remove postBuildSteps block and run job-dsl seed job again. Configuration page of generated job example will still contain the post build step.

      On disk config.xml of generated job doesn't have <postbuilders/> section anymore. Reloading generated job using a groovy script in system console doesn't help. Only restarting Jenkins works. That makes me think that the bug is in Maven plugin but not in JobDSL plugin. Something is wrong when reloading config.xml of generated job.

        Attachments

          Issue Links

            Activity

            Hide
            daspilker Daniel Spilker added a comment -

            As I mentioned in JENKINS-26825, this is caused by another issue, JENKINS-21017. The Job DSL plugin, the CLI and the REST API all use a similar API and the problem exists for all those components and needs to be fixed in Jenkins core or the xstream library.

            Show
            daspilker Daniel Spilker added a comment - As I mentioned in JENKINS-26825 , this is caused by another issue, JENKINS-21017 . The Job DSL plugin, the CLI and the REST API all use a similar API and the problem exists for all those components and needs to be fixed in Jenkins core or the xstream library.
            Hide
            danielbeck Daniel Beck added a comment -

            Could Job DSL work around this particular issue by always generating an empty postBuildSteps container element? It's only a major issue if you cannot find an "empty value" (e.g. no custom workspace value is equivalent to the default workspace), otherwise is mostly just annoying.

            Show
            danielbeck Daniel Beck added a comment - Could Job DSL work around this particular issue by always generating an empty postBuildSteps container element? It's only a major issue if you cannot find an "empty value" (e.g. no custom workspace value is equivalent to the default workspace), otherwise is mostly just annoying.
            Hide
            ydubreuil Yoann Dubreuil added a comment - - edited

            Thanks Daniel Beck ! Putting an empty postBuildSteps block instead of removing it works around the issue.

            Show
            ydubreuil Yoann Dubreuil added a comment - - edited Thanks Daniel Beck ! Putting an empty postBuildSteps block instead of removing it works around the issue.
            Hide
            danielbeck Daniel Beck added a comment -

            I meant that Job DSL could do this automagically for the usual top-level elements in a config.xml, but I'm glad it inspired a workaround!

            Show
            danielbeck Daniel Beck added a comment - I meant that Job DSL could do this automagically for the usual top-level elements in a config.xml, but I'm glad it inspired a workaround!
            Hide
            ydubreuil Yoann Dubreuil added a comment -

            Unlike what I said before, I can't make the workaround work. I think I mis-tested it on first step. A proper fix for JENKINS-21017 is needed here.

            Show
            ydubreuil Yoann Dubreuil added a comment - Unlike what I said before, I can't make the workaround work. I think I mis-tested it on first step. A proper fix for JENKINS-21017 is needed here.
            Hide
            ydubreuil Yoann Dubreuil added a comment -

            I found another workaround which seems to work all time. Instead of using a empty postBuildSteps, you can force Job DSL to generate the empty XML node with

             configure { it / 'postbuilders' } 

            Not really nice, but it works!

            Show
            ydubreuil Yoann Dubreuil added a comment - I found another workaround which seems to work all time. Instead of using a empty postBuildSteps , you can force Job DSL to generate the empty XML node with configure { it / 'postbuilders' } Not really nice, but it works!
            Hide
            jglick Jesse Glick added a comment -

            Verified duplicate of JENKINS-21017.

            Show
            jglick Jesse Glick added a comment - Verified duplicate of JENKINS-21017 .

              People

              Assignee:
              daspilker Daniel Spilker
              Reporter:
              ydubreuil Yoann Dubreuil
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: