Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index c4d1a2c740b..68ec196a9ee 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -10,6 +10,8 @@ module Ci
include Presentable
include Importable
include Ci::HasRef
+ include HasDeploymentName
+
extend ::Gitlab::Utils::Override
BuildArchivedError = Class.new(StandardError)
@@ -35,6 +37,8 @@ module Ci
DEGRADATION_THRESHOLD_VARIABLE_NAME = 'DEGRADATION_THRESHOLD'
RUNNERS_STATUS_CACHE_EXPIRATION = 1.minute
+ DEPLOYMENT_NAMES = %w[deploy release rollout].freeze
+
has_one :deployment, as: :deployable, class_name: 'Deployment'
has_one :pending_state, class_name: 'Ci::BuildPendingState', inverse_of: :build
has_one :queuing_entry, class_name: 'Ci::PendingBuild', foreign_key: :build_id
@@ -68,6 +72,7 @@ module Ci
delegate :terminal_specification, to: :runner_session, allow_nil: true
delegate :service_specification, to: :runner_session, allow_nil: true
delegate :gitlab_deploy_token, to: :project
+ delegate :harbor_integration, to: :project
delegate :trigger_short_token, to: :trigger_request, allow_nil: true
##
@@ -579,6 +584,7 @@ module Ci
.append(key: 'CI_REGISTRY_PASSWORD', value: token.to_s, public: false, masked: true)
.append(key: 'CI_REPOSITORY_URL', value: repo_url.to_s, public: false)
.concat(deploy_token_variables)
+ .concat(harbor_variables)
end
end
@@ -615,6 +621,12 @@ module Ci
end
end
+ def harbor_variables
+ return [] unless harbor_integration.try(:activated?)
+
+ Gitlab::Ci::Variables::Collection.new(harbor_integration.ci_variables)
+ end
+
def features
{
trace_sections: true,
@@ -1123,6 +1135,10 @@ module Ci
.include?(exit_code)
end
+ def track_deployment_usage
+ Gitlab::Utils::UsageData.track_usage_event('ci_users_executing_deployment_job', user_id) if user_id.present? && count_user_deployment?
+ end
+
protected
def run_status_commit_hooks!