diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/models/ci/build.rb | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index db151126caf..824e35a6480 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -486,6 +486,10 @@ module Ci self.options.fetch(:environment, {}).fetch(:action, 'start') if self.options end + def environment_deployment_tier + self.options.dig(:environment, :deployment_tier) if self.options + end + def outdated_deployment? success? && !deployment.try(:last?) end @@ -510,7 +514,6 @@ module Ci .concat(scoped_variables) .concat(job_variables) .concat(persisted_environment_variables) - .to_runner_variables end end @@ -523,6 +526,7 @@ module Ci .append(key: 'CI_JOB_ID', value: id.to_s) .append(key: 'CI_JOB_URL', value: Gitlab::Routing.url_helpers.project_job_url(project, self)) .append(key: 'CI_JOB_TOKEN', value: token.to_s, public: false, masked: true) + .append(key: 'CI_JOB_STARTED_AT', value: started_at&.iso8601) .append(key: 'CI_BUILD_ID', value: id.to_s) .append(key: 'CI_BUILD_TOKEN', value: token.to_s, public: false, masked: true) .append(key: 'CI_REGISTRY_USER', value: ::Gitlab::Auth::CI_JOB_USER) @@ -564,7 +568,10 @@ module Ci end def features - { trace_sections: true } + { + trace_sections: true, + failure_reasons: self.class.failure_reasons.keys + } end def merge_request @@ -691,7 +698,7 @@ module Ci end def any_runners_online? - project.any_runners? { |runner| runner.active? && runner.online? && runner.can_pick?(self) } + project.any_active_runners? { |runner| runner.match_build_if_online?(self) } end def stuck? @@ -810,14 +817,15 @@ module Ci end def cache - cache = options[:cache] + cache = Array.wrap(options[:cache]) - if cache && project.jobs_cache_index - cache = cache.merge( - key: "#{cache[:key]}-#{project.jobs_cache_index}") + if project.jobs_cache_index + cache = cache.map do |single_cache| + single_cache.merge(key: "#{single_cache[:key]}-#{project.jobs_cache_index}") + end end - [cache] + cache end def credentials @@ -983,7 +991,7 @@ module Ci # TODO: Have `debug_mode?` check against data on sent back from runner # to capture all the ways that variables can be set. # See (https://gitlab.com/gitlab-org/gitlab/-/issues/290955) - variables.any? { |variable| variable[:key] == 'CI_DEBUG_TRACE' && variable[:value].casecmp('true') == 0 } + variables['CI_DEBUG_TRACE']&.value&.casecmp('true') == 0 end def drop_with_exit_code!(failure_reason, exit_code) |