Ejemplo n.º 1
0
def unset_secrets(context, secrets):
    config = HokusaiConfig().check()

    try:
        select_context(context)
    except HokusaiCommandError, e:
        print_red(repr(e))
        return -1
Ejemplo n.º 2
0
def pull_config(context):
    config = HokusaiConfig().check()

    try:
        select_context(context)
    except HokusaiCommandError, e:
        print_red(repr(e))
        return -1
Ejemplo n.º 3
0
def run(context, command, tag, with_config, with_secrets, env):
    config = HokusaiConfig().check()

    try:
        select_context(context)
    except HokusaiCommandError, e:
        print_red(repr(e))
        return -1
Ejemplo n.º 4
0
def stack_up(context):
    HokusaiConfig().check()
    kubernetes_yml = os.path.join(os.getcwd(), "hokusai/%s.yml" % context)
    if not os.path.isfile(kubernetes_yml):
        print_red("Yaml file %s does not exist for given context." %
                  kubernetes_yml)
        return -1

    try:
        select_context(context)
    except HokusaiCommandError, e:
        print_red(repr(e))
        return -1
Ejemplo n.º 5
0
def push_config(context):
    HokusaiConfig().check()

    if not os.path.isfile(
            os.path.join(os.getcwd(), 'hokusai', "%s-config.yml" % context)):
        print_red("Secrets file hokusai/%s-config.yml does not exist" %
                  context)
        return -1

    try:
        select_context(context)
    except HokusaiCommandError, e:
        print_red(repr(e))
        return -1
Ejemplo n.º 6
0
            "Deployment's containers do not reference the same image tag - aborting..."
        )
        return -1

    base_image = containers[0]['image']
    if config.aws_ecr_registry not in base_image:
        print_red("Refusing to deploy unmanaged image %s - aborting..." %
                  base_image)
        return -1

    tag = base_image.rsplit(':', 1)[1]

    print_green("Deploying %s to %s" % (tag, context))

    try:
        select_context(context)
    except HokusaiCommandError, e:
        print_red(repr(e))
        return -1

    try:
        login_command = check_output(verbose("aws ecr get-login --region %s" %
                                             config.aws_ecr_region),
                                     shell=True)
        check_call(login_command, shell=True)

        check_call(verbose("docker pull %s:%s" %
                           (config.aws_ecr_registry, tag)),
                   shell=True)

        check_call(verbose(