Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with copy method #7

Open
ghost opened this issue Oct 24, 2014 · 2 comments
Open

issue with copy method #7

ghost opened this issue Oct 24, 2014 · 2 comments
Labels

Comments

@ghost
Copy link

ghost commented Oct 24, 2014

Hello,

i am using a your excellent api to create a tool that automaticaly create jobs based on branche in a repository. Everythoing works fine except the fact that all jobs created with the copy() method are not runable in the jenkins interface, there is no play button to launch those jobs and even if the template job had a trigger like scm changes, it still doesnt launch the jobs crated with this method!

I have to disable and enable the copy (using the api-methods) for it to be runnable, is it something that is expected or maybe i am doing something wrong when updating the configuration?

@silas
Copy link
Owner

silas commented Oct 25, 2014

Copied jobs are disabled by default (by Jenkins, not this library), the reasoning being that the job could possibly conflict with the from job.

Enable not working by default looks like a bug in Jenkins, although I couldn't find it reported in Jira yet, but definitely referenced elsewhere on the internet.

    # enable the job, there seems to be a bug where we need to first disable and then enable
    `$CURL -o /dev/null --data disable "$HUDSON_URL/job/$TO_PROJECT/disable"`
    `$CURL -o /dev/null --data enable "$HUDSON_URL/job/$TO_PROJECT/enable"`

source

This might be the easiest way to get around this:

jenkins.job.config({ name: 'fromJob' }, function(err, xml) {
  if (err) throw err;

  jenkins.job.create({ name: 'newJob', xml: xml }, function(err) {
    if (err) throw err;
  });
});

@ghost
Copy link
Author

ghost commented Oct 25, 2014

thanks for the answer this seems to be a more elegant solution.

@silas silas added the question label Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant