How do you remove existing jos

1,385 views
Skip to first unread message

tiziano

unread,
Oct 23, 2012, 6:17:09 AM10/23/12
to job-dsl...@googlegroups.com
Hi,
I wasn't able to find this information trough wikis and emails, does anyone know?

Thanks in advance.
Tiziano

Justin Ryan

unread,
Oct 23, 2012, 2:00:21 PM10/23/12
to job-dsl...@googlegroups.com
Can you clarify what you mean by removing existing jobs? Are you talking about when a job is no longer part of the seed job? Right now they are disabled. They won't show up in the Build page, but they will still show up in the Job page.

I have an issue to let you users select if they want the unreferenced jobs to be deleted or disabled: https://github.com/JavaPosseRoundup/job-dsl-plugin/issues/28. I could probably make it also control what is shown on the Job page. My goal though is to show all the jobs but better show their current status.

Disabling is the safe thing, while deleting could be quite dangerous. I'm think about the case where someone likes a generated job, but no longer want it managed by a seed job, so they stop referencing it. If all we do is delete it, then they can't further play with that job, but if we disable it, they can just re-enabled it. 

Feedback?


Tiziano

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To post to this group, send email to job-dsl...@googlegroups.com.
To unsubscribe from this group, send email to job-dsl-plugi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/job-dsl-plugin/-/pkjc_tQ3bucJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

tiziano

unread,
Oct 26, 2012, 6:53:30 AM10/26/12
to job-dsl...@googlegroups.com
Hi Justin,
what I meant was to find a way to delete job that the seed job has previously created. That has nothing to do with generated job that no longer reference a seed job.

In my scenario a seed job is scheduled daily and generates new jobs if needed.
But those jobs after a while need to be deleted because they don't make sense anymore.

If I look at the output of the seed job i see something like:
...
Building in workspace /var/lib/jenkins/jobs/Weekly-Scheduler/workspace
Using dsl from string
Existing Templates: MyJob-Template
New Templates:
Unreferenced Templates:
Adding jobs:
Existing jobs: GeneratedJob{...},GeneratedJob{...},...
Removing jobs:
...


I didn't understand yet how the plugin can be instructed to Remove jobs.

Justin Ryan

unread,
Oct 26, 2012, 12:16:15 PM10/26/12
to job-dsl...@googlegroups.com
Inline.

On Fri, Oct 26, 2012 at 3:53 AM, tiziano <tiz...@flightfuse.nl> wrote:
Hi Justin,
what I meant was to find a way to delete job that the seed job has previously created. That has nothing to do with generated job that no longer reference a seed job.

The only way the DSL could be instructed to delete a job is for it to be a job it once created, but is no longer creating. The lack of the job coming out of the script indicates that it's no longer wanted.
 
In my scenario a seed job is scheduled daily and generates new jobs if needed.
But those jobs after a while need to be deleted because they don't make sense anymore.

This is common, e.g. build every branch, someday that branch no longer exists, so it no longer needs a job.
 
If I look at the output of the seed job i see something like:
...
Building in workspace /var/lib/jenkins/jobs/Weekly-Scheduler/workspace
Using dsl from string
Existing Templates: MyJob-Template
New Templates:
Unreferenced Templates:
Adding jobs:
Existing jobs: GeneratedJob{...},GeneratedJob{...},...
Removing jobs:
...



This hints to me that you are actually creating jobs for the jobs which you don't want anymore, otherwise there would have been some text in the "Removing jobs" section. If you think in this case you should be seeing jobs no longer referenced and hence be "removed", let's follow up on that.
 
I didn't understand yet how the plugin can be instructed to Remove jobs.

I was trying to say that it can't delete jobs, yet. I only had time to do one thing and the safe thing was to disable the jobs. This will happen if you no longer generate job which you were previously making with this seed job.  Someone could contribute the ability to delete jobs. It'll take a little UI work and some reflection work (since deleteJob is private), but the bulk of work identifying what should be removed is already done.

-justin

tiziano

unread,
Oct 26, 2012, 12:39:19 PM10/26/12
to job-dsl...@googlegroups.com
Justin,
the behavior that you just described is exactly the one that I was looking for :), thanks!

I actually wasn't really aware that the plugin keeps his own kind of state based on previous runs.
Just for my own understanding, is this state kept based on the reference that each job has with the seed job that created it?

Adding some documentation about these internals could be useful,
or am I blind and those info are already somewhere?

Cheers
Tiziano

Justin Ryan

unread,
Nov 6, 2012, 12:29:34 PM11/6/12
to job-dsl-plugin
On Fri, Oct 26, 2012 at 9:39 AM, tiziano <tiz...@flightfuse.nl> wrote:
I actually wasn't really aware that the plugin keeps his own kind of state based on previous runs.
Just for my own understanding, is this state kept based on the reference that each job has with the seed job that created it?

Jenkins didn't make it easy to store this state. But essentially we look at the last successful build to know what we created previously.
 
Adding some documentation about these internals could be useful,
or am I blind and those info are already somewhere?

This behavior definitely could have more documentation. It's really a constant struggle to writes doc or more features. As we use the plugin more internally, I'm finding some necessary additional DSL methods, so I add them. I get that it's not helpful to everyone else if I'm no documentation, so expect some more soon, though the focus will be on the DSL methods and not internals.
Reply all
Reply to author
Forward
0 new messages