File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,16 +109,28 @@ def upload
109109 end
110110
111111 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- )
112+ begin
113+ @version = eb . create_application_version (
114+ application_name : app ,
115+ version_label : label ,
116+ description : clean ( description [ 0 , 200 ] ) ,
117+ source_bundle : {
118+ s3_bucket : bucket . name ,
119+ s3_key : object . key
120+ } ,
121+ auto_create_application : false
122+ )
123+ rescue rescue Aws ::ElasticBeanstalk ::Errors ::ServiceError => e
124+ raise e unless e . message . match? ( /^Application Version %{version_label} already exists.$/ )
125+ info "%{e.message} Will use this version and proceed."
126+ ver = eb . describe_application_versions ( {
127+ application_name : app ,
128+ version_labels : [ label ] ,
129+ } ) . application_versions [ 0 ]
130+ @version = { application_version : ver }
131+ end
132+
133+
122134 end
123135
124136 def update_app
You can’t perform that action at this time.
0 commit comments