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

Allows listing organizational folders #31

Merged
merged 1 commit into from Jul 26, 2017

Conversation

romank0
Copy link
Contributor

@romank0 romank0 commented Jul 26, 2017

Organizational folders are provided by Branch API Plugin.
They do not have status and color is not returned for them so exception is raised.

$ bin/python -m jenkins.get_jobs_xml
Traceback (most recent call last):
  File "~/.pyenv/versions/2.7.10/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "~/.pyenv/versions/2.7.10/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "~/workspace/develop/jenkins/get_jobs_xml.py", line 22, in <module>
    all_jobs = jenkins.all_jobs()
  File "~/workspace/develop/lib/python2.7/site-packages/autojenkins/jobs.py", line 157, in all_jobs
    return [(job['name'], job['color']) for job in jobs]
KeyError: 'color'

This commit changes all_jobs function so it skips them by default.
Additional option allows to include them.

This implementation filters by presence of the color parameter in a job. Alternatively we can filter by class name of the job.

Organizational folders are provided by [Branch API
Plugin](https://wiki.jenkins.io/display/JENKINS/Branch+API+Plugin).
They do not have not have status and color is not returned for them.
This commit changes list all jobs function so it skips them by default.
Additional option allows to include them.
@txels
Copy link
Owner

txels commented Jul 26, 2017

Ah cool, thanks for this @romank0! Nice to see you around these parts.

@txels txels merged commit c833668 into txels:master Jul 26, 2017
@romank0 romank0 deleted the support-for-branch-api-plugin branch July 26, 2017 17:24
@txels
Copy link
Owner

txels commented Jul 26, 2017

This has been released as v1.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants