def test_get_docker_org(self): self.assertEqual(utils.get_docker_org("", ""), "aswftesting") self.assertEqual( utils.get_docker_org( constants.MAIN_GITHUB_ASWF_DOCKER_URL, "refs/heads/master", ), "aswf", ) self.assertEqual( utils.get_docker_org( constants.MAIN_GITHUB_ASWF_DOCKER_URL, "refs/heads/testing", ), "aswftesting", ) self.assertEqual( utils.get_docker_org("https://github.com/randomfork/aswf-docker", "refs/heads/master"), "aswflocaltesting", ) self.assertEqual( utils.get_docker_org("https://github.com/randomfork/aswf-docker", "refs/heads/randombranch"), "aswflocaltesting", )
def __init__( self, repo_uri: str = "", source_branch: str = "", aswf_version: str = "", repo_root: str = "", ): self.aswf_version = aswf_version self.repo_uri = repo_uri self.source_branch = source_branch self.docker_org = utils.get_docker_org(repo_uri, source_branch) self.repo_root = repo_root if self.docker_org == constants.FAKE_DOCKER_ORG: self.package_org = constants.TESTING_DOCKER_ORG else: self.package_org = self.docker_org if self.docker_org == constants.PUBLISH_DOCKER_ORG: self.vcs_ref = utils.get_current_sha() self.build_date = utils.get_current_date() else: self.vcs_ref = constants.DEV_BUILD_DATE self.build_date = constants.DEV_BUILD_DATE
def getdockerorg(build_info): """Prints the current dockerhub organisation to use according to the current repo uri and branch name """ click.echo( utils.get_docker_org(build_info.repo_uri, build_info.source_branch), nl=False )