[JIRA] (JENKINS-59402) JobDsl should respect Job post-construction initialization

11 views
Skip to first unread message

bulanovk@gmail.com (JIRA)

unread,
Sep 17, 2019, 2:04:03 AM9/17/19
to jenkinsc...@googlegroups.com
Konstantin Bulanov created an issue
 
Jenkins / Bug JENKINS-59402
JobDsl should respect Job post-construction initialization
Issue Type: Bug Bug
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 2019-09-17 06:03
Environment: Jenkins 2.168/2.193
JobDsl plugin 1.72/1.77-SNAPSHOT
Priority: Major Major
Reporter: Konstantin Bulanov

Hello!
 
we currently faced the following issue.
 
If we run the creation of job via jobDsl pipeline step (https://jenkins.io/doc/pipeline/steps/job-dsl/) with any parameters, we are getting a folder on our filesystem without "legacyIds" file in builds directory.
examples are in the bottom of this post.
The problem is that if there is no legacyIds file in builds directory, after restarting of jenkins server, we are facing long migrations for all jobs created after the previous reboot
 
 
Examples:
job created via jobDsl:

[root@server]# ls -lah builds/jobDsl_job
total 2.5K
drwxr-xr-x 1 centos centos 808K Sep 12 07:23 .
drwxr-xr-x 1 centos centos 3.1G Sep 12 07:21 ..
drwxr-xr-x 1 centos centos 808K Sep 12 07:23 1
lrwxrwxrwx 1 centos centos    2 Sep 12 07:19 lastFailedBuild -> -1
lrwxrwxrwx 1 centos centos    1 Sep 12 07:23 lastStableBuild -> 1
lrwxrwxrwx 1 centos centos    1 Sep 12 07:23 lastSuccessfulBuild -> 1
lrwxrwxrwx 1 centos centos    2 Sep 12 07:19 lastUnstableBuild -> -1
lrwxrwxrwx 1 centos centos    2 Sep 12 07:19 lastUnsuccessfulBuild -> -1

job created via manual creation:

[root@server]# ls -lah builds/manual_job
total 0
drwxr-xr-x 1 centos centos    0 Sep 12 07:21 .
drwxr-xr-x 1 centos centos 3.1G Sep 12 07:21 ..
-rw-r--r-- 1 centos centos    0 Sep 12 07:21 legacyIds
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

bulanovk@gmail.com (JIRA)

unread,
Sep 17, 2019, 2:29:02 AM9/17/19
to jenkinsc...@googlegroups.com
Konstantin Bulanov updated an issue
Change By: Konstantin Bulanov
Hello!
 
we currently faced the following issue.
 
If we run the creation of job via jobDsl pipeline step ([https://jenkins.io/doc/pipeline/steps/job-dsl/|https://www.google.com/url?q=https%3A%2F%2Fjenkins.io%2Fdoc%2Fpipeline%2Fsteps%2Fjob-dsl%2F&sa=D&sntz=1&usg=AFQjCNFphzzbQzcBk-KwGSGjshQxhQHIbw]) with any parameters, we are getting a folder on our filesystem without "*_legacyIds_*" file in builds directory.

examples are in the bottom of this post.
The problem is that if there is no *_legacyIds_* file in builds directory, after restarting of jenkins server, we are facing long migrations for all jobs created after the previous reboot
 

Pull request with fix:
  [https://github.com/jenkinsci/job-dsl-plugin/pull/1203]
 
*Examples*:
job created via jobDsl:
{code:java}

[root@server]# ls -lah builds/jobDsl_job
total 2.5K
drwxr-xr-x 1 centos centos 808K Sep 12 07:23 .
drwxr-xr-x 1 centos centos 3.1G Sep 12 07:21 ..
drwxr-xr-x 1 centos centos 808K Sep 12 07:23 1
lrwxrwxrwx 1 centos centos    2 Sep 12 07:19 lastFailedBuild -> -1
lrwxrwxrwx 1 centos centos    1 Sep 12 07:23 lastStableBuild -> 1
lrwxrwxrwx 1 centos centos    1 Sep 12 07:23 lastSuccessfulBuild -> 1
lrwxrwxrwx 1 centos centos    2 Sep 12 07:19 lastUnstableBuild -> -1
lrwxrwxrwx 1 centos centos    2 Sep 12 07:19 lastUnsuccessfulBuild -> -1
{code}

job created via manual creation:
{code:java}

[root@server]# ls -lah builds/manual_job
total 0
drwxr-xr-x 1 centos centos    0 Sep 12 07:21 .
drwxr-xr-x 1 centos centos 3.1G Sep 12 07:21 ..
-rw-r--r-- 1 centos centos    0 Sep 12 07:21 legacyIds
{code}

bulanovk@gmail.com (JIRA)

unread,
Sep 17, 2019, 4:33:02 AM9/17/19
to jenkinsc...@googlegroups.com
Konstantin Bulanov updated an issue
Hello!
 
we currently faced the following issue.
 
If we run the creation of job via jobDsl pipeline step ([https://jenkins.io/doc/pipeline/steps/job-dsl/|https://www.google.com/url?q=https%3A%2F%2Fjenkins.io%2Fdoc%2Fpipeline%2Fsteps%2Fjob-dsl%2F&sa=D&sntz=1&usg=AFQjCNFphzzbQzcBk-KwGSGjshQxhQHIbw]) with any parameters, we are getting a folder on our filesystem without "*_legacyIds_*" file in builds directory.
examples are in the bottom of this post.
The problem is that if there is no *_legacyIds_* file in builds directory, after restarting of jenkins server, we are facing long migrations for all jobs created after the previous reboot
 

bulanovk@gmail.com (JIRA)

unread,
Nov 14, 2019, 2:08:04 AM11/14/19
to jenkinsc...@googlegroups.com

bulanovk@gmail.com (JIRA)

unread,
Nov 14, 2019, 2:17:03 AM11/14/19
to jenkinsc...@googlegroups.com

mail@daniel-spilker.com (JIRA)

unread,
Mar 6, 2020, 10:54:02 AM3/6/20
to jenkinsc...@googlegroups.com
Daniel Spilker updated an issue
 
Change By: Daniel Spilker
Component/s: core
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

mail@daniel-spilker.com (JIRA)

unread,
Mar 6, 2020, 10:59:03 AM3/6/20
to jenkinsc...@googlegroups.com
Daniel Spilker commented on Bug JENKINS-59402
 
Re: JobDsl should respect Job post-construction initialization

Shouldn't this be fixed in Jenkins core? Shouldn't createProjectFromXML() call onCreatedFromScratch() like createProject() does? And probably followed by save()?

See https://github.com/jenkinsci/jenkins/blob/jenkins-2.223/core/src/main/java/hudson/model/ItemGroupMixIn.java

When creating jobs from CLI, onCreatedFromScratch() is not called. Is that on purpose?
https://github.com/jenkinsci/jenkins/blob/jenkins-2.223/core/src/main/java/hudson/cli/CreateJobCommand.java

Konstantin Bulanov can you check that with the core maintainers, maybe by creating a PR for core?

Reply all
Reply to author
Forward
0 new messages