Exemple #1
0
def publish(build_only, build_publish_ecr_only, publish_helm_only):
    pc = ProjectConf()
    pr = PublishRules()
    d = DockerCommands()
    h = Helm()

    # tags is a list in case we want to add other tags in the future
    tags = [Git.get_hash()]

    if not publish_helm_only:
        for tag in tags:
            env = {"HASH": tag}
            pc.build_docker(env)
        if not build_only:
            images = pc.get_docker_images()
            image_tags = [
                Tag(image, tag) for image, tag in product(images, tags)
            ]
            asso = {}
            d.login(pr)
            for image_tag in image_tags:
                res = d.publish(pr, image_tag, login=False)
                asso[image_tag] = res

    if not build_only and not build_publish_ecr_only:
        hash = tags[0]
        for path in pc.get_helm_chart_paths():
            h.publish(pc.name, pr, path, hash)
    logging.info(f"Ran publish on {pc.name} with git hash: {tags[0]}")