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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-26 18:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-26 18:08:56 +0300
commit17ab40ca089e1aef61a83f77ab6df62a72f6ce06 (patch)
tree8eb149293eee90ec2750b6ac5e46a111a806424e /app/services/ci
parent66d4203791a01fdedf668a78818a229ea2c07aad (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/ci')
-rw-r--r--app/services/ci/create_job_artifacts_service.rb37
-rw-r--r--app/services/ci/retry_build_service.rb3
2 files changed, 28 insertions, 12 deletions
diff --git a/app/services/ci/create_job_artifacts_service.rb b/app/services/ci/create_job_artifacts_service.rb
index e633dc7f633..3aa2b16bc73 100644
--- a/app/services/ci/create_job_artifacts_service.rb
+++ b/app/services/ci/create_job_artifacts_service.rb
@@ -1,8 +1,13 @@
# frozen_string_literal: true
module Ci
- class CreateJobArtifactsService
+ class CreateJobArtifactsService < ::BaseService
ArtifactsExistError = Class.new(StandardError)
+ OBJECT_STORAGE_ERRORS = [
+ Errno::EIO,
+ Google::Apis::ServerError,
+ Signet::RemoteServerError
+ ].freeze
def execute(job, artifacts_file, params, metadata_file: nil)
expire_in = params['expire_in'] ||
@@ -26,18 +31,20 @@ module Ci
expire_in: expire_in)
end
- job.update(artifacts_expire_in: expire_in)
- rescue ActiveRecord::RecordNotUnique => error
- return true if sha256_matches_existing_artifact?(job, params['artifact_type'], artifacts_file)
+ if job.update(artifacts_expire_in: expire_in)
+ success
+ else
+ error(job.errors.messages, :bad_request)
+ end
- Gitlab::ErrorTracking.track_exception(error,
- job_id: job.id,
- project_id: job.project_id,
- uploading_type: params['artifact_type']
- )
+ rescue ActiveRecord::RecordNotUnique => error
+ return success if sha256_matches_existing_artifact?(job, params['artifact_type'], artifacts_file)
- job.errors.add(:base, 'another artifact of the same type already exists')
- false
+ track_exception(error, job, params)
+ error('another artifact of the same type already exists', :bad_request)
+ rescue *OBJECT_STORAGE_ERRORS => error
+ track_exception(error, job, params)
+ error(error.message, :service_unavailable)
end
private
@@ -48,5 +55,13 @@ module Ci
existing_artifact.file_sha256 == artifacts_file.sha256
end
+
+ def track_exception(error, job, params)
+ Gitlab::ErrorTracking.track_exception(error,
+ job_id: job.id,
+ project_id: job.project_id,
+ uploading_type: params['artifact_type']
+ )
+ end
end
end
diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb
index 838ed789155..87f818ad497 100644
--- a/app/services/ci/retry_build_service.rb
+++ b/app/services/ci/retry_build_service.rb
@@ -5,7 +5,8 @@ module Ci
CLONE_ACCESSORS = %i[pipeline project ref tag options name
allow_failure stage stage_id stage_idx trigger_request
yaml_variables when environment coverage_regex
- description tag_list protected needs resource_group scheduling_type].freeze
+ description tag_list protected needs_attributes
+ resource_group scheduling_type].freeze
def execute(build)
reprocess!(build).tap do |new_build|