summaryrefslogtreecommitdiff
path: root/lib/ci
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-06-05 16:39:45 +0200
committerTomasz Maczukin <tomasz@maczukin.pl>2017-06-12 12:58:35 +0200
commitb7d6bb9763ce0c682fae787c452103102624da26 (patch)
treee84543bbac2a2bd339b9b38b56e1746086d94455 /lib/ci
parentc70e9f2ed107ac3d0189a803eae6e7e7917f6224 (diff)
downloadgitlab-ce-b7d6bb9763ce0c682fae787c452103102624da26.tar.gz
Ensure that old API v1 generates still the same output
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/api/entities.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/ci/api/entities.rb b/lib/ci/api/entities.rb
index 792ff628b09..6733d1a33aa 100644
--- a/lib/ci/api/entities.rb
+++ b/lib/ci/api/entities.rb
@@ -45,7 +45,25 @@ module Ci
expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? }
expose :options do |model|
- model.options
+ options = model.options
+
+ # This part ensures that output of old API is still the same after adding support
+ # for extended docker configuration options, used by new API
+ #
+ # I'm leaving this here, not in the model, because it should be removed at the same time
+ # when old API will be removed (planned for August 2017).
+ options[:image] = options[:image][:name] if options[:image].present? && options[:image].is_a?(Hash)
+ if options[:services].present?
+ options[:services].map! do |service|
+ if service.is_a?(Hash)
+ service[:name]
+ else
+ service
+ end
+ end
+ end
+
+ options
end
expose :timeout do |model|