def build_docker(commit_id): """ Task responsible for building a docker image from a commit, and pushing that image to a remote repository for storage :param commit_id: commit integer id from which to build :type commit_id: int or basestring :return: None """ commit_id = int(commit_id) commit = Commit.query.get(commit_id) build = Build( commit=commit, timestamp=datetime.datetime.now(), ) current_app.logger.info("Build created: {}:{}".format( commit.repository, commit.commit_hash, )) try: builder = DockerImageBuilder(commit) builder.run() except Exception, e: current_app.logger.exception(e)
def setUp(self): self.commit = Commit(commit_hash='master', repository="adsws") self.builder = DockerImageBuilder(self.commit)