示例#1
0
    def run_command(self, command):
        # type: (str) -> None
        if self.shell:
            to_run = shlex.split(
                self.shell) + [command]  # type: Union[str, List[str]]
            console.progress("(%s)> %s" % (self.shell, command))
        else:
            to_run = command
            console.progress("> %s" % command)

        container = self.service.create_container(one_off=True,
                                                  command=to_run,
                                                  tty=False,
                                                  stdin_open=True,
                                                  detach=False)

        try:
            dockerpty.start(self.client, container.id, interactive=False)

            if container.wait() != 0:
                raise BuildFailedException()
                sys.exit(1)

        finally:
            self.client.remove_container(container.id, force=True)
示例#2
0
    def setup(self):
        console.progress('Building Images...')
        self.project.build()

        console.progress('Pulling Images...')
        self.project.pull()

        self.project.initialize()
示例#3
0
    def setup(self):
        console.progress('Building Images...')
        self.project.build()

        console.progress('Pulling Images...')
        self.project.pull()

        self.project.initialize()
示例#4
0
    def setup(self):
        # type: () -> None
        console.progress("Building Images...")
        self.project.build()

        console.progress("Pulling Images...")
        self.project.pull()

        self.project.initialize()
示例#5
0
    def run(self):
        try:
            self.setup()

            self.start_linked_services()

            for command in self.commands:
                self.run_command(command)

            console.progress('Done.')

        finally:
            self.cleanup()
示例#6
0
    def run(self):
        try:
            self.setup()

            self.start_linked_services()

            for command in self.commands:
                self.run_command(command)

            console.progress('Done.')

        finally:
            self.cleanup()
示例#7
0
    def run(self):
        # type: () -> None
        try:
            self.setup()

            self.start_linked_services()

            for command in self.commands:
                self.run_command(command)

            console.progress("Done.")

        finally:
            self.cleanup()
示例#8
0
    def run(self):
        try:
            self.setup()

            self.start_linked_services()

            for command in self.commands:
                self.run_command(command)

            console.progress('Done.')

        except KeyboardInterrupt:
            console.warn("\nBuild Interrupted.")
            sys.exit(1)

        finally:
            self.cleanup()
示例#9
0
    def run(self):
        try:
            self.setup()

            self.start_linked_services()

            for command in self.commands:
                self.run_command(command)

            console.progress('Done.')

        except KeyboardInterrupt:
            console.warn("\nBuild Interrupted.")
            sys.exit(1)

        finally:
            self.cleanup()
示例#10
0
    def run_command(self, command):
        console.progress("> %s" % command)

        container = self.service.create_container(one_off=True,
                                                  command=command,
                                                  tty=False,
                                                  stdin_open=True,
                                                  detach=False)

        try:
            dockerpty.start(self.client, container.id, interactive=False)

            if container.wait() != 0:
                console.error("\nBuild Failed.")
                sys.exit(1)

        finally:
            self.client.remove_container(container.id, force=True)
示例#11
0
    def run_command(self, command):
        console.progress("> %s" % command)

        container = self.service.create_container(
            one_off=True,
            command=command,
            tty=False,
            stdin_open=True,
            detach=False)

        try:
            dockerpty.start(self.client, container.id, interactive=False)

            if container.wait() != 0:
                raise BuildFailedException()
                sys.exit(1)

        finally:
            self.client.remove_container(container.id, force=True)
示例#12
0
    def invoke(self, run_ctx):
        # type: (RunContext) -> None
        console.progress("** Invoke %s" % self.name)

        if run_ctx.is_executed(self.name):
            console.progress("** Skipped %s" % self.name)
            return

        if run_ctx.is_invoked(self.name):
            raise ConfigException(
                "Cyclic dependency detected when invoking {}".format(
                    self.name))

        run_ctx.mark_invoked(self.name)

        for target in self.before:
            Target(run_ctx.config.for_target(target)).invoke(run_ctx)

        if self.commands:
            dry_run = "(dry run)" if run_ctx.dry_run else ""
            console.progress("** Execute %s %s" % (self.name, dry_run))

            if not run_ctx.dry_run:
                self.run()

        run_ctx.mark_executed(self.name)
示例#13
0
    def invoke(self, run_ctx):
        console.progress("** Invoke %s" % self.name)

        for target in self.before:
            Target(run_ctx.config.for_target(target)).invoke(run_ctx)

        if run_ctx.is_executed(self.name):
            console.progress("** Skipped %s" % self.name)
            return

        if self.commands:
            dry_run = '(dry run)' if run_ctx.dry_run else ''
            console.progress("** Execute %s %s" % (self.name, dry_run))

            if not run_ctx.dry_run:
                self.run()

        run_ctx.mark_executed(self.name)
示例#14
0
    def invoke(self, run_ctx):
        console.progress("** Invoke %s" % self.name)

        for target in self.before:
            Target(run_ctx.config.for_target(target)).invoke(run_ctx)

        if run_ctx.is_executed(self.name):
            console.progress("** Skipped %s" % self.name)
            return

        if self.commands:
            dry_run = '(dry run)' if run_ctx.dry_run else ''
            console.progress("** Execute %s %s" % (self.name, dry_run))

            if not run_ctx.dry_run:
                self.run()

        run_ctx.mark_executed(self.name)
示例#15
0
 def cleanup(self):
     console.progress('Cleaning up...')
     self.project.kill()
     self.project.remove_stopped(None, v=True)
     self.project.networks.remove()
示例#16
0
 def cleanup(self):
     console.progress('Cleaning up...')
     self.project.kill()
     self.project.remove_stopped(None, v=True)
     self.project.networks.remove()
示例#17
0
 def cleanup(self):
     # type: () -> None
     console.progress("Cleaning up...")
     self.project.kill()
     self.project.remove_stopped(None, v=True)
     self.project.networks.remove()