def update_deployment_components()

in deploy_component_version.py [0:0]


def update_deployment_components(components):
    """ Updates the existing components to the desired versions """

    # If Docker Application manager is not in the deployment, add the latest version
    if COMPONENT_DOCKER_APPLICATION_MANAGER not in components:
        version = get_newest_component_version(COMPONENT_DOCKER_APPLICATION_MANAGER)
        print('Adding {} {} to the deployment'.format(COMPONENT_DOCKER_APPLICATION_MANAGER, version))
        components.update({COMPONENT_DOCKER_APPLICATION_MANAGER: {'componentVersion': version}})

    # If Secret manager is not in the deployment, add the latest version
    if COMPONENT_SECRET_MANAGER not in components:
        version = get_newest_component_version(COMPONENT_SECRET_MANAGER)
        print('Adding {} {} to the deployment'.format(COMPONENT_SECRET_MANAGER, version))
    else:
        # If it's already in the deployment, use the current version
        version = components[COMPONENT_SECRET_MANAGER]['componentVersion']

    # Ensure that Secret Manager is configured for the secret
    components.update({COMPONENT_SECRET_MANAGER: {
        'componentVersion': version,
        'configurationUpdate': {'merge': '{"cloudSecrets":[{"arn":"' + secret_value['ARN'] + '"}]}'}}
    })

    # Add or update our component to the specified version
    if gdk_config.name() not in components:
        print('Adding {} {} to the deployment'.format(gdk_config.name(), args.version))
    else:
        print('Updating deployment with {} {}'.format(gdk_config.name(), args.version))
    components.update({gdk_config.name(): {'componentVersion': args.version}})