Commit ef2dc89e authored by Amit Rathi's avatar Amit Rathi

Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce

parents f7d4d8e4 e4e40b96
......@@ -547,7 +547,7 @@ GEM
orm_adapter (0.5.0)
os (1.0.0)
parallel (1.12.1)
parser (2.5.1.2)
parser (2.5.3.0)
ast (~> 2.4.0)
parslet (1.8.2)
peek (1.0.1)
......
......@@ -40,17 +40,14 @@ export default {
comparableDiffs() {
return this.mergeRequestDiffs.slice(1);
},
isWhitespaceVisible() {
return !getParameterValues('w')[0];
},
toggleWhitespaceText() {
if (this.isWhitespaceVisible) {
if (this.isWhitespaceVisible()) {
return __('Hide whitespace changes');
}
return __('Show whitespace changes');
},
toggleWhitespacePath() {
if (this.isWhitespaceVisible) {
if (this.isWhitespaceVisible()) {
return mergeUrlParams({ w: 1 }, window.location.href);
}
......@@ -67,6 +64,9 @@ export default {
'expandAllFiles',
'toggleShowTreeList',
]),
isWhitespaceVisible() {
return getParameterValues('w')[0] !== '1';
},
},
};
</script>
......@@ -121,7 +121,7 @@ export default {
</a>
<a
:href="toggleWhitespacePath"
class="btn btn-default"
class="btn btn-default qa-toggle-whitespace"
>
{{ toggleWhitespaceText }}
</a>
......
......@@ -25,7 +25,7 @@ export default {
...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline', 'stages', 'isLoadingJobs']),
ciLintText() {
return sprintf(
__('You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}'),
__('You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}.'),
{
linkStart: `<a href="${_.escape(this.currentProject.web_url)}/-/ci/lint">`,
linkEnd: '</a>',
......
......@@ -145,7 +145,7 @@ class Milestone < ActiveRecord::Base
end
def participants
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).uniq
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).distinct
end
def self.sort_by_attribute(method)
......
......@@ -1138,7 +1138,7 @@ class User < ActiveRecord::Base
events = Event.select(:project_id)
.contributions.where(author_id: self)
.where("created_at > ?", Time.now - 1.year)
.uniq
.distinct
.reorder(nil)
Project.where(id: events)
......
......@@ -24,8 +24,8 @@ class DeleteMergedBranchesService < BaseService
# rubocop: disable CodeReuse/ActiveRecord
def merge_request_branch_names
# reorder(nil) is necessary for SELECT DISTINCT because default scope adds an ORDER BY
source_names = project.origin_merge_requests.opened.reorder(nil).uniq.pluck(:source_branch)
target_names = project.merge_requests.opened.reorder(nil).uniq.pluck(:target_branch)
source_names = project.origin_merge_requests.opened.reorder(nil).distinct.pluck(:source_branch)
target_names = project.merge_requests.opened.reorder(nil).distinct.pluck(:target_branch)
(source_names + target_names).uniq
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -40,7 +40,7 @@ module Labels
group_labels_applied_to_merge_requests
])
.reorder(nil)
.uniq
.distinct
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -19,30 +19,23 @@
#js-pipeline-graph-vue
#js-tab-builds.tab-pane
- if pipeline.yaml_errors.present?
.bs-callout.bs-callout-danger
%h4 Found errors in your .gitlab-ci.yml:
%ul
- pipeline.yaml_errors.split(",").each do |error|
%li= error
You can also test your .gitlab-ci.yml in the #{link_to "Lint", project_ci_lint_path(@project)}
- if pipeline.legacy_stages.present?
.table-holder.pipeline-holder
%table.table.ci-table.pipeline
%thead
%tr
%th Status
%th Job ID
%th Name
%th
%th Coverage
%th
= render partial: "projects/stage/stage", collection: pipeline.legacy_stages, as: :stage
- if pipeline.project.builds_enabled? && !pipeline.ci_yaml_file
- elsif pipeline.project.builds_enabled? && !pipeline.ci_yaml_file
.bs-callout.bs-callout-warning
\.gitlab-ci.yml not found in this commit
.table-holder.pipeline-holder
%table.table.ci-table.pipeline
%thead
%tr
%th Status
%th Job ID
%th Name
%th
%th Coverage
%th
= render partial: "projects/stage/stage", collection: pipeline.legacy_stages, as: :stage
- if @pipeline.failed_builds.present?
#js-tab-failures.build-failures.tab-pane.build-page
%table.table.responsive-table.ci-table.responsive-table-sm-rounded
......
......@@ -9,6 +9,14 @@
- if @pipeline.commit.present?
= render "projects/pipelines/info", commit: @pipeline.commit
= render "projects/pipelines/with_tabs", pipeline: @pipeline
- if @pipeline.builds.empty? && @pipeline.yaml_errors.present?
.bs-callout.bs-callout-danger
%h4 Found errors in your .gitlab-ci.yml:
%ul
- @pipeline.yaml_errors.split(",").each do |error|
%li= error
You can test your .gitlab-ci.yml in #{link_to "CI Lint", project_ci_lint_path(@project)}.
- else
= render "projects/pipelines/with_tabs", pipeline: @pipeline
.js-pipeline-details-vue{ data: { endpoint: project_pipeline_path(@project, @pipeline, format: :json) } }
......@@ -24,7 +24,7 @@
.block.milestone
.sidebar-collapsed-icon.has-tooltip{ title: milestone_tooltip_title(issuable.milestone), data: { container: 'body', html: 'true', placement: 'left', boundary: 'viewport' } }
= icon('clock-o', 'aria-hidden': 'true')
%span.milestone-title
%span.milestone-title.collapse-truncated-title
- if issuable.milestone
= issuable.milestone.title
- else
......
---
title: Hide all tables on Pipeline when no Jobs for the Pipeline
merge_request: 18540
author: Takuya Noguchi
type: fixed
---
title: Fix broken "Show whitespace changes" button on MRs.
merge_request: 22539
author:
type: fixed
---
title: Update moment to 2.22.2
merge_request: 22648
author: Takuya Noguchi
type: security
---
title: Truncate milestone title on collapsed sidebar
merge_request: 22624
author: George Tsiolis
type: changed
---
title: Replace deprecated uniq on a Relation with distinct
merge_request: 22625
author: Jasper Maes
type: other
......@@ -210,7 +210,7 @@ container_scanning:
refs:
- branches
variables:
- $GITLAB_FEATURES =~ /\bsast_container\b/
- $GITLAB_FEATURES =~ /\bcontainer_scanning\b/
except:
variables:
- $CONTAINER_SCANNING_DISABLED
......
......@@ -73,7 +73,7 @@ module Gitlab
# re-running the contributed projects query in each union is expensive, so
# use IN(project_ids...) instead. It's the intersection of two users so
# the list will be (relatively) short
@contributed_project_ids ||= projects.uniq.pluck(:id)
@contributed_project_ids ||= projects.distinct.pluck(:id)
authed_projects = Project.where(id: @contributed_project_ids)
.with_feature_available_for_user(feature, current_user)
.reorder(nil)
......
......@@ -7014,9 +7014,6 @@ msgstr ""
msgid "You can also star a label to make it a priority label."
msgstr ""
msgid "You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}"
msgstr ""
msgid "You can easily contribute to them by requesting to join these groups."
msgstr ""
......@@ -7038,6 +7035,9 @@ msgstr ""
msgid "You can set up jobs to only use Runners with specific tags. Separate tags with commas."
msgstr ""
msgid "You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}."
msgstr ""
msgid "You cannot write to this read-only GitLab instance."
msgstr ""
......
......@@ -45,7 +45,7 @@ module QA
repository.use_ssh_key(ssh_key)
else
repository.uri = repository_http_uri
repository.use_default_credentials
repository.use_default_credentials unless user
end
username = 'GitLab QA'
......
# frozen_string_literal: true
module QA
context 'Create' do
describe 'Git push over HTTP', :ldap_no_tls do
it 'user using a personal access token pushes code to the repository' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
access_token = Factory::Resource::PersonalAccessToken.fabricate!.access_token
user = Factory::Resource::User.new.tap do |user|
user.username = Runtime::User.username
user.password = access_token
end
push = Factory::Repository::ProjectPush.fabricate! do |push|
push.user = user
push.file_name = 'README.md'
push.file_content = '# This is a test project'
push.commit_message = 'Add README.md'
end
push.project.visit!
Page::Project::Show.perform(&:wait_for_push)
expect(page).to have_content('README.md')
expect(page).to have_content('This is a test project')
end
end
end
end
......@@ -114,33 +114,6 @@ describe 'Commits' do
expect(page).to have_content 'canceled'
end
end
describe '.gitlab-ci.yml not found warning' do
context 'ci builds enabled' do
it "does not show warning" do
visit pipeline_path(pipeline)
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
it 'shows warning' do
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
expect(page).to have_content '.gitlab-ci.yml not found in this commit'
end
end
context 'ci builds disabled' do
before do
stub_ci_builds_disabled
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
end
it 'does not show warning' do
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
end
end
end
context "when logged as reporter" do
......@@ -182,6 +155,39 @@ describe 'Commits' do
end
end
end
describe '.gitlab-ci.yml not found warning' do
before do
project.add_reporter(user)
end
context 'ci builds enabled' do
it 'does not show warning' do
visit pipeline_path(pipeline)
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
it 'shows warning' do
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
expect(page).to have_content '.gitlab-ci.yml not found in this commit'
end
end
context 'ci builds disabled' do
it 'does not show warning' do
stub_ci_builds_disabled
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
end
end
end
context 'viewing commits for a branch' do
......
// TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
import Vue from 'vue';
import CompareVersionsComponent from '~/diffs/components/compare_versions.vue';
import store from '~/mr_notes/stores';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import diffsMockData from '../mock_data/merge_request_diffs';
describe('CompareVersions', () => {
let vm;
const targetBranch = { branchName: 'tmp-wine-dev', versionIndex: -1 };
beforeEach(() => {
vm = createComponentWithStore(Vue.extend(CompareVersionsComponent), store, {
mergeRequestDiffs: diffsMockData,
mergeRequestDiff: diffsMockData[0],
targetBranch,
}).$mount();
});
describe('template', () => {
it('should render Tree List toggle button with correct attribute values', () => {
const treeListBtn = vm.$el.querySelector('.js-toggle-tree-list');
expect(treeListBtn).not.toBeNull();
expect(treeListBtn.dataset.originalTitle).toBe('Toggle file browser');
expect(treeListBtn.querySelectorAll('svg use').length).not.toBe(0);
expect(treeListBtn.querySelector('svg use').getAttribute('xlink:href')).toContain(
'#hamburger',
);
});
it('should render comparison dropdowns with correct values', () => {
const sourceDropdown = vm.$el.querySelector('.mr-version-dropdown');
const targetDropdown = vm.$el.querySelector('.mr-version-compare-dropdown');
expect(sourceDropdown).not.toBeNull();
expect(targetDropdown).not.toBeNull();
expect(sourceDropdown.querySelector('a span').innerHTML).toContain('latest version');
expect(targetDropdown.querySelector('a span').innerHTML).toContain(targetBranch.branchName);
});
it('should not render comparison dropdowns if no mergeRequestDiffs are specified', () => {
vm.mergeRequestDiffs = [];
vm.$nextTick(() => {
const sourceDropdown = vm.$el.querySelector('.mr-version-dropdown');
const targetDropdown = vm.$el.querySelector('.mr-version-compare-dropdown');
expect(sourceDropdown).toBeNull();
expect(targetDropdown).toBeNull();
});
});
it('should render whitespace toggle button with correct attributes', () => {
const whitespaceBtn = vm.$el.querySelector('.qa-toggle-whitespace');
const href = vm.toggleWhitespacePath;
expect(whitespaceBtn).not.toBeNull();
expect(whitespaceBtn.getAttribute('href')).toEqual(href);
expect(whitespaceBtn.innerHTML).toContain('Hide whitespace changes');
});
it('should render view types buttons with correct values', () => {
const inlineBtn = vm.$el.querySelector('#inline-diff-btn');
const parallelBtn = vm.$el.querySelector('#parallel-diff-btn');
expect(inlineBtn).not.toBeNull();
expect(parallelBtn).not.toBeNull();
expect(inlineBtn.dataset.viewType).toEqual('inline');
expect(parallelBtn.dataset.viewType).toEqual('parallel');
expect(inlineBtn.innerHTML).toContain('Inline');
expect(parallelBtn.innerHTML).toContain('Side-by-side');
});
});
describe('setInlineDiffViewType', () => {
it('should persist the view type in the url', () => {
const viewTypeBtn = vm.$el.querySelector('#inline-diff-btn');
viewTypeBtn.click();
expect(window.location.toString()).toContain('?view=inline');
});
});
describe('setParallelDiffViewType', () => {
it('should persist the view type in the url', () => {
const viewTypeBtn = vm.$el.querySelector('#parallel-diff-btn');
viewTypeBtn.click();
expect(window.location.toString()).toContain('?view=parallel');
});
});
describe('comparableDiffs', () => {
it('should not contain the first item in the mergeRequestDiffs property', () => {
const { comparableDiffs } = vm;
const comparableDiffsMock = diffsMockData.slice(1);
expect(comparableDiffs).toEqual(comparableDiffsMock);
});
});
describe('isWhitespaceVisible', () => {
const originalHref = window.location.href;
afterEach(() => {
window.history.replaceState({}, null, originalHref);
});
it('should return "true" when no "w" flag is present in the URL (default)', () => {
expect(vm.isWhitespaceVisible()).toBe(true);
});
it('should return "false" when the flag is set to "1" in the URL', () => {
window.history.replaceState({}, null, '?w=1');
expect(vm.isWhitespaceVisible()).toBe(false);
});
it('should return "true" when the flag is set to "0" in the URL', () => {
window.history.replaceState({}, null, '?w=0');
expect(vm.isWhitespaceVisible()).toBe(true);
});
});
});
export default [
{
versionIndex: 4,
createdAt: '2018-10-23T11:49:16.611Z',
commitsCount: 4,
latest: true,
shortCommitSha: 'de7a8f7f',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=37',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=de7a8f7f20c3ea2e0bef3ba01cfd41c21f6b4995',
},
{
versionIndex: 3,
createdAt: '2018-10-23T11:46:40.617Z',
commitsCount: 3,
latest: false,
shortCommitSha: 'e78fc18f',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=36',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=e78fc18fa37acb2185c59ca94d4a964464feb50e',
},
{
versionIndex: 2,
createdAt: '2018-10-04T09:57:39.648Z',
commitsCount: 2,
latest: false,
shortCommitSha: '48da7e7e',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=35',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=48da7e7e9a99d41c852578bd9cb541ca4d864b3e',
},
{
versionIndex: 1,
createdAt: '2018-09-25T20:30:39.493Z',
commitsCount: 1,
latest: false,
shortCommitSha: '47bac2ed',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=20',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=47bac2ed972c5bee344c1cea159a22cd7f711dc0',
},
];
// import $ from 'jquery';
// import MockAdapter from 'axios-mock-adapter';
// import axios from '~/lib/utils/axios_utils';
// import { numberToHumanSize } from '~/lib/utils/number_utils';
// import '~/lib/utils/datetime_utility';
// import Job from '~/job';
// import '~/breakpoints';
// import waitForPromises from 'spec/helpers/wait_for_promises';
// describe('Job', () => {
// const JOB_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1`;
// let mock;
// let response;
// let job;
// preloadFixtures('builds/build-with-artifacts.html.raw');
// beforeEach(() => {
// loadFixtures('builds/build-with-artifacts.html.raw');
// spyOnDependency(Job, 'visitUrl');
// response = {};
// mock = new MockAdapter(axios);
// mock.onGet(new RegExp(`${JOB_URL}/trace.json?(.*)`)).reply(() => [200, response]);
// });
// afterEach(() => {
// mock.restore();
// clearTimeout(job.timeout);
// });
// describe('class constructor', () => {
// beforeEach(() => {
// jasmine.clock().install();
// });
// afterEach(() => {
// jasmine.clock().uninstall();
// });
// describe('running build', () => {
// it('updates the build trace on an interval', function (done) {
// response = {
// html: '<span>Update<span>',
// status: 'running',
// state: 'newstate',
// append: true,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/Update/);
// expect(job.state).toBe('newstate');
// response = {
// html: '<span>More</span>',
// status: 'running',
// state: 'finalstate',
// append: true,
// complete: true,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/UpdateMore/);
// expect(job.state).toBe('finalstate');
// })
// .then(done)
// .catch(done.fail);
// });
// it('replaces the entire build trace', (done) => {
// response = {
// html: '<span>Update<span>',
// status: 'running',
// append: false,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/Update/);
// response = {
// html: '<span>Different</span>',
// status: 'running',
// append: false,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect($('#build-trace .js-build-output').text()).not.toMatch(/Update/);
// expect($('#build-trace .js-build-output').text()).toMatch(/Different/);
// })
// .then(done)
// .catch(done.fail);
// });
// });
// describe('truncated information', () => {
// describe('when size is less than total', () => {
// it('shows information about truncated log', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(document.querySelector('.js-truncated-info').classList).not.toContain('hidden');
// })
// .then(done)
// .catch(done.fail);
// });
// it('shows the size in KiB', (done) => {
// const size = 50;
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(size)}`);
// })
// .then(done)
// .catch(done.fail);
// });
// it('shows incremented size', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(50)}`);
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: true,
// size: 10,
// total: 100,
// complete: true,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(60)}`);
// })
// .then(done)
// .catch(done.fail);
// });
// it('renders the raw link', () => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// expect(
// document.querySelector('.js-raw-link').textContent.trim(),
// ).toContain('Complete Raw');
// });
// });
// describe('when size is equal than total', () => {
// it('does not show the trunctated information', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 100,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(document.querySelector('.js-truncated-info').classList).toContain('hidden');
// })
// .then(done)
// .catch(done.fail);
// });
// });
// });
// describe('output trace', () => {
// beforeEach((done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(done)
// .catch(done.fail);
// });
// it('should render trace controls', () => {
// const controllers = document.querySelector('.controllers');
// expect(controllers.querySelector('.js-raw-link-controller')).not.toBeNull();
// expect(controllers.querySelector('.js-scroll-up')).not.toBeNull();
// expect(controllers.querySelector('.js-scroll-down')).not.toBeNull();
// });
// it('should render received output', () => {
// expect(
// document.querySelector('.js-build-output').innerHTML,
// ).toEqual('<span>Update</span>');
// });
// });
// });
// });
......@@ -5502,12 +5502,7 @@ mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
dependencies:
minimist "0.0.8"
moment@2.x:
version "2.19.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.2.tgz#8a7f774c95a64550b4c7ebd496683908f9419dbe"
integrity sha512-Rf6jiHPEfxp9+dlzxPTmRHbvoFXsh2L/U8hOupUMpnuecHQmI6cF6lUbJl3QqKPko1u6ujO+FxtcajLVfLpAtA==
moment@^2.21.0:
moment@2.x, moment@^2.21.0:
version "2.22.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment