Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(description="Sign artifacts")
    parser.add_argument("target", type=Path, help="Path to local manifest file or artifact directory.")
    parser.add_argument("--component", nargs="?", help="Component name")
    parser.add_argument("--type", nargs="?", help="Artifact type")
    parser.add_argument("--sigtype", choices=ACCEPTED_SIGNATURE_FILE_TYPES, help="Type of Signature file", default=".asc")
    parser.add_argument(
        "-v",
        "--verbose",
        help="Show more verbose output.",
        action="store_const",
        default=logging.INFO,
        const=logging.DEBUG,
        dest="logging_level",
    )
    args = parser.parse_args()

    console.configure(level=args.logging_level)

    sign = SignArtifacts.from_path(path=args.target,
                                   component=args.component,
                                   artifact_type=args.type,
                                   signature_type=args.sigtype,
                                   signer=Signer())

    sign.sign()
Exemplo n.º 2
0
def main() -> int:
    args = AssembleArgs()

    console.configure(level=args.logging_level)

    build_manifest = BuildManifest.from_file(args.manifest)
    build = build_manifest.build
    artifacts_dir = os.path.dirname(os.path.realpath(args.manifest.name))

    output_dir = AssembleOutputDir(build.filename).dir

    logging.info(f"Bundling {build.name} ({build.architecture}) on {build.platform} into {output_dir} ...")

    bundle_recorder = BundleRecorder(
        build,
        output_dir,
        artifacts_dir,
        BundleLocations.from_path(args.base_url, os.getcwd(), build.filename)
    )

    with Bundles.create(build_manifest, artifacts_dir, bundle_recorder, args.keep) as bundle:
        bundle.install_min()
        bundle.install_plugins()
        logging.info(f"Installed plugins: {bundle.installed_plugins}")

        #  Save a copy of the manifest inside of the tar
        bundle_recorder.write_manifest(bundle.min_dist.archive_path)
        bundle.package(output_dir)

        bundle_recorder.write_manifest(output_dir)

    logging.info("Done.")
    return 0
Exemplo n.º 3
0
def main():
    args = TestArgs()
    console.configure(level=args.logging_level)
    with TemporaryDirectory(keep=args.keep) as work_dir:
        bundle_manifest = BundleManifest.from_urlpath(
            args.paths.get("opensearch", os.getcwd()))
        BwcTestSuite(bundle_manifest, work_dir.name, args.component,
                     args.keep).execute()
Exemplo n.º 4
0
def main():
    args = BuildArgs()
    console.configure(level=args.logging_level)
    manifest = InputManifest.from_file(args.manifest)

    if args.ref_manifest:
        manifest = manifest.stable()
        if os.path.exists(args.ref_manifest):
            if manifest == InputManifest.from_path(args.ref_manifest):
                logging.info(f"No changes since {args.ref_manifest}")
            else:
                logging.info(f"Updating {args.ref_manifest}")
                manifest.to_file(args.ref_manifest)
        else:
            logging.info(f"Creating {args.ref_manifest}")
            manifest.to_file(args.ref_manifest)
        exit(0)

    output_dir = BuildOutputDir(manifest.build.filename).dir

    with TemporaryDirectory(keep=args.keep, chdir=True) as work_dir:
        logging.info(f"Building in {work_dir.name}")

        target = BuildTarget(
            name=manifest.build.name,
            version=manifest.build.version,
            patches=manifest.build.patches,
            snapshot=args.snapshot if args.snapshot is not None else manifest.build.snapshot,
            output_dir=output_dir,
            platform=args.platform or manifest.build.platform,
            architecture=args.architecture or manifest.build.architecture,
        )

        build_recorder = BuildRecorder(target)

        logging.info(f"Building {manifest.build.name} ({target.architecture}) into {target.output_dir}")

        for component in manifest.components.select(focus=args.component, platform=target.platform):
            logging.info(f"Building {component.name}")

            builder = Builders.builder_from(component, target)
            try:
                builder.checkout(work_dir.name)
                builder.build(build_recorder)
                builder.export_artifacts(build_recorder)
            except:
                logging.error(f"Error building {component.name}, retry with: {args.component_command(component.name)}")
                raise

        build_recorder.write_manifest()

    logging.info("Done.")
Exemplo n.º 5
0
def main():
    args = ManifestsArgs()
    console.configure(level=args.logging_level)

    if args.action == "list":
        for klass in args.manifests:
            for manifest in klass().values():
                logging.info(f"{manifest.build.name} {manifest.build.version}")
    elif args.action == "update":
        for klass in args.manifests:
            klass().update(keep=args.keep)

    logging.info("Done.")
Exemplo n.º 6
0
def main():
    args = TestArgs()

    # Any logging.info call preceding to next line in the execution chain will make the console output not displaying logs in console.
    console.configure(level=args.logging_level)

    test_manifest = TestManifest.from_path(args.test_manifest_path)

    all_results = IntegTestRunners.from_test_manifest(args, test_manifest).run()

    all_results.log()

    if all_results.failed():
        sys.exit(1)
def main() -> int:
    args = SignArgs()

    console.configure(level=args.logging_level)

    sign = SignArtifacts.from_path(
        path=args.target,
        components=args.components,
        artifact_type=args.type,
        signature_type=args.sigtype,
        signer=Signer()
    )

    sign.sign()
    return 0
Exemplo n.º 8
0
def main():
    args = CheckoutArgs()
    console.configure(level=args.logging_level)
    manifest = InputManifest.from_file(args.manifest)

    with TemporaryDirectory(keep=True, chdir=True) as work_dir:
        logging.info(f"Checking out into {work_dir.name}")

        for component in manifest.components.select():
            logging.info(f"Checking out {component.name}")

            with GitRepository(
                    component.repository,
                    component.ref,
                    os.path.join(work_dir.name, component.name),
                    component.working_directory,
            ) as repo:
                logging.debug(f"Checked out {component.name} into {repo.dir}")

    logging.info(f"Done, checked out into {work_dir.name}.")
Exemplo n.º 9
0
def main() -> int:
    args = CiArgs()
    console.configure(level=args.logging_level)
    CiManifests.from_file(args.manifest, args).check()
    return 0