示例#1
0
def run(git_clone_dir, bump=False):

    config = Config(git_clone_dir)

    # Generate version specific files (if necessary)
    content.bump_versioned_resources(config, bump)

    # New (app.ci) configuration and deployment
    generate_app_ci_content(config, git_clone_dir)
示例#2
0
def run(git_clone_dir, bump=False):

    config = Config(git_clone_dir)

    # Generate version specific files (if necessary)
    content.bump_versioned_resources(config, bump)

    for private in (False, True):
        for arch in config.arches:
            context = Context(config, arch, private)

            with genlib.GenDoc(
                    config.paths.path_rc_deployments.joinpath(
                        f'deploy-{context.is_namespace}-controller.yaml'),
                    context) as gendoc:
                content.add_osd_rc_deployments(gendoc)

            with genlib.GenDoc(
                    config.paths.path_rc_release_resources.joinpath(
                        f'admin_config_updater_rbac{context.suffix}.yaml'),
                    context) as gendoc:
                content.add_art_namespace_config_updater_rbac(gendoc)

            with genlib.GenDoc(
                    config.paths.path_rc_release_resources.joinpath(
                        f'admin_deploy-{context.is_namespace}-controller.yaml'
                    ), context) as gendoc:
                content.add_imagestream_namespace_rbac(gendoc)

            with genlib.GenDoc(
                    config.paths.path_rc_release_resources.joinpath(
                        f'deploy-{context.is_namespace}-controller.yaml'),
                    context) as gendoc:
                content.add_redirect_and_files_cache_resources(gendoc)

    with genlib.GenDoc(
            config.paths.path_rc_deployments.joinpath('serviceaccount.yaml'),
            context=config) as gendoc:
        content.add_osd_rc_service_account_resources(gendoc)

    with genlib.GenDoc(config.paths.path_rc_release_resources.joinpath(
            'admin_deploy-ocp-publish-art.yaml'),
                       context=config) as gendoc:
        content.add_art_publish(gendoc)

    with genlib.GenDoc(config.paths.path_rc_release_resources.joinpath(
            f'rpms-ocp-3.11.yaml'),
                       context=config) as gendoc:
        content.add_rpm_mirror_service(gendoc, git_clone_dir, '3.11')

    for major_minor in config.releases:
        with genlib.GenDoc(config.paths.path_rc_release_resources.joinpath(
                f'rpms-ocp-{major_minor}.yaml'),
                           context=config) as gendoc:
            content.add_rpm_mirror_service(gendoc, git_clone_dir, major_minor)

        # If there is an annotation defined for the public release controller, use it as a template
        # for the private annotations.
        for annotation_path in config.paths.path_rc_annotations.glob(
                f'release-ocp-*.json'):
            if annotation_path.name.endswith(
                    'ci.json'
            ):  # There are no CI annotations for the private controllers
                continue
            if '-stable' in annotation_path.name:  # There are no stable streams in private release controllers
                continue
            annotation_filename = os.path.basename(annotation_path)
            with open(annotation_path, mode='r', encoding='utf-8') as f:
                pub_annotation = json.load(f)
            print(str(annotation_path))
            priv_annotation = dict(pub_annotation)
            priv_annotation['name'] += '-priv'
            priv_annotation['mirrorPrefix'] += '-priv'
            priv_annotation['to'] += '-priv'
            priv_annotation.pop(
                'check', None)  # Don't worry about the state of other releases
            priv_annotation.pop('publish',
                                None)  # Don't publish these images anywhere
            priv_annotation.pop('periodic', None)  # Don't configure periodics
            priv_annotation[
                'message'] = "<!-- GENERATED FROM PUBLIC ANNOTATION CONFIG - DO NOT EDIT. -->" + priv_annotation[
                    'message']
            for _, test_config in priv_annotation['verify'].items():
                test_config['prowJob']['name'] += '-priv'
                # TODO: Private jobs are disabled until the -priv variants can be generated by prowgen
                test_config['disabled'] = True

            with config.paths.path_priv_rc_annotations.joinpath(
                    annotation_filename).open(mode='w+',
                                              encoding='utf-8') as f:
                json.dump(priv_annotation, f, sort_keys=True, indent=4)