From 2cc9a785dfdada5e2976b8341d3c9e6eae8fa66f Mon Sep 17 00:00:00 2001
From: Kamil Trzcinski <ayufan@ayufan.eu>
Date: Wed, 14 Sep 2016 22:33:56 +0200
Subject: [PATCH] Properly create deployment using all possible options

---
 app/models/ci/build.rb | 15 ++++++++-------
 lib/ci/api/entities.rb |  9 +++++++++
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index abdf8c76447..47dedef38d0 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -79,13 +79,14 @@ module Ci
 
       after_transition any => [:success] do |build|
         if build.environment.present?
-          service = CreateDeploymentService.new(build.project, build.user,
-                                                environment: build.environment,
-                                                sha: build.sha,
-                                                ref: build.ref,
-                                                tag: build.tag,
-                                                options: build.options[:environment],
-                                                variables: variables)
+          service = CreateDeploymentService.new(
+            build.project, build.user,
+            environment: build.environment,
+            sha: build.sha,
+            ref: build.ref,
+            tag: build.tag,
+            options: build.options[:environment],
+            variables: variables)
           service.execute(build)
         end
       end
diff --git a/lib/ci/api/entities.rb b/lib/ci/api/entities.rb
index 3f5bdaba3f5..66c05773b68 100644
--- a/lib/ci/api/entities.rb
+++ b/lib/ci/api/entities.rb
@@ -15,6 +15,15 @@ module Ci
         expose :filename, :size
       end
 
+      class BuildOptions < Grape::Entity
+        expose :image
+        expose :services
+        expose :artifacts
+        expose :cache
+        expose :dependencies
+        expose :after_script
+      end
+
       class Build < Grape::Entity
         expose :id, :ref, :tag, :sha, :status
         expose :name, :token, :stage
-- 
GitLab