예제 #1
0
    def exec_amend(self):
        try:
            subprocess.run(self.amend_cmd.split(),
                           check=True,
                           stdout=get_std(),
                           stderr=get_std())
        except subprocess.CalledProcessError:
            # fmt: off
            raise click.ClickException("""Cannot amend image {} to manifest.
Passing.""".format(self.qemu_registry_target))
예제 #2
0
 def exec_push_manifest(self):
     try:
         subprocess.run(
             self.push_manifest_cmd.split(),
             check=True,
             stdout=get_std(),
             stderr=get_std(),
         )
     except subprocess.CalledProcessError:
         raise click.ClickException("Cannot push manifest list to registry.")
예제 #3
0
    def login_registry():
        try:
            subprocess.run(["docker", "login"],
                           check=True,
                           stdout=get_std(),
                           stderr=get_std())
        except subprocess.CalledProcessError:
            # fmt: off
            raise click.ClickException("""Docker registry is not accessible.
Please login with `docker login` command.""")
예제 #4
0
파일: qemu_build.py 프로젝트: pcorbel/kross
    def exec_build(self):
        try:
            subprocess.run(self.build_cmd.split(),
                           check=True,
                           stdout=get_std(),
                           stderr=get_std())
        except subprocess.CalledProcessError:
            # fmt: off
            raise click.ClickException(
                """Cannot build image for architecture {}.
Passing.""".format(self.arch))
예제 #5
0
파일: qemu_build.py 프로젝트: pcorbel/kross
    def pull_qemu_image(self):
        try:
            subprocess.run(
                ["docker", "pull", self.qemu_image],
                check=True,
                stdout=get_std(),
                stderr=get_std(),
            )
        except subprocess.CalledProcessError:
            # fmt: off
            raise click.ClickException("""Cannot pull QEMU base image {}.
Passing.""".format(self.qemu_image))
예제 #6
0
 def check_manifest_cmd():
     try:
         subprocess.run(["docker", "manifest"],
                        check=True,
                        stdout=get_std(),
                        stderr=get_std())
     except subprocess.CalledProcessError:
         docker_config = "{}/{}".format(os.path.expanduser("~"),
                                        ".docker/config.json")
         with click.open_file(docker_config, "r+") as file:
             config = json.load(file)
             config.update({"experimental": "enabled"})
             file.seek(0)
             json.dump(config, file)
예제 #7
0
    def register_binfmt_misc():
        try:
            subprocess.run(
                [
                    "sudo",
                    "docker",
                    "run",
                    "--rm",
                    "--privileged",
                    "multiarch/qemu-user-static:register",
                ],
                check=True,
                stdout=get_std(),
                stderr=get_std(),
            )
        except subprocess.CalledProcessError:
            # fmt: off
            raise click.ClickException("""Could not register binfmt_misc.
Please register it with \
`sudo docker run --rm --privileged multiarch/qemu-user-static:register` command."""
                                       )