How to use the dcicutils.deployment_utils.EBDeployer.build_application_version function in dcicutils

To help you get started, we’ve selected a few dcicutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 4dn-dcic / foursight / chalicelib / checks / deployment_checks.py View on Github external
# error if we try to deploy prod
    if env == compute_ff_prd_env():
        check.status = 'ERROR'
        check.summary = 'Tried to deploy production env %s from Foursight, aborting.' % env
        return check

    if application_version_name is None:  # if not specified, use branch+timestamp
        application_version_name = 'foursight-package-%s-%s' % (branch, datetime.datetime.utcnow())

    if repo is not None:  # NOTE: if you specify this, assume a CGAP deployment
        repo_location = clone_repo_to_temporary_dir(repo, name='cgap-portal')
    else:
        repo_location = clone_repo_to_temporary_dir()

    try:
        packaging_was_successful = EBDeployer.build_application_version(repo_location, application_version_name,
                                                                        branch=branch)
        time.sleep(10)  # give EB some time to index the new template
        if packaging_was_successful:
            try:
                EBDeployer.deploy_new_version(env, repo_location, application_version_name)
                check.status = 'PASS'
                check.summary = 'Successfully deployed version %s to env %s' % (application_version_name, env)
            except Exception as e:
                check.status = 'ERROR'
                check.summary = 'Exception thrown while deploying: %s' % str(e)
        else:
            check.status = 'ERROR'
            check.summary = 'Could not package repository: %s' % packaging_was_successful
    except Exception as e:
        check.status = 'ERROR'
        check.summary = 'Exception thrown while building application version: %s' % str(e)