Commit 9fbb5794 authored by allison.browne's avatar allison.browne

Merge branch 'master' into 33672-add-enable-checkbox-for-grafana-authentication-settings

parents 541441e2 8fdde1ba
......@@ -2,7 +2,7 @@
extends:
- .default-tags
- .default-retry
- .only-docs-changes
- .only:changes-docs
only:
refs:
- merge_requests
......@@ -50,7 +50,7 @@ docs lint:
- .default-tags
- .default-retry
- .default-only
- .only-docs-changes
- .only:changes-docs
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-docs-lint"
stage: test
dependencies: []
......@@ -76,7 +76,7 @@ graphql-docs-verify:
- .default-cache
- .default-only
- .default-before_script
- .only-graphql-changes
- .only:changes-graphql
variables:
SETUP_DB: "false"
stage: test
......
......@@ -12,7 +12,7 @@
- .default-only
- .default-before_script
- .assets-compile-cache
- .only-code-qa-changes
- .only:changes-code-backstage-qa
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.3-git-2.22-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.33-docker-18.06.1
stage: test
dependencies: ["setup-test-env"]
......@@ -73,7 +73,7 @@ gitlab:assets:compile pull-cache:
- .default-only
- .default-before_script
- .assets-compile-cache
- .only-code-qa-changes
- .only:changes-code-backstage-qa
- .use-pg9
stage: prepare
script:
......@@ -128,7 +128,7 @@ compile-assets pull-cache foss:
- .default-cache
- .default-only
- .default-before_script
- .only-code-changes
- .only:changes-code-backstage
- .use-pg9
stage: test
needs: ["setup-test-env", "compile-assets pull-cache"]
......@@ -205,7 +205,7 @@ jest-foss:
- .default-retry
- .default-cache
- .default-only
- .only-code-changes
- .only:changes-code-backstage
stage: test
dependencies: []
cache:
......@@ -238,7 +238,7 @@ webpack-dev-server:
- .default-retry
- .default-cache
- .default-only
- .only-code-changes
- .only:changes-code-backstage
stage: test
needs: ["setup-test-env", "compile-assets pull-cache"]
dependencies: ["setup-test-env", "compile-assets pull-cache"]
......
......@@ -40,14 +40,11 @@
- merge_requests
- tags
.only-code-changes:
only:
changes:
.code-patterns: &code-patterns
- ".gitlab/ci/**/*"
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
- ".csscomb.json"
- "Dangerfile"
- "Dockerfile.assets"
- "*_VERSION"
- "Gemfile{,.lock}"
......@@ -55,36 +52,75 @@
- "{babel.config,jest.config}.js"
- "config.ru"
- "{package.json,yarn.lock}"
- "{app,bin,config,danger,db,ee,fixtures,haml_lint,lib,locale,public,rubocop,scripts,spec,symbol,vendor}/**/*"
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
.backstage-patterns: &backstage-patterns
- "Dangerfile"
- "danger/**/*"
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file
.only-qa-changes:
only:
changes:
.qa-patterns: &qa-patterns
- ".dockerignore"
- "qa/**/*"
.only-docs-changes:
only:
changes:
.docs-patterns: &docs-patterns
- ".gitlab/route-map.yml"
- "doc/**/*"
- ".markdownlint.json"
.only-graphql-changes:
only:
changes:
.graphql-patterns: &graphql-patterns
- "{,ee/}app/graphql/**/*"
- "{,ee/}lib/gitlab/graphql/**/*"
.only-code-qa-changes:
.only:changes-code:
only:
changes: *code-patterns
.only:changes-qa:
only:
changes: *qa-patterns
.only:changes-docs:
only:
changes: *docs-patterns
.only:changes-graphql:
only:
changes: *graphql-patterns
.only:changes-code-backstage:
only:
changes:
- ".gitlab/ci/**/*"
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
- ".csscomb.json"
- "Dockerfile.assets"
- "*_VERSION"
- "Gemfile{,.lock}"
- "Rakefile"
- "{babel.config,jest.config}.js"
- "config.ru"
- "{package.json,yarn.lock}"
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file
.only:changes-code-qa:
only:
changes:
- ".gitlab/ci/**/*"
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
- ".csscomb.json"
- "Dockerfile.assets"
- "*_VERSION"
- "Gemfile{,.lock}"
......@@ -92,8 +128,34 @@
- "{babel.config,jest.config}.js"
- "config.ru"
- "{package.json,yarn.lock}"
- "{app,bin,config,danger,db,ee,fixtures,haml_lint,lib,locale,public,rubocop,scripts,spec,symbol,vendor}/**/*"
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
# QA changes
- ".dockerignore"
- "qa/**/*"
.only:changes-code-backstage-qa:
only:
changes:
- ".gitlab/ci/**/*"
- ".{eslintignore,gitattributes,nvmrc,prettierrc,stylelintrc,yamllint}"
- ".{codeclimate,eslintrc,gitlab-ci,haml-lint,haml-lint_todo,rubocop,rubocop_todo,scss-lint}.yml"
- ".csscomb.json"
- "Dockerfile.assets"
- "*_VERSION"
- "Gemfile{,.lock}"
- "Rakefile"
- "{babel.config,jest.config}.js"
- "config.ru"
- "{package.json,yarn.lock}"
- "{,ee/}{app,bin,config,db,haml_lint,lib,locale,public,scripts,symbol,vendor}/**/*"
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "{,ee/}fixtures/**/*"
- "{,ee/}rubocop/**/*"
- "{,ee/}spec/**/*"
- "doc/README.md" # Some RSpec test rely on this file
# QA changes
- ".dockerignore"
- "qa/**/*"
......
......@@ -5,7 +5,7 @@
- .default-cache
- .default-only
- .default-before_script
- .only-code-changes
- .only:changes-code
memory-static:
extends: .only-code-memory-job-base
......
......@@ -4,7 +4,7 @@ pages:
- .default-retry
- .default-cache
- .default-only
- .only-code-qa-changes
- .only:changes-code-backstage-qa
only:
refs:
- master
......
......@@ -3,7 +3,7 @@
- .default-tags
- .default-retry
- .default-only
- .only-code-qa-changes
- .only:changes-code-qa
stage: test
dependencies: []
cache:
......@@ -47,7 +47,7 @@ qa:selectors-foss:
package-and-qa-manual:
extends:
- .package-and-qa-base
- .only-code-changes
- .only:changes-code
except:
refs:
- master
......@@ -58,7 +58,7 @@ package-and-qa-manual:
package-and-qa:
extends:
- .package-and-qa-base
- .only-qa-changes
- .only:changes-qa
except:
refs:
- master
......@@ -69,6 +69,6 @@ package-and-qa:
schedule:package-and-qa:
extends:
- .package-and-qa-base
- .only-code-qa-changes
- .only:changes-code-qa
- .only-canonical-schedules
needs: ["build-qa-image", "gitlab:assets:compile pull-cache"]
......@@ -22,7 +22,7 @@
- .default-cache
- .default-only
- .default-before_script
- .only-code-changes
- .only:changes-code-backstage
.only-code-qa-rails-job-base:
extends:
......@@ -31,7 +31,7 @@
- .default-cache
- .default-only
- .default-before_script
- .only-code-qa-changes
- .only:changes-code-backstage-qa
setup-test-env:
extends:
......@@ -251,7 +251,7 @@ static-analysis:
downtime_check:
extends:
- .rake-exec
- .only-code-changes
- .only:changes-code-backstage
except:
refs:
- master
......
......@@ -11,7 +11,7 @@ code_quality:
extends:
- .default-retry
- .default-only
- .only-code-changes
- .only:changes-code-backstage
stage: test
image: docker:stable
allow_failure: true
......@@ -50,7 +50,7 @@ sast:
extends:
- .default-retry
- .default-only
- .only-code-changes
- .only:changes-code-backstage-qa
stage: test
image: docker:stable
variables:
......@@ -132,7 +132,7 @@ dependency_scanning:
extends:
- .default-retry
- .default-only
- .only-code-changes
- .only:changes-code-backstage-qa
stage: test
image: docker:stable
variables:
......@@ -195,7 +195,7 @@ dast:
extends:
- .default-retry
- .default-only
- .only-code-qa-changes
- .only:changes-code-qa
- .only-review
stage: qa
needs: ["review-deploy"]
......
......@@ -23,7 +23,7 @@
build-qa-image:
extends:
- .review-docker
- .only-code-qa-changes
- .only:changes-code-qa
only:
variables:
- $CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE == "gitlab-org"
......@@ -40,7 +40,7 @@ build-qa-image:
- .default-tags
- .default-retry
- .default-only
- .only-code-qa-changes
- .only:changes-code-qa
stage: prepare
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base
allow_failure: true
......@@ -66,7 +66,7 @@ manual:review-cleanup:
.review-build-cng-base:
extends:
- .default-only
- .only-code-qa-changes
- .only:changes-code-qa
- .except-deploys
image: ruby:2.6-alpine
stage: review-prepare
......@@ -95,7 +95,7 @@ schedule:review-build-cng:
- .default-tags
- .default-retry
- .default-only
- .only-code-qa-changes
- .only:changes-code-qa
- .except-deploys
stage: review
image: registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-charts-build-base
......@@ -189,7 +189,7 @@ review-cleanup-failed-deployment:
extends:
- .review-docker
- .only-review
- .only-code-qa-changes
- .only:changes-code-qa
stage: qa
allow_failure: true
variables:
......@@ -236,7 +236,7 @@ review-qa-all:
.review-performance-base:
extends:
- .review-docker
- .only-code-qa-changes
- .only:changes-code-qa
stage: qa
allow_failure: true
before_script:
......@@ -288,7 +288,7 @@ parallel-spec-reports:
extends:
- .default-tags
- .default-only
- .only-code-qa-changes
- .only:changes-code-qa
- .only-review
- .except-deploys
image: ruby:2.6-alpine
......
......@@ -6,7 +6,7 @@ cache gems:
- .default-retry
- .default-cache
- .default-before_script
- .only-code-qa-changes
- .only:changes-code-backstage-qa
stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"]
......@@ -29,7 +29,7 @@ cache gems:
- .default-tags
- .default-retry
- .default-only
- .only-code-changes
- .only:changes-code-backstage
dependencies: []
gitlab_git_test:
......
.tests-metadata-state:
extends:
- .default-only
- .only-code-changes
- .only:changes-code-backstage
variables:
TESTS_METADATA_S3_BUCKET: "gitlab-ce-cache"
before_script:
......@@ -48,7 +48,7 @@ flaky-examples-check:
- .default-tags
- .default-retry
- .default-only
- .only-code-changes
- .only:changes-code-backstage
image: ruby:2.6-alpine
stage: post-test
variables:
......
---
title: Show approval required status in license compliance
merge_request: 19114
author:
type: changed
......@@ -8,7 +8,7 @@
# If a setting requires an application restart say so in that screen. #
# If you change this file in a Merge Request, please also create #
# a MR on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests. #
# For more details see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/0928cfb09f43993fd9454b0b14dbd1924b1407bc/doc/settings/gitlab.yml.md #
# For more details see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/gitlab.yml.md #
########################################################################
#
#
......
......@@ -12,10 +12,13 @@ class RemoveRendundantIndexFromReleases < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def up
remove_concurrent_index :releases, :project_id
remove_concurrent_index_by_name :releases, 'index_releases_on_project_id'
# This is an extra index that is not present in db/schema.rb but known to exist on some installs
remove_concurrent_index_by_name :releases, 'releases_project_id_idx'
end
def down
add_concurrent_index :releases, :project_id
add_concurrent_index :releases, :project_id, name: 'index_releases_on_project_id'
end
end
......@@ -3,9 +3,10 @@
> - Introduced prior to GitLab 12.3 at the project level.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/12077) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.3 at the group level.
Cycle Analytics measures the time spent to go from an [idea to production] - also known
as cycle time - for each of your projects. Cycle Analytics displays the median time for an idea to
reach production, along with the time typically spent in each DevOps stage along the way.
Cycle Analytics measures the time spent to go from an
[idea to production](https://about.gitlab.com/blog/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/#from-idea-to-production-with-gitlab)
(also known as cycle time) for each of your projects. Cycle Analytics displays the median time
spent in each stage defined in the process.
NOTE: **Note:**
Use the `cycle_analytics` feature flag to enable at the group level.
......@@ -14,8 +15,8 @@ Cycle Analytics is useful in order to quickly determine the velocity of a given
project. It points to bottlenecks in the development process, enabling management
to uncover, triage, and identify the root cause of slowdowns in the software development life cycle.
Cycle Analytics is tightly coupled with the [GitLab flow] and calculates a separate median for each
stage.
Cycle Analytics is tightly coupled with the [GitLab flow](../../topics/gitlab_flow.md) and
calculates a separate median for each stage.
## Overview
......@@ -46,6 +47,16 @@ There are seven stages that are tracked as part of the Cycle Analytics calculati
- **Production** (Total)
- Total lifecycle time; i.e. the velocity of the project or team
## Date ranges
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/13216) in GitLab 12.4.
GitLab provides the ability to filter analytics based on a date range. To filter results:
1. Select a group.
1. Optionally select a project.
1. Select a date range using the available date pickers.
## How the data is measured
Cycle Analytics records cycle time and data based on the project issues with the
......@@ -53,7 +64,8 @@ exception of the staging and production stages, where only data deployed to
production are measured.
Specifically, if your CI is not set up and you have not defined a `production`
or `production/*` [environment], then you will not have any data for those stages.
or `production/*` [environment](../../ci/yaml/README.md#environment), then you will not have any
data for those stages.
Each stage of Cycle Analytics is further described in the table below.
......@@ -64,11 +76,9 @@ Each stage of Cycle Analytics is further described in the table below.
| Code | Measures the median time between pushing a first commit (previous stage) and creating a merge request (MR) related to that commit. The key to keep the process tracked is to include the [issue closing pattern](../project/issues/managing_issues.md#closing-issues-automatically) to the description of the merge request (for example, `Closes #xxx`, where `xxx` is the number of the issue related to this merge request). If the issue closing pattern is not present in the merge request description, the MR is not considered to the measurement time of the stage. |
| Test | Measures the median time to run the entire pipeline for that project. It's related to the time GitLab CI takes to run every job for the commits pushed to that merge request defined in the previous stage. It is basically the start->finish time for all pipelines. |
| Review | Measures the median time taken to review the merge request that has closing issue pattern, between its creation and until it's merged. |
| Staging | Measures the median time between merging the merge request with closing issue pattern until the very first deployment to production. It's tracked by the [environment] set to `production` or matching `production/*` (case-sensitive, `Production` won't work) in your GitLab CI configuration. If there isn't a production environment, this is not tracked. |
| Staging | Measures the median time between merging the merge request with closing issue pattern until the very first deployment to production. It's tracked by the environment set to `production` or matching `production/*` (case-sensitive, `Production` won't work) in your GitLab CI configuration. If there isn't a production environment, this is not tracked. |
| Production| The sum of all time (medians) taken to run the entire process, from issue creation to deploying the code to production. |
---
How this works, behind the scenes:
1. Issues and merge requests are grouped together in pairs, such that for each
......@@ -81,12 +91,12 @@ How this works, behind the scenes:
we need for the stages, like issue creation date, merge request merge time,
etc.
To sum up, anything that doesn't follow [GitLab flow] will not be tracked and the
To sum up, anything that doesn't follow [GitLab flow](../../workflow/gitlab_flow.md) will not be tracked and the
Cycle Analytics dashboard will not present any data for:
- merge requests that do not close an issue.
- issues not labeled with a label present in the Issue Board or for issues not assigned a milestone.
- staging and production stages, if the project has no `production` or `production/*`
- Merge requests that do not close an issue.
- Issues not labeled with a label present in the Issue Board or for issues not assigned a milestone.
- Staging and production stages, if the project has no `production` or `production/*`
environment.
## Example workflow
......@@ -107,7 +117,7 @@ environments is configured.
1. Push branch and create a merge request that contains the [issue closing pattern](../project/issues/managing_issues.md#closing-issues-automatically)
in its description at 14:00 (stop of **Code** stage / start of **Test** and
**Review** stages).
1. The CI starts running your scripts defined in [`.gitlab-ci.yml`][yml] and
1. The CI starts running your scripts defined in [`.gitlab-ci.yml`](../../ci/yaml/README.md) and
takes 5min (stop of **Test** stage).
1. Review merge request, ensure that everything is OK and merge the merge
request at 19:00. (stop of **Review** stage / start of **Staging** stage).
......@@ -151,7 +161,7 @@ The current permissions on the Project Cycle Analytics dashboard are:
- Internal projects - any authenticated user can access.
- Private projects - any member Guest and above can access.
You can [read more about permissions][permissions] in general.
You can [read more about permissions](../../ci/yaml/README.md) in general.
NOTE: **Note:**
As of GitLab 12.3, the project-level page is deprecated. You should access
......@@ -169,14 +179,6 @@ For Cycle Analytics functionality introduced in GitLab 12.3 and later:
Learn more about Cycle Analytics in the following resources:
- [Cycle Analytics feature page](https://about.gitlab.com/product/cycle-analytics/)
- [Cycle Analytics feature preview](https://about.gitlab.com/blog/2016/09/16/feature-preview-introducing-cycle-analytics/)
- [Cycle Analytics feature highlight](https://about.gitlab.com/blog/2016/09/21/cycle-analytics-feature-highlight/)
[ce-5986]: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/5986
[ce-20975]: https://gitlab.com/gitlab-org/gitlab-foss/issues/20975
[environment]: ../../ci/yaml/README.md#environment
[GitLab flow]: ../../topics/gitlab_flow.md
[idea to production]: https://about.gitlab.com/blog/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/#from-idea-to-production-with-gitlab
[permissions]: ../permissions.md
[yml]: ../../ci/yaml/README.md
- [Cycle Analytics feature page](https://about.gitlab.com/product/cycle-analytics/).
- [Cycle Analytics feature preview](https://about.gitlab.com/blog/2016/09/16/feature-preview-introducing-cycle-analytics/).
- [Cycle Analytics feature highlight](https://about.gitlab.com/blog/2016/09/21/cycle-analytics-feature-highlight/).
......@@ -42,10 +42,19 @@ The following metrics and visualizations are available on a project or group lev
- Number of lines of code per commit.
- Number of files touched.
- Scatterplot showing all MRs merged on a certain date, together with the days it took to complete the action and a 30 day rolling median.
- Users can zoom in and out on specific days of interest.
- Table showing the list of merge requests with their respective time duration metrics.
- Users can sort by any of the above metrics.
## Date ranges
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/13188) in GitLab 12.4.
GitLab has the ability to filter analytics based on a date range. To filter results:
1. Select a group.
1. Optionally select a project.
1. Select a date range using the available date pickers.
## Permissions
The **Productivity Analytics** dashboard can be accessed only:
......
......@@ -307,6 +307,7 @@ export default {
:license-management-settings-path="mr.licenseManagement.license_management_settings_path"
:base-path="mr.licenseManagement.base_path"
:head-path="mr.licenseManagement.head_path"
:security-approvals-help-page-path="mr.securityApprovalsHelpPagePath"
report-section-class="mr-widget-border-top"
/>
<grouped-test-reports-app
......
<script>
import { mapState, mapGetters, mapActions } from 'vuex';
import { GlLink } from '@gitlab/ui';
import ReportSection from '~/reports/components/report_section.vue';
import Icon from '~/vue_shared/components/icon.vue';
import reportsMixin from 'ee/vue_shared/security_reports/mixins/reports_mixin';
......@@ -15,6 +16,7 @@ export default {
componentNames,
store,
components: {
GlLink,
ReportSection,
SetLicenseApprovalModal,
Icon,
......@@ -63,10 +65,20 @@ export default {
required: false,
default: false,
},
securityApprovalsHelpPagePath: {
type: String,
required: false,
default: '',
},
},
computed: {
...mapState(['loadLicenseReportError']),
...mapGetters(['licenseReport', 'isLoading', 'licenseSummaryText']),
...mapGetters([
'licenseReport',
'isLoading',
'licenseSummaryText',
'reportContainsBlacklistedLicense',
]),
hasLicenseReportIssues() {
const { licenseReport } = this;
return licenseReport && licenseReport.length > 0;
......@@ -116,7 +128,6 @@ export default {
<set-license-approval-modal />
<report-section
:status="licenseReportStatus"
:success-text="licenseSummaryText"
:loading-text="licenseSummaryText"
:error-text="licenseSummaryText"
:neutral-issues="licenseReport"
......@@ -126,6 +137,17 @@ export default {
:always-open="alwaysOpen"
class="license-report-widget mr-report"
>
<template #success>
{{ licenseSummaryText }}
<gl-link
v-if="reportContainsBlacklistedLicense && securityApprovalsHelpPagePath"
:href="securityApprovalsHelpPagePath"
class="js-security-approval-help-link"
target="_blank"
>
<icon :size="12" name="question" />
</gl-link>
</template>
<div v-if="showActionButtons" slot="actionButtons" class="append-right-default">
<a
v-if="licenseManagementSettingsPath"
......
import { n__, s__, sprintf } from '~/locale';
import { parseLicenseReportMetrics } from './utils';
import { LICENSE_APPROVAL_STATUS } from '../constants';
export const isLoading = state => state.isLoadingManagedLicenses || state.isLoadingLicenseReport;
......@@ -27,18 +28,32 @@ export const licenseSummaryText = (state, getters) => {
}
if (hasReportItems) {
const licenseReportLength = getters.licenseReport.length;
if (!baseReportHasLicenses) {
return n__(
return getters.reportContainsBlacklistedLicense
? n__(
'LicenseCompliance|License Compliance detected %d license for the source branch only; approval required',
'LicenseCompliance|License Compliance detected %d licenses for the source branch only; approval required',
licenseReportLength,
)
: n__(
'LicenseCompliance|License Compliance detected %d license for the source branch only',
'LicenseCompliance|License Compliance detected %d licenses for the source branch only',
getters.licenseReport.length,
licenseReportLength,
);
}
return n__(
return getters.reportContainsBlacklistedLicense
? n__(
'LicenseCompliance|License Compliance detected %d new license; approval required',
'LicenseCompliance|License Compliance detected %d new licenses; approval required',
licenseReportLength,
)
: n__(
'LicenseCompliance|License Compliance detected %d new license',
'LicenseCompliance|License Compliance detected %d new licenses',
getters.licenseReport.length,
licenseReportLength,
);
}
......@@ -51,5 +66,10 @@ export const licenseSummaryText = (state, getters) => {
return s__('LicenseCompliance|License Compliance detected no new licenses');
};
export const reportContainsBlacklistedLicense = (_state, getters) =>
(getters.licenseReport || []).some(
license => license.approvalStatus === LICENSE_APPROVAL_STATUS.BLACKLISTED,
);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -4,7 +4,9 @@ module Atlassian
module JiraConnect
module Serializers
class BranchEntity < BaseEntity
expose :name, as: :id
expose :id do |branch|
Digest::SHA256.hexdigest(branch.name)
end
expose :issueKeys do |branch|
JiraIssueKeyExtractor.new(branch.name).issue_keys
end
......
......@@ -14,6 +14,7 @@ import {
describe('License Report MR Widget', () => {
const Component = Vue.extend(LicenseManagement);
const apiUrl = `${TEST_HOST}/license_management`;
const securityApprovalsHelpPagePath = `${TEST_HOST}/path/to/security/approvals/help`;
let vm;
const defaultState = {
......@@ -32,6 +33,9 @@ describe('License Report MR Widget', () => {
licenseSummaryText() {
return 'FOO';
},
reportContainsBlacklistedLicense() {
return false;
},
};
const defaultProps = {
......@@ -44,6 +48,7 @@ describe('License Report MR Widget', () => {
licenseManagementSettingsPath: `${TEST_HOST}/lm_settings`,
fullReportPath: `${TEST_HOST}/path/to/the/full/report`,
apiUrl,
securityApprovalsHelpPagePath,
};
const defaultActions = {
......@@ -257,6 +262,31 @@ describe('License Report MR Widget', () => {
expect(actions.loadParsedLicenseReport).not.toHaveBeenCalled();
});
describe('approval status', () => {
const findSecurityApprovalHelpLink = () =>
vm.$el.querySelector('.js-security-approval-help-link');
it('does not show a link to security approval help page if report does not contain blacklisted licenses', () => {
expect(findSecurityApprovalHelpLink()).toBeNull();
});
it('shows a link to security approval help page if report contains blacklisted licenses', () => {
const getters = {
...defaultGetters,
reportContainsBlacklistedLicense() {
return true;
},
};
vm = mountComponent({ getters });
const securityApprovalHelpLink = findSecurityApprovalHelpLink();
expect(findSecurityApprovalHelpLink()).not.toBeNull();
expect(securityApprovalHelpLink.getAttribute('href')).toEqual(
securityApprovalsHelpPagePath,
);
});
});
});
describe('with the `parsedLicenseReport` feature flag turned on', () => {
......
......@@ -132,6 +132,17 @@ describe('getters', () => {
'License Compliance detected 2 new licenses',
);
});
it('should be `License Compliance detected 2 new licenses; approval required`, if the report has two elements and including some blacklisted', () => {
const mockGetters = {
licenseReport: [licenseReportMock[0], licenseReportMock[0]],
reportContainsBlacklistedLicense: true,
};
expect(getters.licenseSummaryText(state, mockGetters)).toBe(
'License Compliance detected 2 new licenses; approval required',
);
});
});
describe('when there are no licences on the BASE', () => {
......@@ -162,6 +173,38 @@ describe('getters', () => {
'License Compliance detected 2 licenses for the source branch only',
);
});
it('should be `License Compliance detected 2 licenses for the source branch only; approval required` with two new licences including some blacklisted', () => {
const mockGetters = {
licenseReport: [licenseReportMock[0], licenseReportMock[0]],
reportContainsBlacklistedLicense: true,
};
expect(getters.licenseSummaryText(state, mockGetters)).toBe(
'License Compliance detected 2 licenses for the source branch only; approval required',
);
});
});
});
describe('reportContainsBlacklistedLicense', () => {
it('should be false if the report does not contain blacklisted licenses', () => {
const mockGetters = {
licenseReport: [licenseReportMock[0], licenseReportMock[0]],
};
expect(getters.reportContainsBlacklistedLicense(state, mockGetters)).toBe(false);
});
it('should be true if the report contains blacklisted licenses', () => {
const mockGetters = {
licenseReport: [
licenseReportMock[0],
{ ...licenseReportMock[0], approvalStatus: 'blacklisted' },
],
};
expect(getters.reportContainsBlacklistedLicense(state, mockGetters)).toBe(true);
});
});
});
# frozen_string_literal: true
require 'spec_helper'
describe Atlassian::JiraConnect::Serializers::BranchEntity do
let(:project) { create(:project, :repository) }
let(:branch) { project.repository.find_branch('improve/awesome') }
subject { described_class.represent(branch, project: project).as_json }
it 'sets the hash of the branch name as the id' do
expect(subject[:id]).to eq('bbfba9b197ace5da93d03382a7ce50081ae89d99faac1f2326566941288871ce')
end
end
......@@ -58,11 +58,16 @@ module Gitlab
# wrong answer. We handle that by querying the full list - which fills
# the cache - and using it directly to answer the question.
define_method("#{name}_include?") do |value|
if strong_memoized?(name) || !redis_set_cache.exist?(name)
return __send__(name).include?(value) # rubocop:disable GitlabSecurity/PublicSend
end
return __send__(name).include?(value) if strong_memoized?(name) # rubocop:disable GitlabSecurity/PublicSend
# If the member exists in the set, return as such early.
return true if redis_set_cache.include?(name, value)
# If it did not, make sure the collection exists.
# If the collection exists, then item does not.
return false if redis_set_cache.exist?(name)
redis_set_cache.include?(name, value)
__send__(name).include?(value) # rubocop:disable GitlabSecurity/PublicSend
end
end
......
......@@ -25,7 +25,7 @@ module Gitlab
end
def read(key)
with { |redis| redis.smembers(cache_key(key)) }
with { |redis| redis.sscan_each(cache_key(key)).to_a }
end
def write(key, value)
......@@ -47,12 +47,11 @@ module Gitlab
end
def fetch(key, &block)
if exist?(key)
read(key)
else
result = read(key)
return result unless result.empty?
write(key, yield)
end
end
def include?(key, value)
with { |redis| redis.sismember(cache_key(key), value) }
......
......@@ -9814,11 +9814,21 @@ msgid_plural "LicenseCompliance|License Compliance detected %d licenses for the
msgstr[0] ""
msgstr[1] ""
msgid "LicenseCompliance|License Compliance detected %d license for the source branch only; approval required"
msgid_plural "LicenseCompliance|License Compliance detected %d licenses for the source branch only; approval required"
msgstr[0] ""
msgstr[1] ""
msgid "LicenseCompliance|License Compliance detected %d new license"
msgid_plural "LicenseCompliance|License Compliance detected %d new licenses"
msgstr[0] ""
msgstr[1] ""
msgid "LicenseCompliance|License Compliance detected %d new license; approval required"
msgid_plural "LicenseCompliance|License Compliance detected %d new licenses; approval required"
msgstr[0] ""
msgstr[1] ""
msgid "LicenseCompliance|License Compliance detected no licenses for the source branch only"
msgstr ""
......
......@@ -14,11 +14,11 @@ gitlab:
gitaly:
resources:
requests:
cpu: 600m
memory: 200M
limits:
cpu: 1200m
memory: 420M
memory: 240M
limits:
cpu: 1800m
memory: 360M
persistence:
size: 10G
gitlab-exporter:
......@@ -35,22 +35,22 @@ gitlab:
gitlab-shell:
resources:
requests:
cpu: 125m
memory: 20M
cpu: 230m
memory: 25M
limits:
cpu: 250m
memory: 40M
cpu: 345m
memory: 37.5M
maxReplicas: 3
hpa:
targetAverageValue: 130m
sidekiq:
resources:
requests:
cpu: 500m
memory: 800M
cpu: 650m
memory: 880M
limits:
cpu: 1000m
memory: 1.6G
cpu: 975m
memory: 1320M
task-runner:
resources:
requests:
......@@ -62,11 +62,11 @@ gitlab:
unicorn:
resources:
requests:
cpu: 400m
memory: 1.4G
cpu: 500m
memory: 1540M
limits:
cpu: 800m
memory: 2.8G
cpu: 750m
memory: 2310M
deployment:
readinessProbe:
initialDelaySeconds: 5 # Default is 0
......@@ -75,11 +75,11 @@ gitlab:
workhorse:
resources:
requests:
cpu: 300m
memory: 100M
cpu: 250m
memory: 50M
limits:
cpu: 600m
memory: 200M
cpu: 375m
memory: 75M
readinessProbe:
initialDelaySeconds: 5 # Default is 0
periodSeconds: 15 # Default is 10
......@@ -87,11 +87,11 @@ gitlab:
gitlab-runner:
resources:
requests:
cpu: 355m
memory: 300M
cpu: 450m
memory: 100M
limits:
cpu: 710m
memory: 600M
cpu: 675m
memory: 150M
minio:
resources:
requests:
......@@ -108,10 +108,10 @@ nginx-ingress:
resources:
requests:
cpu: 100m
memory: 250M
memory: 450M
limits:
cpu: 200m
memory: 500M
memory: 675M
minAvailable: 1
service:
enableHttp: false
......@@ -133,10 +133,11 @@ postgresql:
enabled: false
resources:
requests:
cpu: 250m
memory: 256M
cpu: 300m
memory: 250M
limits:
cpu: 500m
cpu: 450m
memory: 375M
prometheus:
install: false
redis:
......@@ -157,8 +158,8 @@ registry:
minReplicas: 1
resources:
requests:
cpu: 50m
memory: 32M
limits:
cpu: 100m
memory: 64M
memory: 30M
limits:
cpu: 200m
memory: 45M
......@@ -56,8 +56,8 @@ describe Projects::ReleasesController do
context 'when the project is private and the user is not logged in' do
let(:project) { private_project }
it 'renders a 302' do
expect(response.status).to eq(302)
it 'returns a redirect' do
expect(response).to have_gitlab_http_status(:redirect)
end
end
end
......@@ -78,8 +78,8 @@ describe Projects::ReleasesController do
context 'when the project is private and the user is not logged in' do
let(:project) { private_project }
it 'renders a 401' do
expect(response.status).to eq(401)
it 'returns a redirect' do
expect(response).to have_gitlab_http_status(:redirect)
end
end
end
......
# frozen_string_literal: true
require 'spec_helper'
describe MergeRequests::AssignsMergeParams do
......
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