diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-04-15 08:00:56 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-04-15 08:00:56 +0000 |
commit | 2b155818850d308ce1e48d0724c33a25b9ad47ed (patch) | |
tree | e2e2256e17a5955c791d8302ab4df1e72e38668d | |
parent | 35d4810f1454ae905f8578f8683020df514050c6 (diff) | |
parent | 8ede9d188e20d9e173fa6f0c5d899771a392b78a (diff) | |
download | gitlab-ce-2b155818850d308ce1e48d0724c33a25b9ad47ed.tar.gz |
Automatic merge of gitlab-org/gitlab-ce master
-rw-r--r-- | .gitlab-ci.yml | 10 | ||||
-rw-r--r-- | app/services/ci/prepare_build_service.rb | 8 | ||||
-rw-r--r-- | spec/services/ci/prepare_build_service_spec.rb | 16 |
3 files changed, 26 insertions, 8 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69cda9c0483..93f61ea83d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -83,13 +83,15 @@ stages: .use-pg: &use-pg services: - - postgres:9.6 - - redis:alpine + - name: postgres:9.6 + command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] + - name: redis:alpine .use-pg-10: &use-pg-10 services: - - postgres:10.0 - - redis:alpine + - name: postgres:10.0 + command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] + - name: redis:alpine .use-mysql: &use-mysql services: diff --git a/app/services/ci/prepare_build_service.rb b/app/services/ci/prepare_build_service.rb index 32f11438b79..3722faeb020 100644 --- a/app/services/ci/prepare_build_service.rb +++ b/app/services/ci/prepare_build_service.rb @@ -11,9 +11,11 @@ module Ci def execute prerequisites.each(&:complete!) - unless build.enqueue - build.drop!(:unmet_prerequisites) - end + build.enqueue! + rescue => e + Gitlab::Sentry.track_acceptable_exception(e, extra: { build_id: build.id }) + + build.drop(:unmet_prerequisites) end private diff --git a/spec/services/ci/prepare_build_service_spec.rb b/spec/services/ci/prepare_build_service_spec.rb index 1797f8f964f..2d027f13e52 100644 --- a/spec/services/ci/prepare_build_service_spec.rb +++ b/spec/services/ci/prepare_build_service_spec.rb @@ -38,7 +38,21 @@ describe Ci::PrepareBuildService do end it 'drops the build' do - expect(build).to receive(:drop!).with(:unmet_prerequisites).once + expect(build).to receive(:drop).with(:unmet_prerequisites).once + + subject + end + end + + context 'prerequisites raise an error' do + before do + allow(prerequisite).to receive(:complete!).and_raise Kubeclient::HttpError.new(401, 'unauthorized', nil) + end + + it 'drops the build and notifies Sentry' do + expect(build).to receive(:drop).with(:unmet_prerequisites).once + expect(Gitlab::Sentry).to receive(:track_acceptable_exception) + .with(instance_of(Kubeclient::HttpError), hash_including(extra: { build_id: build.id })) subject end |