File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ class Elasticbeanstalk < Provider
4444 zip_add : 'Adding %s'
4545
4646 msgs clean_description : 'Removed non-printable characters from the version description'
47+ app_ver_exists : 'Application version already exists, skipping upload and using existing version'
4748
4849 attr_reader :started , :object , :version
4950
@@ -109,16 +110,28 @@ def upload
109110 end
110111
111112 def create_version
112- @version = eb . create_application_version (
113- application_name : app ,
114- version_label : label ,
115- description : clean ( description [ 0 , 200 ] ) ,
116- source_bundle : {
117- s3_bucket : bucket . name ,
118- s3_key : object . key
119- } ,
120- auto_create_application : false
121- )
113+ begin
114+ @version = eb . create_application_version (
115+ application_name : app ,
116+ version_label : label ,
117+ description : clean ( description [ 0 , 200 ] ) ,
118+ source_bundle : {
119+ s3_bucket : bucket . name ,
120+ s3_key : object . key
121+ } ,
122+ auto_create_application : false
123+ )
124+ rescue rescue Aws ::ElasticBeanstalk ::Errors ::ServiceError => e
125+ raise e unless e . message . match? ( /^Application Version [^ ]+ already exists.$/ )
126+ info :app_ver_exists
127+ ver = eb . describe_application_versions ( {
128+ application_name : app ,
129+ version_labels : [ label ] ,
130+ } ) . application_versions [ 0 ]
131+ @version = { application_version : ver }
132+ end
133+
134+
122135 end
123136
124137 def update_app
You can’t perform that action at this time.
0 commit comments