summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-10-27 03:38:36 +0200
committerMatija Čupić <matteeyah@gmail.com>2018-10-27 03:41:14 +0200
commit72430483ded51e9a7d01ef70c3dce3dda174fac1 (patch)
treeb50f97467a1b7d503b01229602245df1a2c4300a /app/models/ci/build.rb
parent44b740f99dfe6a4344c918fd4c94972aa6f9237e (diff)
downloadgitlab-ce-72430483ded51e9a7d01ef70c3dce3dda174fac1.tar.gz
Refactor parallelization implementation
* Move the variables to ::Ci::Build#predefined_variables * Tweak pipeline build seed implementation
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index cdfe8175a42..21e2f289e1e 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -801,10 +801,16 @@ module Ci
variables.append(key: "CI_COMMIT_TAG", value: ref) if tag?
variables.append(key: "CI_PIPELINE_TRIGGERED", value: 'true') if trigger_request
variables.append(key: "CI_JOB_MANUAL", value: 'true') if action?
+ variables.append(key: "CI_NODE_INDEX", value: node_index.to_s) if self.options[:parallel]
+ variables.append(key: "CI_NODE_TOTAL", value: self.options.fetch(:parallel, 1).to_s)
variables.concat(legacy_variables)
end
end
+ def node_index
+ name.match(%r{(\d+)/\d+$}).captures[0]
+ end
+
def gitlab_version_info
@gitlab_version_info ||= Gitlab::VersionInfo.parse(Gitlab::VERSION)
end