Commit 2b259c3e authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 334f887e 7fd347f3
......@@ -9,7 +9,13 @@ export default () => {
return null;
}
const { activityEmptyStateImage, agentName, emptyStateSvgPath, projectPath } = el.dataset;
const {
activityEmptyStateImage,
agentName,
canAdminVulnerability,
emptyStateSvgPath,
projectPath,
} = el.dataset;
return new Vue({
el,
......@@ -17,6 +23,7 @@ export default () => {
provide: {
activityEmptyStateImage,
agentName,
canAdminVulnerability,
emptyStateSvgPath,
projectPath,
},
......
......@@ -18,8 +18,6 @@ export function expandSection(sectionArg) {
const $section = $(sectionArg);
$section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Collapse'));
// eslint-disable-next-line @gitlab/no-global-event-off
$section.find('.settings-content').off('scroll.expandSection').scrollTop(0);
$section.addClass('expanded');
if (!$section.hasClass('no-animate')) {
$section
......@@ -32,7 +30,6 @@ export function closeSection(sectionArg) {
const $section = $(sectionArg);
$section.find('.js-settings-toggle:not(.js-settings-toggle-trigger-only)').text(__('Expand'));
$section.find('.settings-content').on('scroll.expandSection', () => expandSection($section));
$section.removeClass('expanded');
if (!$section.hasClass('no-animate')) {
$section
......@@ -55,18 +52,16 @@ export default function initSettingsPanels() {
const $section = $(elm);
$section.on('click.toggleSection', '.js-settings-toggle', () => toggleSection($section));
if (!isExpanded($section)) {
$section.find('.settings-content').on('scroll.expandSection', () => {
$section.removeClass('no-animate');
if (window.location.hash) {
const $target = $(window.location.hash);
if (
$target.length &&
!isExpanded($section) &&
($section.is($target) || $section.find($target).length)
) {
$section.addClass('no-animate');
expandSection($section);
});
}
}
});
if (window.location.hash) {
const $target = $(window.location.hash);
if ($target.length && $target.hasClass('settings')) {
expandSection($target);
}
}
}
......@@ -5,6 +5,7 @@ module Projects::ClusterAgentsHelper
{
activity_empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'),
agent_name: agent_name,
can_admin_vulnerability: can?(current_user, :admin_vulnerability, project).to_s,
empty_state_svg_path: image_path('illustrations/operations-dashboard_empty.svg'),
project_path: project.full_path
}
......
<script>
import { PortalTarget } from 'portal-vue';
import { helpPagePath } from '~/helpers/help_page_helper';
import VulnerabilityListGraphql from '../shared/vulnerability_report/vulnerability_list_graphql.vue';
import VulnerabilityFilters from '../shared/vulnerability_report/vulnerability_filters.vue';
......@@ -15,6 +16,7 @@ const PORTAL_NAME = 'vulnerability-report-sticky';
export default {
components: {
PortalTarget,
VulnerabilityFilters,
VulnerabilityListGraphql,
},
......@@ -29,7 +31,6 @@ export default {
return {
dashboardDocumentation: helpPagePath('user/application_security/security_dashboard/index'),
dashboardType: DASHBOARD_TYPES.PROJECT,
canAdminVulnerability: true,
fullPath: this.projectPath,
canViewFalsePositive: false,
hasJiraVulnerabilitiesIntegrationEnabled: false,
......
......@@ -3,6 +3,8 @@
module QA
RSpec.describe 'Package', :orchestrated, :registry, only: { pipeline: :main } do
describe 'Dependency Proxy' do
using RSpec::Parameterized::TableSyntax
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'dependency-proxy-project'
......@@ -40,12 +42,13 @@ module QA
runner.remove_via_api!
end
where(:docker_client_version) do
%w[docker:19.03.12 docker:20.10]
where(:case_name, :docker_client_version, :testcase) do
'using docker:19.03.12' | 'docker:19.03.12' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347605'
'using docker:20.10' | 'docker:20.10' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347604'
end
with_them do
it "pulls an image using the dependency proxy" do
it "pulls an image using the dependency proxy", testcase: params[:testcase] do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
......@@ -58,7 +61,7 @@ module QA
image: "#{docker_client_version}"
services:
- name: "#{docker_client_version}-dind"
command: ["--insecure-registry=gitlab.test:80"]
command: ["--insecure-registry=gitlab.test:80"]
before_script:
- apk add curl jq grep
- echo $CI_DEPENDENCY_PROXY_SERVER
......
......@@ -3,6 +3,7 @@
module QA
RSpec.describe 'Package', :orchestrated, :packages, :object_storage do
describe 'Helm Registry' do
using RSpec::Parameterized::TableSyntax
include Runtime::Fixtures
include_context 'packages registry qa scenario'
......@@ -10,101 +11,105 @@ module QA
let(:package_version) { '1.3.7' }
let(:package_type) { 'helm' }
%i[personal_access_token ci_job_token project_deploy_token].each do |authentication_token_type|
context "using a #{authentication_token_type}" do
let(:username) do
case authentication_token_type
when :personal_access_token
Runtime::User.username
when :ci_job_token
'gitlab-ci-token'
when :project_deploy_token
project_deploy_token.username
end
where(:case_name, :authentication_token_type, :testcase) do
'using personal access token' | :personal_access_token | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347586'
'using ci job token' | :ci_job_token | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347587'
'using project deploy token' | :project_deploy_token | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347588'
end
with_them do
let(:username) do
case authentication_token_type
when :personal_access_token
Runtime::User.username
when :ci_job_token
'gitlab-ci-token'
when :project_deploy_token
project_deploy_token.username
end
end
let(:access_token) do
case authentication_token_type
when :personal_access_token
personal_access_token
when :ci_job_token
'${CI_JOB_TOKEN}'
when :project_deploy_token
project_deploy_token.token
end
let(:access_token) do
case authentication_token_type
when :personal_access_token
personal_access_token
when :ci_job_token
'${CI_JOB_TOKEN}'
when :project_deploy_token
project_deploy_token.token
end
end
it "pushes and pulls a helm chart" do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
helm_upload_yaml = ERB.new(read_fixture('package_managers/helm', 'helm_upload_package.yaml.erb')).result(binding)
helm_chart_yaml = ERB.new(read_fixture('package_managers/helm', 'Chart.yaml.erb')).result(binding)
commit.project = package_project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([
{
file_path: '.gitlab-ci.yml',
content: helm_upload_yaml
},
{
file_path: 'Chart.yaml',
content: helm_chart_yaml
}
])
end
it "pushes and pulls a helm chart", testcase: params[:testcase] do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
helm_upload_yaml = ERB.new(read_fixture('package_managers/helm', 'helm_upload_package.yaml.erb')).result(binding)
helm_chart_yaml = ERB.new(read_fixture('package_managers/helm', 'Chart.yaml.erb')).result(binding)
commit.project = package_project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([
{
file_path: '.gitlab-ci.yml',
content: helm_upload_yaml
},
{
file_path: 'Chart.yaml',
content: helm_chart_yaml
}
])
end
end
package_project.visit!
package_project.visit!
Flow::Pipeline.visit_latest_pipeline
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('deploy')
end
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('deploy')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Page::Project::Menu.perform(&:click_packages_link)
Page::Project::Menu.perform(&:click_packages_link)
Page::Project::Packages::Index.perform do |index|
expect(index).to have_package(package_name)
Page::Project::Packages::Index.perform do |index|
expect(index).to have_package(package_name)
index.click_package(package_name)
end
index.click_package(package_name)
end
Page::Project::Packages::Show.perform do |show|
expect(show).to have_package_info(package_name, package_version)
end
Page::Project::Packages::Show.perform do |show|
expect(show).to have_package_info(package_name, package_version)
end
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
helm_install_yaml = ERB.new(read_fixture('package_managers/helm', 'helm_install_package.yaml.erb')).result(binding)
commit.project = client_project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([
{
file_path: '.gitlab-ci.yml',
content: helm_install_yaml
}
])
end
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
helm_install_yaml = ERB.new(read_fixture('package_managers/helm', 'helm_install_package.yaml.erb')).result(binding)
commit.project = client_project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([
{
file_path: '.gitlab-ci.yml',
content: helm_install_yaml
}
])
end
end
client_project.visit!
client_project.visit!
Flow::Pipeline.visit_latest_pipeline
Flow::Pipeline.visit_latest_pipeline
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('pull')
end
Page::Project::Pipeline::Show.perform do |pipeline|
pipeline.click_job('pull')
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
Page::Project::Job::Show.perform do |job|
expect(job).to be_successful(timeout: 800)
end
end
end
......
......@@ -68,10 +68,10 @@ module QA
another_project.remove_via_api!
end
where(:authentication_token_type, :token_name) do
:personal_access_token | 'Personal Access Token'
:ci_job_token | 'CI Job Token'
:project_deploy_token | 'Deploy Token'
where(:case_name, :authentication_token_type, :token_name, :testcase) do
'using personal access token' | :personal_access_token | 'Personal Access Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347600'
'using ci job token' | :ci_job_token | 'CI Job Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347599'
'using project deploy token' | :project_deploy_token | 'Deploy Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347598'
end
with_them do
......@@ -86,7 +86,7 @@ module QA
end
end
it "push and pull a npm package via CI using a #{params[:token_name]}" do
it 'push and pull a npm package via CI', testcase: params[:testcase] do
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
npm_upload_yaml = ERB.new(read_fixture('package_managers/npm', 'npm_upload_package_instance.yaml.erb')).result(binding)
package_json = ERB.new(read_fixture('package_managers/npm', 'package_instance.json.erb')).result(binding)
......
......@@ -59,10 +59,10 @@ module QA
project.remove_via_api!
end
where(:authentication_token_type, :token_name) do
:personal_access_token | 'Personal Access Token'
:ci_job_token | 'CI Job Token'
:project_deploy_token | 'Deploy Token'
where(:case_name, :authentication_token_type, :token_name, :testcase) do
'using personal access token' | :personal_access_token | 'Personal Access Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347592'
'using ci job token' | :ci_job_token | 'CI Job Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347594'
'using project deploy token' | :project_deploy_token | 'Deploy Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347593'
end
with_them do
......@@ -77,7 +77,7 @@ module QA
end
end
it "push and pull a npm package via CI using a #{params[:token_name]}" do
it 'push and pull a npm package via CI', testcase: params[:testcase] do
Resource::Repository::Commit.fabricate_via_api! do |commit|
npm_upload_install_yaml = ERB.new(read_fixture('package_managers/npm', 'npm_upload_install_package_project.yaml.erb')).result(binding)
package_json = ERB.new(read_fixture('package_managers/npm', 'package_project.json.erb')).result(binding)
......
......@@ -63,10 +63,10 @@ module QA
package.remove_via_api!
end
where(:authentication_token_type, :token_name) do
:personal_access_token | 'Personal Access Token'
:ci_job_token | 'CI Job Token'
:group_deploy_token | 'Deploy Token'
where(:case_name, :authentication_token_type, :token_name, :testcase) do
'using personal access token' | :personal_access_token | 'Personal Access Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347597'
'using ci job token' | :ci_job_token | 'CI Job Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347595'
'using group deploy token' | :group_deploy_token | 'Deploy Token' | 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347596'
end
with_them do
......@@ -92,7 +92,7 @@ module QA
end
end
it "publishes a nuget package at the project level, installs and deletes it at the group level using a #{params[:token_name]}" do
it 'publishes a nuget package at the project level, installs and deletes it at the group level', testcase: params[:testcase] do
Flow::Login.sign_in
Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do
......
......@@ -24,6 +24,20 @@ describe('Settings Panels', () => {
expect(isExpanded(panel)).toBe(true);
});
it('should expand panel containing linked hash', () => {
window.location.hash = '#group_description';
const panel = document.querySelector('#js-general-settings');
// Our test environment automatically expands everything so we need to clear that out first
panel.classList.remove('expanded');
expect(isExpanded(panel)).toBe(false);
initSettingsPanels();
expect(isExpanded(panel)).toBe(true);
});
});
it('does not change the text content of triggers', () => {
......
......@@ -5,22 +5,29 @@ require 'spec_helper'
RSpec.describe Projects::ClusterAgentsHelper do
describe '#js_cluster_agent_details_data' do
let_it_be(:project) { create(:project) }
let_it_be(:current_user) { create(:user) }
let(:user_can_admin_vulerability) { true }
let(:agent_name) { 'agent-name' }
subject { helper.js_cluster_agent_details_data(agent_name, project) }
it 'returns name' do
expect(subject[:agent_name]).to eq(agent_name)
before do
allow(helper).to receive(:current_user).and_return(current_user)
allow(helper)
.to receive(:can?)
.with(current_user, :admin_vulnerability, project)
.and_return(user_can_admin_vulerability)
end
it 'returns project path' do
expect(subject[:project_path]).to eq(project.full_path)
end
subject { helper.js_cluster_agent_details_data(agent_name, project) }
it 'returns string contants' do
expect(subject[:activity_empty_state_image]).to be_kind_of(String)
expect(subject[:empty_state_svg_path]).to be_kind_of(String)
end
it {
is_expected.to match({
agent_name: agent_name,
project_path: project.full_path,
activity_empty_state_image: kind_of(String),
empty_state_svg_path: kind_of(String),
can_admin_vulnerability: "true"
})
}
end
end
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