[JIRA] (JENKINS-52591) Job DSL does not track manual changes correctly

2 views
Skip to first unread message

aszostak@partner.eso.org (JIRA)

unread,
Jul 16, 2018, 3:12:02 PM7/16/18
to jenkinsc...@googlegroups.com
Artur Szostak created an issue
 
Jenkins / Bug JENKINS-52591
Job DSL does not track manual changes correctly
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 2018-07-16 19:11
Priority: Minor Minor
Reporter: Artur Szostak

The following Job DSL creates a job called test that will always show the message "This item has been changed manually since it was generated by the seed job." after test has been triggered:

pipelineJob('test') {
    definition {
        cps {
            script('''
                pipeline {
                    agent any
                    stages {
                        stage('build') {
                            steps {
                                echo 'building'
                            }
                        }
                    }
                }
            ''')
        }
    }
}
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

mail@daniel-spilker.com (JIRA)

unread,
Jul 25, 2018, 7:24:12 AM7/25/18
to jenkinsc...@googlegroups.com
Daniel Spilker updated Bug JENKINS-52591
 

The problem is that some plugin (I assume it's Declarative Pipeline) modifies the configuration during or after a build. Job DSL can't differentiate between user changes and automatic changes, so it's will show the warning. IMHO it's debatable if a plugin should modify the job configuration instead of storing the information in build. There are other plugins that also modify the configuration. And that causes issues for other plugins as well, e.g. for the Job Config History plugin.

Configuration generated by Job DSL:

<?xml version="1.0" encoding="UTF-8"?><flow-definition>
    <actions/>
    <description/>
    <keepDependencies>false</keepDependencies>
    <properties/>
    <triggers/>
    <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition">
        <script>
                pipeline {
                    agent any
                    stages {
                        stage('build') {
                            steps {
                                echo 'building'
                            }
                        }
                    }
                }
            </script>
        <sandbox>false</sandbox>
    </definition>
</flow-definition>

Configuration after first build:

<?xml version='1.0' encoding='UTF-8'?>
<flow-definition plugin="workfl...@2.21">
  <actions>
    <org.jenkinsci.plugins.pipeline.modeldefinition.actions.DeclarativeJobAction plugin="pipeline-mod...@1.3.1"/>
  </actions>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties/>
  <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workfl...@2.53">
    <script>
                pipeline {
                    agent any
                    stages {
                        stage(&apos;build&apos;) {
                            steps {
                                echo &apos;building&apos;
                            }
                        }
                    }
                }
            </script>
    <sandbox>false</sandbox>
  </definition>
  <triggers/>
  <disabled>false</disabled>
</flow-definition>
Change By: Daniel Spilker
Status: Open Fixed but Unreleased
Resolution: Not A Defect

aszostak@partner.eso.org (JIRA)

unread,
Jul 26, 2018, 4:41:01 AM7/26/18
to jenkinsc...@googlegroups.com
Artur Szostak commented on Bug JENKINS-52591
 
Re: Job DSL does not track manual changes correctly

I do not agree with the assessment that this is not a defect. It is fundamentally a design flaw. I am not saying it is necessarily the job-dsl-plugin's fault. But clearly the set of assumptions and working model that it is using is not compatible with other plugins. If this software was standalone one could say, tough luck, that is just how the thing works. But it is not standalone. It is a plugin that forms part of a larger system. Therefore I consider it a design flaw.
Very likely it is not currently solvable by the job-dsl-plugin, because as you mention, Jenkins does not provide a mechanism to distinguish manual from automatic modifications. But then this should be raised with the core system, rather than dismissing it as not a flaw.

spinus1@gmail.com (JIRA)

unread,
Apr 12, 2019, 3:03:02 AM4/12/19
to jenkinsc...@googlegroups.com

Hello,

I'm experiencing a similar issue, but in a more complicated workflow: I have a DSL job that creates other jobs and these jobs are using separate repository to get the pipeline code to be executed: the DSL plugin always report that the job has been manually modified.

Maybe the DSL plugin could be modified to compare current Job configuration to the one generated by the first run of the pipeline and not to the configuration generated by DSL plugin itself?

 

BR,

Alessio

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

robin.jansohn@zf.com (JIRA)

unread,
May 6, 2019, 3:56:02 AM5/6/19
to jenkinsc...@googlegroups.com

Artur Szostak have you raised an issue with the core system for this problem? I agree with you that the current behavior is fundamentally flawed...

aszostak@partner.eso.org (JIRA)

unread,
May 8, 2019, 6:59:02 AM5/8/19
to jenkinsc...@googlegroups.com

No, I have not raised this issue any further, since I do not know the Jenkins development model well enough to know where to send the report and how to structure it to make any sense. The only obvious report I could think of making was this ticket with a reproducible example for job-dsl-plugin. I rely on actual Jenkins developers with far more knowledge about the internals to triage the tickets and redirect them to the appropriate place as necessary.

Reply all
Reply to author
Forward
0 new messages