summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/pipeline/seed/build.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-21 09:33:14 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-03-21 09:33:25 +0100
commitab0cd2a8bf54209e5e1b9594752d5158d3cf5faa (patch)
tree0bd0de2b734caa767efcd836092e22b26fac8af4 /lib/gitlab/ci/pipeline/seed/build.rb
parentd16bb44726a9bdfdd9d9b22f0c802aa65c2f6154 (diff)
downloadgitlab-ce-ab0cd2a8bf54209e5e1b9594752d5158d3cf5faa.tar.gz
Introduce pipeline build seeds
Diffstat (limited to 'lib/gitlab/ci/pipeline/seed/build.rb')
-rw-r--r--lib/gitlab/ci/pipeline/seed/build.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/ci/pipeline/seed/build.rb b/lib/gitlab/ci/pipeline/seed/build.rb
new file mode 100644
index 00000000000..f5dbb3a1c40
--- /dev/null
+++ b/lib/gitlab/ci/pipeline/seed/build.rb
@@ -0,0 +1,28 @@
+module Gitlab
+ module Ci
+ module Pipeline
+ module Seed
+ class Build < Seed::Base
+ def initialize(pipeline, attributes)
+ @pipeline = pipeline
+ @attributes = attributes
+ end
+
+ # TODO find a different solution
+ #
+ def user=(current_user)
+ @attributes.merge!(user: current_user)
+ end
+
+ def attributes
+ @attributes.merge(project: @pipeline.project,
+ ref: @pipeline.ref,
+ tag: @pipeline.tag,
+ trigger_request: @pipeline.legacy_trigger,
+ protected: @pipeline.protected_ref?)
+ end
+ end
+ end
+ end
+ end
+end