Beispiel #1
0
def main():
    # Authenticate with EdgeGrid
    util.initEdgeGridAuth()

    # Get the Cloud Services config files (main source of truth) for all configured environments
    environments = util.getYMLFromFile("./data/environments.yml")
    cs_config_list = []
    for env in environments:
        cs_config_list.append({
            "name":
            env,
            "branch":
            environments[env]["branch"],
            "prefix":
            environments[env]["prefix"]
            if "prefix" in environments[env] else "",
            "config":
            generateConfigForBranch(environments[env]["branch"])
        })

    # Create a new version based off of the active Prod version
    new_version_number = createNewVersion()

    # Update the rules JSON using the CS configuration as a reference
    updatePropertyRulesUsingConfig(new_version_number, cs_config_list)

    # Activate on STAGING
    activateVersion(new_version_number, "STAGING")
def main():
    # Authenticate with EdgeGrid
    # TODO: Change this authentication to get rid of the httpie dependency. Apprently there's a vulnerability
    util.initEdgeGridAuth()

    if len(sys.argv) > 2:
        version_to_activate = sys.argv[2]
    else:
        sys.exit("Activation failed: no property version number specified")
    if len(sys.argv) > 3:
        environment = sys.argv[3]
    else:
        environment = "STAGING"

    previous_version = util.getLatestVersionNumber(environment)
    with open("previousversion.txt", "w") as f:
        f.write(str(previous_version))

    print(
        ">>>>>>>>>>>>>>>>>>>>>>>> Beginning activation in {}! <<<<<<<<<<<<<<<<<<<<<<<<"
        .format(environment))
    print("Activating v{}".format(version_to_activate))

    # Activate on given env
    util.activateVersion(version_to_activate, environment)
def main():
    # Get the Cloud Services config files (main source of truth) for all configured releases
    releases = util.getYMLFromFile("../releases.yml")

    # This arg will be either "prod-stable" or "prod-beta", and tells us which release our local main.yml is for.
    # This guarantees that the newest main.yml is used instead of the one it intends to replace.
    if len(sys.argv) > 3:
        local_branch = sys.argv[3]
    else:
        local_branch = "prod-stable"

    if len(sys.argv) > 2:
        crc_env = sys.argv[2]
    else:
        crc_env = "stage"

    crc_env_prefix = ""
    if crc_env == "stage":
        crc_env_prefix = "/stage"

    cs_config_list = []
    for env in releases:
        source_branch = releases[env]["branch"] if "branch" in releases[env] else ""
        url_prefix = releases[env]["url_prefix"] if "url_prefix" in releases[env] else ""
        content_path_prefix = crc_env_prefix + releases[env]["content_path_prefix"] if "content_path_prefix" in releases[env] else crc_env_prefix

        cs_config_list.append({
            "name": env,
            "url_prefix": url_prefix,
            "content_path_prefix": content_path_prefix,
            "cookie_required": releases[env]["cookie_required"] if "cookie_required" in releases[env] else False,
            "config": generateConfigForBranch(source_branch, url_prefix, local_branch)
        })

    if len(sys.argv) > 1:
        property_env = sys.argv[1]
    else:
        property_env = "STAGING"

    # Authenticate with EdgeGrid
    util.initEdgeGridAuth()

    # Create a new version based off of the active Prod version
    new_version_number = createNewVersion(crc_env, property_env)

    # Update the rules JSON using the CS configuration as a reference
    updatePropertyRulesUsingConfig(new_version_number, cs_config_list, crc_env)

    # Activate version
    util.activateVersion(new_version_number, property_env, crc_env)

    # Wait for new version to be active
    util.waitForActiveVersion(int(new_version_number), property_env, crc_env)
def main():
    # Authenticate with EdgeGrid
    util.initEdgeGridAuth()

    waitForActivation = False

    if len(sys.argv) > 1:
        version_to_activate = sys.argv[1]
    else:
        sys.exit("Activation failed: no property version number specified")
    
    if len(sys.argv) > 2:
        aka_env = sys.argv[2]
    else:
        aka_env = "STAGING"
    
    if len(sys.argv) > 3:
        crc_env = sys.argv[3]
    else:
        crc_env = "stage"
    
    if len(sys.argv) > 4:
        waitForActivation = (sys.argv[4].lower() == "true")
    
    previous_version = util.getLatestVersionNumber(crc_env, aka_env)
    with open("previousversion.txt", "w") as f:
        f.write(str(previous_version))

    print(">>>>>>>>>>>>>>>>>>>>>>>> Beginning activation for {} in {}! <<<<<<<<<<<<<<<<<<<<<<<<".format(crc_env, aka_env))
    print("Activating v{}".format(version_to_activate))

    # Activate on given env
    util.activateVersion(version_to_activate, aka_env, crc_env)

    # Wait, if necessary
    if waitForActivation:
        util.waitForActiveVersion(int(version_to_activate), aka_env, crc_env)
def main():
    # Authenticate with EdgeGrid
    # TODO: Change this authentication to get rid of the httpie dependency. Apprently there's a vulnerability
    util.initEdgeGridAuth()

    # Get the Cloud Services config files (main source of truth) for all configured releases
    releases = util.getYMLFromFile("../releases.yml")
    cs_config_list = []
    for env in releases:
        cs_config_list.append({
            "name":
            env,
            "branch":
            releases[env]["branch"],
            "prefix":
            releases[env]["prefix"] if "prefix" in releases[env] else "",
            "config":
            generateConfigForBranch(releases[env]["prefix"] if "prefix" in
                                    releases[env] else "")
        })

    if len(sys.argv) > 2:
        property_env = sys.argv[2]
    else:
        property_env = "STAGING"

    # Create a new version based off of the active Prod version
    new_version_number = createNewVersion(property_env)

    # Update the rules JSON using the CS configuration as a reference
    updatePropertyRulesUsingConfig(new_version_number, cs_config_list)

    # Activate version
    util.activateVersion(new_version_number, property_env)

    # Wait for new version to be active
    waitForActiveVersion(int(new_version_number), property_env)