Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-10-13 06:11:33 +00:00
parent 4ae83df07e
commit 56a177ed56
10 changed files with 48 additions and 17 deletions

View File

@ -1,10 +1,14 @@
<script>
import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import MarkdownFieldView from '~/vue_shared/components/markdown/field_view.vue';
export default {
components: {
MarkdownFieldView,
},
directives: {
SafeHtml,
},
props: {
description: {
type: String,
@ -12,13 +16,14 @@ export default {
default: '',
},
},
safeHtmlConfig: { ADD_TAGS: ['gl-emoji'] },
};
</script>
<template>
<markdown-field-view class="snippet-description" data-qa-selector="snippet_description_content">
<div
v-safe-html:[$options.safeHtmlConfig]="description"
class="md js-snippet-description"
v-html="description /* eslint-disable-line vue/no-v-html */"
></div>
</markdown-field-view>
</template>

View File

@ -25,3 +25,5 @@ export const LOAD_ACTION_ATTR_SELECTOR = '[data-track-action="render"]';
export const URLS_CACHE_STORAGE_KEY = 'gl-snowplow-pseudonymized-urls';
export const REFERRER_TTL = 24 * 60 * 60 * 1000;
export const GOOGLE_ANALYTICS_ID_COOKIE_NAME = '_ga';

View File

@ -1,4 +1,5 @@
import { SNOWPLOW_JS_SOURCE } from './constants';
import { getCookie } from '~/lib/utils/common_utils';
import { SNOWPLOW_JS_SOURCE, GOOGLE_ANALYTICS_ID_COOKIE_NAME } from './constants';
export default function getStandardContext({ extra = {} } = {}) {
const { schema, data = {} } = { ...window.gl?.snowplowStandardContext };
@ -8,6 +9,7 @@ export default function getStandardContext({ extra = {} } = {}) {
data: {
...data,
source: SNOWPLOW_JS_SOURCE,
google_analytics_id: getCookie(GOOGLE_ANALYTICS_ID_COOKIE_NAME) ?? '',
extra: extra || data.extra,
},
};

View File

@ -20,6 +20,7 @@ class AssociateExistingDastBuildsWithVariables < ActiveRecord::Migration[6.1]
class Build < ApplicationRecord
self.table_name = 'ci_builds'
self.inheritance_column = :_type_disabled
self.gitlab_schema = :gitlab_ci
default_scope { where(name: :dast, stage: :dast) } # rubocop:disable Cop/DefaultScope
end

View File

@ -21,6 +21,7 @@ The [`StandardContext`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/g
| `environment` | **{check-circle}** | string (max 32 chars) | Name of the source environment, such as `production` or `staging` |
| `source` | **{check-circle}** | string (max 32 chars) | Name of the source application, such as `gitlab-rails` or `gitlab-javascript` |
| `plan` | **{dotted-circle}** | string (max 32 chars) | Name of the plan for the namespace, such as `free`, `premium`, or `ultimate`. Automatically picked from the `namespace`. |
| `google_analytics_id` | **{dotted-circle}** | string (max 32 chars) | Google Analytics ID, present when set from our marketing sites. |
| `extra` | **{dotted-circle}** | JSON | Any additional data associated with the event, in the form of key-value pairs |
## Default Schema

View File

@ -36,7 +36,7 @@ The following table describes the version types and their release cadence:
| Version type | Description | Cadence |
|:-------------|:------------|:--------|
| Major | For significant changes, or when any backward-incompatible changes are introduced to the public API. | Yearly. The next major release is GitLab 14.0 on June 22, 2021 (one month later than typical, details in [this issue](https://gitlab.com/gitlab-com/Product/-/issues/2337)). Subsequent major releases will be scheduled for May 22 each year, by default. |
| Major | For significant changes, or when any backward-incompatible changes are introduced to the public API. | Yearly. The next major release is GitLab 15.0 on May 22, 2022. GitLab schedules major releases on May 22 each year, by default. |
| Minor | For when new backward-compatible functionality is introduced to the public API, a minor feature is introduced, or when a set of smaller features is rolled out. | Monthly on the 22nd. |
| Patch | For backward-compatible bug fixes that fix incorrect behavior. See [Patch releases](#patch-releases). | As needed. |

View File

@ -255,12 +255,16 @@ versions are pulled, there are certain cases where it can be beneficial to pin
an analyzer to a specific release. To do so, override the `SAST_ANALYZER_IMAGE_TAG` CI/CD variable
in the job template directly.
In the example below, we are pinning to a specific patch version of the `spotbugs` analyzer:
In the example below, we pin to a specific patch version of the `spotbugs` analyzer and minor version of the `semgrep` analyzer:
```yaml
include:
- template: Security/SAST.gitlab-ci.yml
semgrep-sast:
variables:
SAST_ANALYZER_IMAGE_TAG: "2.12"
spotbugs-sast:
variables:
SAST_ANALYZER_IMAGE_TAG: "2.28.1"

View File

@ -177,8 +177,6 @@ coverage-jdk11:
# convert report from jacoco to cobertura, using relative project path
- python /opt/cover2cover.py target/site/jacoco/jacoco.xml $CI_PROJECT_DIR/src/main/java/ > target/site/cobertura.xml
needs: ["test-jdk11"]
dependencies:
- test-jdk11
artifacts:
reports:
cobertura: target/site/cobertura.xml
@ -215,8 +213,6 @@ coverage-jdk11:
# convert report from jacoco to cobertura, using relative project path
- python /opt/cover2cover.py build/jacoco/jacoco.xml $CI_PROJECT_DIR/src/main/java/ > build/cobertura.xml
needs: ["test-jdk11"]
dependencies:
- test-jdk11
artifacts:
reports:
cobertura: build/cobertura.xml
@ -235,7 +231,8 @@ run tests:
image: python:3
script:
- pip install pytest pytest-cov
- pytest --cov=src/ tests.py
- coverage run -m pytest
- coverage report
- coverage xml
artifacts:
reports:

View File

@ -1,5 +1,13 @@
import { SNOWPLOW_JS_SOURCE } from '~/tracking/constants';
import { SNOWPLOW_JS_SOURCE, GOOGLE_ANALYTICS_ID_COOKIE_NAME } from '~/tracking/constants';
import getStandardContext from '~/tracking/get_standard_context';
import { setCookie, removeCookie } from '~/lib/utils/common_utils';
const TEST_GA_ID = 'GA1.2.345678901.234567891';
const TEST_BASE_DATA = {
source: SNOWPLOW_JS_SOURCE,
google_analytics_id: '',
extra: {},
};
describe('~/tracking/get_standard_context', () => {
beforeEach(() => {
@ -10,10 +18,7 @@ describe('~/tracking/get_standard_context', () => {
it('returns default object if called without server context', () => {
expect(getStandardContext()).toStrictEqual({
schema: undefined,
data: {
source: SNOWPLOW_JS_SOURCE,
extra: {},
},
data: TEST_BASE_DATA,
});
});
@ -28,9 +33,8 @@ describe('~/tracking/get_standard_context', () => {
expect(getStandardContext()).toStrictEqual({
schema: 'iglu:com.gitlab/gitlab_standard',
data: {
...TEST_BASE_DATA,
environment: 'testing',
source: SNOWPLOW_JS_SOURCE,
extra: {},
},
});
});
@ -50,4 +54,15 @@ describe('~/tracking/get_standard_context', () => {
expect(getStandardContext({ extra }).data.extra).toBe(extra);
});
describe('with Google Analytics cookie present', () => {
afterEach(() => {
removeCookie(GOOGLE_ANALYTICS_ID_COOKIE_NAME);
});
it('appends Google Analytics ID', () => {
setCookie(GOOGLE_ANALYTICS_ID_COOKIE_NAME, TEST_GA_ID);
expect(getStandardContext().data.google_analytics_id).toBe(TEST_GA_ID);
});
});
});

View File

@ -61,7 +61,6 @@
- "./spec/mailers/emails/pipelines_spec.rb"
- "./spec/migrations/20210907211557_finalize_ci_builds_bigint_conversion_spec.rb"
- "./spec/migrations/cleanup_legacy_artifact_migration_spec.rb"
- "./spec/migrations/migrate_protected_attribute_to_pending_builds_spec.rb"
- "./spec/migrations/re_schedule_latest_pipeline_id_population_with_all_security_related_artifact_types_spec.rb"
- "./spec/migrations/schedule_migrate_security_scans_spec.rb"
- "./spec/models/ci/build_spec.rb"
@ -111,3 +110,8 @@
- "./spec/support/shared_examples/requests/graphql_shared_examples.rb"
- "./spec/support/shared_examples/services/packages_shared_examples.rb"
- "./spec/support/shared_examples/workers/idempotency_shared_examples.rb"
- "./spec/migrations/associate_existing_dast_builds_with_variables_spec.rb"
- "./spec/migrations/schedule_pages_metadata_migration_spec.rb"
- "./spec/migrations/schedule_copy_ci_builds_columns_to_security_scans2_spec.rb"
- "./spec/lib/gitlab/background_migration/copy_ci_builds_columns_to_security_scans_spec.rb"
- "./spec/lib/gitlab/background_migration/migrate_pages_metadata_spec.rb"