示例#1
0
 def test_get_docker_push(self):
     self.assertEqual(utils.get_docker_push("", ""), "false")
     self.assertEqual(
         utils.get_docker_push(
             constants.MAIN_GITHUB_ASWF_DOCKER_URL,
             "refs/heads/master",
         ),
         "true",
     )
     self.assertEqual(
         utils.get_docker_push(
             constants.MAIN_GITHUB_ASWF_DOCKER_URL,
             "refs/heads/testing",
         ),
         "true",
     )
     self.assertEqual(
         utils.get_docker_push("https://github.com/randomfork/aswf-docker",
                               "refs/heads/master"),
         "false",
     )
     self.assertEqual(
         utils.get_docker_push("https://github.com/randomfork/aswf-docker",
                               "refs/heads/randombranch"),
         "false",
     )
示例#2
0
def build(
    build_info,
    ci_image_type,
    group_name,
    group_version,
    target,
    push,
    dry_run,
    progress,
):
    """Builds a ci-package or ci-image docker image.
    """
    if push == "YES":
        pushb = True
    elif push == "AUTO":
        pushb = utils.get_docker_push(build_info.repo_uri, build_info.source_branch)
    else:
        pushb = False
    b = builder.Builder(
        build_info=build_info,
        group_info=builder.GroupInfo(
            type_=constants.ImageType[ci_image_type],
            names=group_name.split(","),
            versions=group_version.split(","),
            target=target,
        ),
        push=pushb,
    )
    b.build(dry_run=dry_run, progress=progress)
示例#3
0
def build(
    build_info,
    ci_image_type,
    group,
    version,
    full_name,
    target,
    push,
    dry_run,
    progress,
):
    """Builds a ci-package or ci-image Docker image.
    """
    if push == "YES":
        pushb = True
    elif push == "AUTO":
        pushb = utils.get_docker_push(build_info.repo_uri,
                                      build_info.source_branch)
    else:
        pushb = False

    group_info = get_group_info(build_info, ci_image_type, group, version,
                                full_name, target)
    b = builder.Builder(build_info=build_info,
                        group_info=group_info,
                        push=pushb)
    b.build(dry_run=dry_run, progress=progress)
示例#4
0
def getdockerpush(build_info):
    """Prints if the images should be pushed according to the current repo uri and branch name
    """
    click.echo(
        "true" if utils.get_docker_push(build_info.repo_uri,
                                        build_info.source_branch) else "false",
        nl=False,
    )