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

use groovy to reconfigure devel views #200

Merged
merged 2 commits into from
Feb 5, 2016
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Forthcoming
* add subsections for "build", "build tests" and "run tests" in devel jobs (`#195 <https://github.com/ros-infrastructure/ros_buildfarm/pull/195>`_)
* fix environment for tests in devel and pull request jobs (`#196 <https://github.com/ros-infrastructure/ros_buildfarm/pull/196>`_)
* add "Queue" view to see all queued builds without the overhead of a job list (`#197 <https://github.com/ros-infrastructure/ros_buildfarm/pull/197>`_)
* fix reconfigure devel views (`#200 <https://github.com/ros-infrastructure/ros_buildfarm/pull/200>`_)

1.0.0 (2016-02-01)
------------------
Expand Down
29 changes: 16 additions & 13 deletions ros_buildfarm/devel_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,21 @@ def configure_devel_jobs(
pull_request_view_name = get_devel_view_name(
rosdistro_name, source_build_name, pull_request=True)

# 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)
jenkins = connect(config.jenkins_url) if groovy_script is None else False

views = []
view_configs = {}
views = {}
if build_file.test_commits_force is not False:
views.append(configure_devel_view(
jenkins, devel_view_name, dry_run=dry_run))
views[devel_view_name] = configure_devel_view(
jenkins, devel_view_name, dry_run=dry_run)
if build_file.test_pull_requests_force is not False:
views.append(configure_devel_view(
jenkins, pull_request_view_name, dry_run=dry_run))

if groovy_script is not None:
# all further configuration will be handled by the groovy script
jenkins = False
views[pull_request_view_name] = configure_devel_view(
jenkins, pull_request_view_name, dry_run=dry_run)
if not jenkins:
view_configs.update(views)

repo_names = dist_file.repositories.keys()
filtered_repo_names = build_file.filter_repositories(repo_names)
Expand Down Expand Up @@ -166,10 +167,12 @@ def configure_devel_jobs(
jenkins, pull_request_job_prefix, pull_request_job_names,
dry_run=dry_run)
else:
print("Writing groovy script '%s' to reconfigure %d jobs" %
(groovy_script, len(job_configs)))
print(
"Writing groovy script '%s' to reconfigure %d views and %d jobs" %
(groovy_script, len(view_configs), len(job_configs)))
data = {
'dry_run': dry_run,
'expected_num_views': len(view_configs),
'expected_num_jobs': len(job_configs),
'job_prefixes_and_names': {
'devel': (devel_job_prefix, devel_job_names),
Expand All @@ -179,7 +182,7 @@ def configure_devel_jobs(
}
content = expand_template('snippet/reconfigure_jobs.groovy.em', data)
write_groovy_script_and_configs(
groovy_script, content, job_configs)
groovy_script, content, job_configs, view_configs=view_configs)


def configure_devel_job(
Expand Down