diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 09:08:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 09:08:32 +0000 |
commit | 7d19df2d34a9803d9f077c16315ba919b7ae2aa2 (patch) | |
tree | 80a824f477c1b450a1f082576a00d6851f3c6582 | |
parent | cebee31a0483ef7f2cade3d6dde0a53a68e86cc6 (diff) | |
download | gitlab-ce-7d19df2d34a9803d9f077c16315ba919b7ae2aa2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
10 files changed, 172 insertions, 40 deletions
diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index b1699ce147f..15479bd59d5 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -38,7 +38,7 @@ - "doc/README.md" # Some RSpec test rely on this file # Make sure to update all the similar patterns in other CI config files if you modify these patterns -.code-backstage-patterns-qa: &code-backstage-patterns-qa +.code-backstage-qa-patterns: &code-backstage-qa-patterns - ".gitlab/ci/**/*" - ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}" - ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml" @@ -118,7 +118,7 @@ gitlab:assets:compile pull-push-cache: - <<: *if-not-canonical-namespace when: never - <<: *if-master-refs - changes: *code-backstage-patterns-qa + changes: *code-backstage-qa-patterns when: on_success cache: policy: pull-push @@ -129,7 +129,7 @@ gitlab:assets:compile pull-cache: - <<: *if-not-canonical-namespace when: never - <<: *if-default-refs - changes: *code-backstage-patterns-qa + changes: *code-backstage-qa-patterns when: on_success cache: policy: pull @@ -163,7 +163,7 @@ compile-assets pull-push-cache: extends: .compile-assets-metadata rules: - <<: *if-master-refs - changes: *code-backstage-patterns-qa + changes: *code-backstage-qa-patterns when: on_success cache: policy: pull-push @@ -176,7 +176,7 @@ compile-assets pull-push-cache foss: - <<: *if-not-ee when: never - <<: *if-master-refs - changes: *code-backstage-patterns-qa + changes: *code-backstage-qa-patterns when: on_success cache: policy: pull-push @@ -186,7 +186,7 @@ compile-assets pull-cache: extends: .compile-assets-metadata rules: - <<: *if-default-refs - changes: *code-backstage-patterns-qa + changes: *code-backstage-qa-patterns when: on_success cache: policy: pull @@ -199,26 +199,24 @@ compile-assets pull-cache foss: - <<: *if-not-ee when: never - <<: *if-default-refs - changes: *code-backstage-patterns-qa + changes: *code-backstage-qa-patterns when: on_success cache: policy: pull key: "assets-compile:v8:foss" -.only-code-frontend-job-base: +.frontend-job-base: extends: - .default-tags - .default-retry - .default-cache - - .default-only - .default-before_script - - .only:changes-code-backstage - .use-pg9 stage: test needs: ["setup-test-env", "compile-assets pull-cache"] .karma-base: - extends: .only-code-frontend-job-base + extends: .frontend-job-base variables: # we override the max_old_space_size to prevent OOM errors NODE_OPTIONS: --max_old_space_size=3584 @@ -231,6 +229,10 @@ compile-assets pull-cache foss: karma: extends: .karma-base + rules: + - <<: *if-default-refs + changes: *code-backstage-patterns + when: on_success coverage: '/^Statements *: (\d+\.\d+%)/' artifacts: name: coverage-javascript @@ -246,10 +248,16 @@ karma: karma-foss: extends: - .karma-base - - .only-ee-as-if-foss + - .as-if-foss + rules: + - <<: *if-not-ee + when: never + - <<: *if-default-refs + changes: *code-backstage-patterns + when: on_success .jest-base: - extends: .only-code-frontend-job-base + extends: .frontend-job-base script: - scripts/gitaly-test-spawn - date @@ -264,6 +272,10 @@ karma-foss: jest: extends: .jest-base + rules: + - <<: *if-default-refs + changes: *code-backstage-patterns + when: on_success artifacts: name: coverage-frontend expire_in: 31d @@ -278,7 +290,13 @@ jest: jest-foss: extends: - .jest-base - - .only-ee-as-if-foss + - .as-if-foss + rules: + - <<: *if-not-ee + when: never + - <<: *if-default-refs + changes: *code-backstage-patterns + when: on_success cache: policy: pull diff --git a/changelogs/unreleased/23140-productivity-analytics-limit-graph-scales-to-whole-numbers.yml b/changelogs/unreleased/23140-productivity-analytics-limit-graph-scales-to-whole-numbers.yml new file mode 100644 index 00000000000..83cdbe86de7 --- /dev/null +++ b/changelogs/unreleased/23140-productivity-analytics-limit-graph-scales-to-whole-numbers.yml @@ -0,0 +1,5 @@ +--- +title: Limit productivity analytics graph y-axis scale to whole numbers +merge_request: 23140 +author: +type: fixed diff --git a/changelogs/unreleased/33128-cannot-find-projects-within-subgroups-when-you-select-a-top-level-g.yml b/changelogs/unreleased/33128-cannot-find-projects-within-subgroups-when-you-select-a-top-level-g.yml new file mode 100644 index 00000000000..c5eea30e8a0 --- /dev/null +++ b/changelogs/unreleased/33128-cannot-find-projects-within-subgroups-when-you-select-a-top-level-g.yml @@ -0,0 +1,5 @@ +--- +title: Query projects of subgroups in productivity analytics +merge_request: 24335 +author: +type: fixed diff --git a/changelogs/unreleased/rs-scheduled-pipeline-play-api.yml b/changelogs/unreleased/rs-scheduled-pipeline-play-api.yml new file mode 100644 index 00000000000..c21d2774084 --- /dev/null +++ b/changelogs/unreleased/rs-scheduled-pipeline-play-api.yml @@ -0,0 +1,5 @@ +--- +title: Add API to "Play" a scheduled pipeline immediately +merge_request: 23718 +author: +type: added diff --git a/doc/api/pipeline_schedules.md b/doc/api/pipeline_schedules.md index f859a01cd37..3624921fde7 100644 --- a/doc/api/pipeline_schedules.md +++ b/doc/api/pipeline_schedules.md @@ -279,6 +279,36 @@ curl --request DELETE --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gi } ``` +## Run a scheduled pipeline immediately + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/201786) in GitLab 12.8. + +Trigger a new scheduled pipeline, which runs immediately. The next scheduled run +of this pipeline is not affected. + +```text +POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/play +``` + +| Attribute | Type | required | Description | +| ---------------- | --------- | ---------- | -------------------------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | +| `pipeline_schedule_id` | integer | yes | The pipeline schedule id | + +Example request: + +```sh +curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" 'https://gitlab.example.com/api/v4/projects/42/pipeline_schedules/1/play +``` + +Example response: + +```json +{ + "message": "201 Created" +} +``` + ## Pipeline schedule variables > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/34518) in GitLab 10.0. diff --git a/lib/api/pipeline_schedules.rb b/lib/api/pipeline_schedules.rb index 1d1ef1afc6b..61c40c54d69 100644 --- a/lib/api/pipeline_schedules.rb +++ b/lib/api/pipeline_schedules.rb @@ -111,6 +111,25 @@ module API destroy_conditionally!(pipeline_schedule) end + desc 'Play a scheduled pipeline immediately' do + detail 'This feature was added in GitLab 12.8' + end + params do + requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' + end + post ':id/pipeline_schedules/:pipeline_schedule_id/play' do + authorize! :play_pipeline_schedule, pipeline_schedule + + job_id = RunPipelineScheduleWorker + .perform_async(pipeline_schedule.id, current_user.id) + + if job_id + created! + else + render_api_error!('Unable to schedule pipeline run immediately', 500) + end + end + desc 'Create a new pipeline schedule variable' do success Entities::Variable end diff --git a/spec/frontend/issue_show/mock_data.js b/spec/frontend/issue_show/mock_data.js new file mode 100644 index 00000000000..ff01a004186 --- /dev/null +++ b/spec/frontend/issue_show/mock_data.js @@ -0,0 +1,23 @@ +export const initialRequest = { + title: '<p>this is a title</p>', + title_text: 'this is a title', + description: '<p>this is a description!</p>', + description_text: 'this is a description', + task_status: '2 of 4 completed', + updated_at: '2015-05-15T12:31:04.428Z', + updated_by_name: 'Some User', + updated_by_path: '/some_user', + lock_version: 1, +}; + +export const secondRequest = { + title: '<p>2</p>', + title_text: '2', + description: '<p>42</p>', + description_text: '42', + task_status: '0 of 0 completed', + updated_at: '2016-05-15T12:31:04.428Z', + updated_by_name: 'Other User', + updated_by_path: '/other_user', + lock_version: 2, +}; diff --git a/spec/javascripts/issue_show/components/app_spec.js b/spec/javascripts/issue_show/components/app_spec.js index 4c405fbc4d1..fdd6f4e6470 100644 --- a/spec/javascripts/issue_show/components/app_spec.js +++ b/spec/javascripts/issue_show/components/app_spec.js @@ -7,13 +7,13 @@ import axios from '~/lib/utils/axios_utils'; import '~/behaviors/markdown/render_gfm'; import issuableApp from '~/issue_show/components/app.vue'; import eventHub from '~/issue_show/event_hub'; -import issueShowData from '../mock_data'; +import { initialRequest, secondRequest } from '../mock_data'; function formatText(text) { return text.trim().replace(/\s\s+/g, ' '); } -const REALTIME_REQUEST_STACK = [issueShowData.initialRequest, issueShowData.secondRequest]; +const REALTIME_REQUEST_STACK = [initialRequest, secondRequest]; describe('Issuable output', () => { let mock; diff --git a/spec/javascripts/issue_show/mock_data.js b/spec/javascripts/issue_show/mock_data.js index f4475aadb8b..1b391bd1588 100644 --- a/spec/javascripts/issue_show/mock_data.js +++ b/spec/javascripts/issue_show/mock_data.js @@ -1,24 +1 @@ -export default { - initialRequest: { - title: '<p>this is a title</p>', - title_text: 'this is a title', - description: '<p>this is a description!</p>', - description_text: 'this is a description', - task_status: '2 of 4 completed', - updated_at: '2015-05-15T12:31:04.428Z', - updated_by_name: 'Some User', - updated_by_path: '/some_user', - lock_version: 1, - }, - secondRequest: { - title: '<p>2</p>', - title_text: '2', - description: '<p>42</p>', - description_text: '42', - task_status: '0 of 0 completed', - updated_at: '2016-05-15T12:31:04.428Z', - updated_by_name: 'Other User', - updated_by_path: '/other_user', - lock_version: 2, - }, -}; +export * from '../../frontend/issue_show/mock_data'; diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index 5c8ccce2e37..42fc97729bd 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -322,6 +322,56 @@ describe API::PipelineSchedules do end end + describe 'POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/play' do + let_it_be(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project) } + + let(:route) { ->(id) { "/projects/#{project.id}/pipeline_schedules/#{id}/play" } } + + context 'authenticated user with `:play_pipeline_schedule` permission' do + it 'schedules a pipeline worker' do + project.add_developer(developer) + + expect(RunPipelineScheduleWorker) + .to receive(:perform_async) + .with(pipeline_schedule.id, developer.id) + .and_call_original + post api(route[pipeline_schedule.id], developer) + + expect(response).to have_gitlab_http_status(:created) + end + + it 'renders an error if scheduling failed' do + project.add_developer(developer) + + expect(RunPipelineScheduleWorker) + .to receive(:perform_async) + .with(pipeline_schedule.id, developer.id) + .and_return(nil) + post api(route[pipeline_schedule.id], developer) + + expect(response).to have_gitlab_http_status(:internal_server_error) + end + end + + context 'authenticated user with insufficient access' do + it 'responds with not found' do + project.add_guest(user) + + post api(route[pipeline_schedule.id], user) + + expect(response).to have_gitlab_http_status(:not_found) + end + end + + context 'unauthenticated user' do + it 'responds with unauthorized' do + post api(route[pipeline_schedule.id]) + + expect(response).to have_gitlab_http_status(:unauthorized) + end + end + end + describe 'POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables' do let(:params) { attributes_for(:ci_pipeline_schedule_variable) } |