Skip to content

Commit

Permalink
Merge pull request #1188 from frenata/1186-fix-codedeploy-wait
Browse files Browse the repository at this point in the history
Fail CodeDeploy when wait_until_deployed fails
  • Loading branch information
BanzaiMan authored Jun 11, 2020
2 parents 2dd0636 + c7b819d commit 598b6f5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/dpl/providers/codedeploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ def create_deployment
def wait_until_deployed(id)
print :waiting_for_deploy
status = poll(id) until %w(Succeeded Failed Stopped).include?(status)
info :finished_deploy, status
case status
when 'Succeeded'
info :finished_deploy, status
else
error :finished_deploy, status
end
end

def poll(id)
Expand Down
14 changes: 14 additions & 0 deletions spec/dpl/providers/codedeploy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@
it { should get_deployment }
end

describe 'given --wait_until_deployed', run: false do
let(:responses) do
{
eb: {
get_deployment: {
deployment_info: { status: 'Failed' }
}
}
}
end

it { expect { subject.run }.to raise_error(/Failed/)}
end

describe 'with ~/.aws/credentials', run: false do
let(:args) { |e| %w(--application app) }

Expand Down

0 comments on commit 598b6f5

Please sign in to comment.