-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
jenkins_job module fails creating jobs of type OrganizationFolder #18995
Comments
Hi @tumbl3w33d sorry for the delay but I got notified very recently. I will take a look a it. I will try to reproduce it and once I get the same failure I will work on a long term solution for this. Thank you very much for your patience. |
Hi @tumbl3w33d I have been testing it and I have reached to a point of good working of the module. The result of the execution of the module as a proof of concept is here: At code level, I skip enabled/disabled validation in those jobs(identified by _class property) in which it does not make sense to have a state of enabled/disabled. If you are happy with this approach and the results shown in the gist, I will open a PR in ansible-extra-modules repo. Best regards. |
LGTM @sermilrod and thank you for maintaining this module. Btw.: did you create that PR in the extra module repo on purpose? From my understanding this is part of the main repo now. Hope it will not get lost over there. |
It was not on purpose, it was my mistake. When I developed the module I had to submit the code to ansible-extra-module repo but apparently this has changed. The PR is updated here #19644 |
PR has been mergedto devel. Closing issue ticket. |
Hey @sermilrod it happens the same with This is the snippet generated by Jenkins when creating a Pipeline: <org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject plugin="workflow-multibranch@2.15"> Thanks! |
ISSUE TYPE
COMPONENT NAME
jenkins_job
ANSIBLE VERSION
CONFIGURATION
N/A
OS / ENVIRONMENT
N/A
SUMMARY
The jenkins_job module cannot handle creating jobs of type jenkins.branch.OrganizationFolder.
Background:
If we use the plugins
to integrate with Bitbucket, then there's the option to create a kind of wrapper job that only has the purpose of scanning Bitbucket projects for repositories (and therein a 'Jenkinsfile'). Something similar exists for GitHub and possibly other providers.
If we use the jenkins_job to create such a wrapper job it fails, because it cannot determine whether this job is disabled or not. The JSON response for such job doesn't include the 'color' attribute which the module looks for and there is in general no option for disabling such job apart from disabling its polling.
TL;DR:
The module does
and throws this exception because there is no color attribute in the response.
The good news - the rest of the module just works if you hack around this check like
Now my suggestion is to make the module ignore this check for this kind of job.
STEPS TO REPRODUCE
An example job template which I created for a generic job role can be found here:
https://gist.github.com/tumbl3w33d/a1a986fa73da6adc0078532a5578782a
This should allow you to choose the right identifiers for such kind of wrapper jobs, so you could skip the failing check.
An example of a JSON response of the jenkins api for such a wrapper job:
https://gist.github.com/tumbl3w33d/04379f013e1e58dff13da60d46234975
EXPECTED RESULTS
The wrapper job gets created.
ACTUAL RESULTS
I'd be happy to support you with testing a possible pull request because it's quite hard for you to reproduce this setup.
The text was updated successfully, but these errors were encountered: