diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-06-06 08:32:04 +0000 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-06-10 07:15:25 +0000 |
commit | f8c953861df7df971c670585991d2f394f1650f8 (patch) | |
tree | 0a9597b129ef0aae1c382f6731dd9d836a8db36f | |
parent | f7f310e7229f77713b134174f1fdf40f1021bf6b (diff) | |
download | gitlab-ce-f8c953861df7df971c670585991d2f394f1650f8.tar.gz |
Merge branch 'revert-86900f00' into 'master'
Revert "Disable retrying cancelled jobs"
Closes #62350
See merge request gitlab-org/gitlab-ce!29201
(cherry picked from commit 8501edcd465923c9c6a45abe6c863fc3cd25973a)
e58e24b4 Revert "Merge branch..."
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | doc/ci/pipelines.md | 3 | ||||
-rw-r--r-- | spec/features/projects/jobs_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/projects/pipelines/pipeline_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/factory_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/ci/build_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/jobs_spec.rb | 4 |
7 files changed, 16 insertions, 19 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index d2f5ff13408..5a2ead41578 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -352,7 +352,7 @@ module Ci end def retryable? - !archived? && (success? || failed?) + !archived? && (success? || failed? || canceled?) end def retries_count diff --git a/doc/ci/pipelines.md b/doc/ci/pipelines.md index 4dbe1a85588..b1437b70fe0 100644 --- a/doc/ci/pipelines.md +++ b/doc/ci/pipelines.md @@ -266,9 +266,6 @@ Clicking on an individual job will show you its job trace, and allow you to: - Retry the job. - Erase the job trace. -NOTE: **Note:** -To prevent jobs from being bypassed or run out of order, canceled jobs can only be retried when the whole pipeline they belong to is retried. - ### Seeing the failure reason for jobs > [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17782) in GitLab 10.7. diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 9cf04fe13b4..224375daf71 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -936,8 +936,8 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do find('.js-cancel-job').click end - it 'loads the page and shows no controls' do - expect(page).not_to have_content 'Retry' + it 'loads the page and shows all needed controls' do + expect(page).to have_content 'Retry' end end end @@ -946,7 +946,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do context "Job from project", :js do before do job.run! - job.drop!(:script_failure) + job.cancel! visit project_job_path(project, job) wait_for_requests diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index a1115b514d3..4cd19e64ec7 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -115,11 +115,11 @@ describe 'Pipeline', :js do end end - it 'cancels the running build and does not show retry button' do + it 'cancels the running build and shows retry button' do find('#ci-badge-deploy .ci-action-icon-container').click page.within('#ci-badge-deploy') do - expect(page).not_to have_css('.js-icon-retry') + expect(page).to have_css('.js-icon-retry') end end end @@ -133,11 +133,11 @@ describe 'Pipeline', :js do end end - it 'cancels the preparing build and does not show retry button' do + it 'cancels the preparing build and shows retry button' do find('#ci-badge-deploy .ci-action-icon-container').click page.within('#ci-badge-deploy') do - expect(page).not_to have_css('.js-icon-retry') + expect(page).to have_css('.js-icon-retry') end end end diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index 025439f1b6e..b6231510b91 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -163,11 +163,11 @@ describe Gitlab::Ci::Status::Build::Factory do it 'matches correct extended statuses' do expect(factory.extended_statuses) - .to eq [Gitlab::Ci::Status::Build::Canceled] + .to eq [Gitlab::Ci::Status::Build::Canceled, Gitlab::Ci::Status::Build::Retryable] end - it 'does not fabricate a retryable build status' do - expect(status).not_to be_a Gitlab::Ci::Status::Build::Retryable + it 'fabricates a retryable build status' do + expect(status).to be_a Gitlab::Ci::Status::Build::Retryable end it 'fabricates status with correct details' do @@ -177,7 +177,7 @@ describe Gitlab::Ci::Status::Build::Factory do expect(status.illustration).to include(:image, :size, :title) expect(status.label).to eq 'canceled' expect(status).to have_details - expect(status).not_to have_action + expect(status).to have_action end end diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 9b489baf163..771166e39f7 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1434,7 +1434,7 @@ describe Ci::Build do build.cancel! end - it { is_expected.not_to be_retryable } + it { is_expected.to be_retryable } end end @@ -1964,7 +1964,7 @@ describe Ci::Build do context 'when build has been canceled' do subject { build_stubbed(:ci_build, :manual, status: :canceled) } - it { is_expected.not_to be_playable } + it { is_expected.to be_playable } end context 'when build is successful' do diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index c14507de186..ed2ef4c730b 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -863,7 +863,7 @@ describe API::Jobs do end describe 'POST /projects/:id/jobs/:job_id/retry' do - let(:job) { create(:ci_build, :failed, pipeline: pipeline) } + let(:job) { create(:ci_build, :canceled, pipeline: pipeline) } before do post api("/projects/#{project.id}/jobs/#{job.id}/retry", api_user) @@ -873,7 +873,7 @@ describe API::Jobs do context 'user with :update_build permission' do it 'retries non-running job' do expect(response).to have_gitlab_http_status(201) - expect(project.builds.first.status).to eq('failed') + expect(project.builds.first.status).to eq('canceled') expect(json_response['status']).to eq('pending') end end |