Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve elasticbeanstalk debugging #1176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/dpl/providers/elasticbeanstalk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,30 @@ def zip_exists?
end

def create_zip
n_files = 0
::Zip::File.open(zip_file, ::Zip::File::CREATE) do |zip|
files.each do |path|
debug :zip_add, path
n_files += 1
zip.add(path.sub(cwd, ''), path)
end
end
debug "Zip contains #{n_files} files"
size = File.size(zip_file)
warn "Zip file is empty." if size == 0
# https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-versions.html
warn "Zip file may be too large." if size > 524288000
debug "Zip file size: #{size.to_f / 2**10}kb"
end

def upload
debug "upload zipfile:#{zip_file} bucket path: #{bucket_path}"
@object = bucket.object(bucket_path)
object.put(body: File.open(zip_file))
sleep 5 # s3 eventual consistency
end

def create_version
debug "create_version app:#{app}, label:#{label}, bucket:#{bucket.name}, key:#{object.key}"
@version = eb.create_application_version(
application_name: app,
version_label: label,
Expand Down