Skip to content

Killing a code deploy in the AWS console can dump a NilClass exception #188

@nikgregory

Description

@nikgregory

I had a launch that somehow failed to have a successful code deployment #39 and to move things along, I stopped the code deploy via the AWS console.

it appears that

  def handle_deployment_failure(deployment_id)
    instances = cd_client.list_deployment_instances(deployment_id: deployment_id)
                         .instances_list.map do |instance_id|
      cd_client.get_deployment_instance(deployment_id: deployment_id,
                                        instance_id: instance_id)
    end

    instances.map(&:instance_summary).each do |inst_summary|
      next unless inst_summary.status == 'Failed'

      inst_summary.lifecycle_events.each do |event|
        next unless event.status == 'Failed'

        ilog.error(event.diagnostics.message)
        event.diagnostics.log_tail.each_line do |line|
          ilog.error(line)
        end
      end
    end

    raise 'Deployment was unsuccessful!'
  end

ilog.error(event.diagnostics.message) seems to be able to return a nil in diagnostics.

  E, [2016-11-30T17:29:59.362336 #29481] ERROR -- : Deployment �[0;34;49md-WI31N9YBJ�[0m failed with status 'Stopped'

  undefined method `message' for nil:NilClass (at /home/jenkins/jobs/workspace/sf-start-stage/apigems/ruby/2.3.0/gems/moonshot-1.0.0.rc1/lib/moonshot/deployment_mechanism/code_deploy.rb:304:in ```

And at this point we cannot really trap a decent error so that we might be able to retry 'something'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions