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

Avoid jenkinsapi trying to fetch all jobs. #1044

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ros_buildfarm/ci_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ def _configure_ci_jobs(
# all further configuration will be handled by either the Jenkins API
# or by a generated groovy script
from ros_buildfarm.jenkins import connect
jenkins = connect(config.jenkins_url) if groovy_script is None else False
jenkins = connect(config.jenkins_url) if groovy_script is None else None

view_configs = {}
views = {
ci_view_name: configure_ci_view(
jenkins, ci_view_name, dry_run=dry_run)
}
if not jenkins:
if jenkins is None:
view_configs.update(views)
groovy_data = {
'dry_run': dry_run,
Expand Down
4 changes: 2 additions & 2 deletions ros_buildfarm/devel_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def configure_devel_jobs(
# all further configuration will be handled by either the Jenkins API
# or by a generated groovy script
from ros_buildfarm.jenkins import connect
jenkins = connect(config.jenkins_url) if groovy_script is None else False
jenkins = connect(config.jenkins_url) if groovy_script is None else None

view_configs = {}
views = {}
Expand All @@ -90,7 +90,7 @@ def configure_devel_jobs(
if build_file.test_pull_requests_force is not False:
views[pull_request_view_name] = configure_devel_view(
jenkins, pull_request_view_name, dry_run=dry_run)
if not jenkins:
if jenkins is None:
view_configs.update(views)
groovy_data = {
'dry_run': dry_run,
Expand Down
4 changes: 2 additions & 2 deletions ros_buildfarm/doc_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ def configure_doc_jobs(
# all further configuration will be handled by either the Jenkins API
# or by a generated groovy script
from ros_buildfarm.jenkins import connect
jenkins = connect(config.jenkins_url) if groovy_script is None else False
jenkins = connect(config.jenkins_url) if groovy_script is None else None

view_configs = {}
views = {}
views[doc_view_name] = configure_doc_view(
jenkins, doc_view_name, dry_run=dry_run)
if not jenkins:
if jenkins is None:
view_configs.update(views)
groovy_data = {
'dry_run': dry_run,
Expand Down
6 changes: 4 additions & 2 deletions ros_buildfarm/jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class JenkinsProxy(Jenkins):
def __init__(self, *args, **kwargs): # noqa: D107
requester_kwargs = copy.copy(kwargs)
requester_kwargs['baseurl'] = args[0]
# Don't trigger jenkinsapi poll on initialization
kwargs['lazy'] = True
kwargs['requester'] = CrumbRequester(**requester_kwargs)
kwargs.setdefault('timeout', 120)
super(JenkinsProxy, self).__init__(*args, **kwargs)
Expand All @@ -55,7 +57,7 @@ def jobs(self):

def connect(jenkins_url):
global _cached_jenkins
if _cached_jenkins and _cached_jenkins.base_server_url() == jenkins_url:
if _cached_jenkins is not None and _cached_jenkins.base_server_url() == jenkins_url:
print("Reusing connection to Jenkins '%s'" % jenkins_url)
return _cached_jenkins

Expand Down Expand Up @@ -88,7 +90,7 @@ def configure_view(
view_config = get_view_config(
template_name, view_name, include_regex=include_regex,
filter_queue=filter_queue)
if not jenkins:
if jenkins is None:
_cached_views[key] = view_config
return view_config
view_type = _get_view_type(view_config)
Expand Down
10 changes: 5 additions & 5 deletions ros_buildfarm/release_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def configure_release_jobs(

# all further configuration will be handled by either the Jenkins API
# or by a generated groovy script
jenkins = False
jenkins = None
if groovy_script is None:
from ros_buildfarm.jenkins import connect
jenkins = connect(config.jenkins_url)
Expand All @@ -144,14 +144,14 @@ def configure_release_jobs(
job_name, job_config = configure_import_package_job(
config_url, rosdistro_name, release_build_name,
config=config, build_file=build_file, jenkins=jenkins, dry_run=dry_run)
if not jenkins:
if jenkins is None:
all_job_configs[job_name] = job_config
break

job_name, job_config = configure_sync_packages_to_main_job(
config_url, rosdistro_name, release_build_name,
config=config, build_file=build_file, jenkins=jenkins, dry_run=dry_run)
if not jenkins:
if jenkins is None:
all_job_configs[job_name] = job_config

for os_name, os_code_name in platforms:
Expand All @@ -161,7 +161,7 @@ def configure_release_jobs(
os_name, os_code_name, arch,
config=config, build_file=build_file, jenkins=jenkins,
dry_run=dry_run)
if not jenkins:
if jenkins is None:
all_job_configs[job_name] = job_config

targets = []
Expand All @@ -172,7 +172,7 @@ def configure_release_jobs(
views = configure_release_views(
jenkins, rosdistro_name, release_build_name, targets,
dry_run=dry_run)
if not jenkins:
if jenkins is None:
all_view_configs.update(views)
groovy_data = {
'dry_run': dry_run,
Expand Down
Loading