Skip to content

Commit

Permalink
If application version already exists, use it
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjurkiewicz committed Mar 31, 2020
1 parent 793b282 commit 1fc3773
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions lib/dpl/providers/elasticbeanstalk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,28 @@ def upload
end

def create_version
@version = eb.create_application_version(
application_name: app,
version_label: label,
description: clean(description[0, 200]),
source_bundle: {
s3_bucket: bucket.name,
s3_key: object.key
},
auto_create_application: false
)
begin
@version = eb.create_application_version(
application_name: app,
version_label: label,
description: clean(description[0, 200]),
source_bundle: {
s3_bucket: bucket.name,
s3_key: object.key
},
auto_create_application: false
)
rescue rescue Aws::ElasticBeanstalk::Errors::ServiceError => e
raise e unless e.message.match?(/^Application Version %{version_label} already exists.$/)
info "%{e.message} Will use this version and proceed."
ver = eb.describe_application_versions({
application_name: app,
version_labels: [label],
}).application_versions[0]
@version = { application_version: ver }
end


end

def update_app
Expand Down

0 comments on commit 1fc3773

Please sign in to comment.