Exemplo n.º 1
0
def record_deployment(revision, newrelic_apikey, newrelic_appid, comment, user):
    newrelic_apikey = getenv('NEW_RELIC_API_KEY', newrelic_apikey)
    newrelic_appid = getenv('NEW_RELIC_APP_ID', newrelic_appid)

    if not revision or not newrelic_apikey or not newrelic_appid:
        return False

    user = user or getpass.getuser()

    click.secho('Recording deployment in New Relic', nl=False)

    deployment = Deployment(newrelic_apikey, newrelic_appid, user)
    deployment.deploy(revision, '', comment)

    click.secho('\nDone\n', fg='green')

    return True
Exemplo n.º 2
0
def record_deployment(revision, api_key, app_id, comment, user):
    api_key = getenv('NEW_RELIC_API_KEY', api_key)
    app_id = getenv('NEW_RELIC_APP_ID', app_id)

    if not revision or not api_key or not app_id:
        return False

    user = user or getpass.getuser()

    click.secho('Recording deployment in New Relic', nl=False)

    deployment = Deployment(api_key, app_id, user)
    deployment.deploy(revision, '', comment)

    click.secho('\nDone\n', fg='green')

    return True
Exemplo n.º 3
0
def test_deploy_sucessful(post, api_key, app_id, user, revision, changelog, description):
    post.return_value = DeploymentResponseSuccessfulMock()

    deployment = Deployment(api_key, app_id, user)
    response = deployment.deploy(revision, changelog, description)
    payload = deployment.get_payload(revision, changelog, description)

    post.assert_called_with(deployment.endpoint, headers=deployment.headers, json=payload)
    assert response.status_code == 201
Exemplo n.º 4
0
def test_deploy_sucessful(post, api_key, app_id, user, region, revision, changelog, description):
    post.return_value = DeploymentResponseSuccessfulMock()

    deployment = Deployment(api_key, app_id, user, region)
    response = deployment.deploy(revision, changelog, description)
    payload = deployment.get_payload(revision, changelog, description)

    post.assert_called_with(deployment.endpoint, headers=deployment.headers, json=payload)
    assert response.status_code == 201
Exemplo n.º 5
0
def record_deployment(tag, api_key, app_id, region, revision, comment, user):
    api_key = getenv('NEW_RELIC_API_KEY', api_key)
    app_id = getenv('NEW_RELIC_APP_ID', app_id)
    region = getenv('NEW_RELIC_REGION', region)
    revision = getenv('NEW_RELIC_REVISION', revision) or tag

    if not revision or not api_key or not app_id:
        if api_key:
            click.secho('Missing required parameters for recording New Relic deployment.' \
                        'Please see https://github.com/fabfuel/ecs-deploy#new-relic')
        return False

    user = user or getpass.getuser()

    click.secho('Recording deployment in New Relic', nl=False)

    deployment = Deployment(api_key, app_id, user, region)
    deployment.deploy(revision, '', comment)

    click.secho('\nDone\n', fg='green')

    return True
Exemplo n.º 6
0
def test_deploy_unsucessful(post, api_key, app_id, user, revision, changelog, description):
    with raises(NewRelicDeploymentException):
        post.return_value = DeploymentResponseUnsuccessfulMock()
        deployment = Deployment(api_key, app_id, user)
        deployment.deploy(revision, changelog, description)
Exemplo n.º 7
0
def test_deploy_unsucessful(post, api_key, app_id, user, region, revision, changelog, description):
    with raises(NewRelicDeploymentException):
        post.return_value = DeploymentResponseUnsuccessfulMock()
        deployment = Deployment(api_key, app_id, user, region)
        deployment.deploy(revision, changelog, description)