def configure_ci_jobs(<EOL>config_url, rosdistro_name, ci_build_name,<EOL>groovy_script=None, dry_run=False):
config = get_config_index(config_url)<EOL>build_files = get_ci_build_files(config, rosdistro_name)<EOL>build_file = build_files[ci_build_name]<EOL>index = get_index(config.rosdistro_index_url)<EOL>targets = []<EOL>for os_name in build_file.targets.keys():<EOL><INDENT>for os_code_name in build_file.targets[os_name].keys():<EOL><INDENT>for arch in build_file.targets[os_name][os_code_name]:<EOL><INDENT>targets.append((os_name, os_code_name, arch))<EOL><DEDENT><DEDENT><DEDENT>print('<STR_LIT>')<EOL>for os_name, os_code_name, arch in targets:<EOL><INDENT>print('<STR_LIT>', os_name, os_code_name, arch)<EOL><DEDENT>dist_file = get_distribution_file(index, rosdistro_name, build_file)<EOL>if not dist_file:<EOL><INDENT>print('<STR_LIT>')<EOL>return<EOL><DEDENT>ci_view_name = get_ci_view_name(rosdistro_name)<EOL>from ros_buildfarm.jenkins import connect<EOL>jenkins = connect(config.jenkins_url) if groovy_script is None else False<EOL>view_configs = {}<EOL>views = {<EOL>ci_view_name: configure_ci_view(<EOL>jenkins, ci_view_name, dry_run=dry_run)<EOL>}<EOL>if not jenkins:<EOL><INDENT>view_configs.update(views)<EOL><DEDENT>groovy_data = {<EOL>'<STR_LIT>': dry_run,<EOL>'<STR_LIT>': len(view_configs),<EOL>}<EOL>ci_job_names = []<EOL>job_configs = OrderedDict()<EOL>is_disabled = False<EOL>for os_name, os_code_name, arch in targets:<EOL><INDENT>try:<EOL><INDENT>job_name, job_config = configure_ci_job(<EOL>config_url, rosdistro_name, ci_build_name,<EOL>os_name, os_code_name, arch,<EOL>config=config, build_file=build_file,<EOL>index=index, dist_file=dist_file,<EOL>jenkins=jenkins, views=views,<EOL>is_disabled=is_disabled,<EOL>groovy_script=groovy_script,<EOL>dry_run=dry_run,<EOL>trigger_timer=build_file.jenkins_job_schedule)<EOL>ci_job_names.append(job_name)<EOL>if groovy_script is not None:<EOL><INDENT>print("<STR_LIT>" % job_name)<EOL>job_configs[job_name] = job_config<EOL><DEDENT><DEDENT>except JobValidationError as e:<EOL><INDENT>print(e.message, file=sys.stderr)<EOL><DEDENT><DEDENT>groovy_data['<STR_LIT>'] = len(job_configs)<EOL>groovy_data['<STR_LIT>'] = {}<EOL>if groovy_script is not None:<EOL><INDENT>print(<EOL>"<STR_LIT>" %<EOL>(groovy_script, len(job_configs)))<EOL>content = expand_template(<EOL>'<STR_LIT>', groovy_data)<EOL>write_groovy_script_and_configs(<EOL>groovy_script, content, job_configs, view_configs)<EOL><DEDENT>
Configure all Jenkins CI jobs.