Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-06-30 15:08:27 +00:00
parent 7c28a67789
commit 9376fdc13e
148 changed files with 1370 additions and 795 deletions

View File

@ -1 +1 @@
d5777441938369d512a7825c57ccf6115d7afdfa
21e7c85471a8d7401fad69be300eaff1c0384577

View File

@ -1,5 +1,6 @@
<script>
import MetricCard from '~/analytics/shared/components/metric_card.vue';
import { GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui';
import { GlSingleStat } from '@gitlab/ui/dist/charts';
import createFlash from '~/flash';
import { number } from '~/lib/utils/unit_format';
import { s__ } from '~/locale';
@ -10,7 +11,8 @@ const defaultPrecision = 0;
export default {
name: 'UsageCounts',
components: {
MetricCard,
GlSkeletonLoading,
GlSingleStat,
},
data() {
return {
@ -56,10 +58,24 @@ export default {
</script>
<template>
<metric-card
:title="__('Usage Trends')"
:metrics="counts"
:is-loading="$apollo.queries.counts.loading"
class="gl-mt-4"
/>
<div>
<h2>
{{ __('Usage Trends') }}
</h2>
<div
class="gl-display-flex gl-flex-direction-column gl-md-flex-direction-row gl-my-6 gl-align-items-flex-start"
>
<gl-skeleton-loading v-if="$apollo.queries.counts.loading" />
<template v-else>
<gl-single-stat
v-for="count in counts"
:key="count.key"
class="gl-pr-9 gl-my-4 gl-md-mt-0 gl-md-mb-0"
:value="`${count.value}`"
:title="count.label"
:should-animate="true"
/>
</template>
</div>
</div>
</template>

View File

@ -12,10 +12,8 @@ import BoardColumnDeprecated from './board_column_deprecated.vue';
export default {
components: {
BoardAddNewColumn,
BoardColumn:
gon.features?.graphqlBoardLists || gon.features?.epicBoards
? BoardColumn
: BoardColumnDeprecated,
BoardColumn,
BoardColumnDeprecated,
BoardContentSidebar: () => import('~/boards/components/board_content_sidebar.vue'),
EpicBoardContentSidebar: () =>
import('ee_component/boards/components/epic_board_content_sidebar.vue'),
@ -38,11 +36,14 @@ export default {
computed: {
...mapState(['boardLists', 'error', 'addColumnForm']),
...mapGetters(['isSwimlanesOn', 'isEpicBoard']),
useNewBoardColumnComponent() {
return this.glFeatures.graphqlBoardLists || this.isSwimlanesOn || this.isEpicBoard;
},
addColumnFormVisible() {
return this.addColumnForm?.visible;
},
boardListsToUse() {
return this.glFeatures.graphqlBoardLists || this.isSwimlanesOn || this.isEpicBoard
return this.useNewBoardColumnComponent
? sortBy([...Object.values(this.boardLists)], 'position')
: this.lists;
},
@ -65,6 +66,9 @@ export default {
return this.canDragColumns ? options : {};
},
boardColumnComponent() {
return this.useNewBoardColumnComponent ? BoardColumn : BoardColumnDeprecated;
},
},
methods: {
...mapActions(['moveList', 'unsetError']),
@ -102,7 +106,8 @@ export default {
class="boards-list gl-w-full gl-py-5 gl-px-3 gl-white-space-nowrap"
@end="handleDragOnEnd"
>
<board-column
<component
:is="boardColumnComponent"
v-for="(list, index) in boardListsToUse"
:key="index"
ref="board"

View File

@ -105,7 +105,7 @@ export default Vue.extend({
closeSidebar() {
this.detail.issue = {};
},
setAssignees(assignees) {
setAssignees({ assignees }) {
boardsStore.detail.issue.setAssignees(assignees);
},
showScopedLabels(label) {

View File

@ -472,11 +472,11 @@ export default {
}
},
setAssignees: ({ commit, getters }, assigneeUsernames) => {
setAssignees: ({ commit }, { id, assignees }) => {
commit('UPDATE_BOARD_ITEM_BY_ID', {
itemId: getters.activeBoardItem.id,
itemId: id,
prop: 'assignees',
value: assigneeUsernames,
value: assignees,
});
},

View File

@ -2,6 +2,7 @@
import { GlButton, GlLoadingIcon, GlSafeHtmlDirective as SafeHtml, GlSprintf } from '@gitlab/ui';
import { escape } from 'lodash';
import { mapActions, mapGetters, mapState } from 'vuex';
import { IdState } from 'vendor/vue-virtual-scroller';
import createFlash from '~/flash';
import { hasDiff } from '~/helpers/diffs_helper';
import { diffViewerErrors } from '~/ide/constants';
@ -34,7 +35,7 @@ export default {
directives: {
SafeHtml,
},
mixins: [glFeatureFlagsMixin()],
mixins: [glFeatureFlagsMixin(), IdState({ idProp: (vm) => vm.file.file_hash })],
props: {
file: {
type: Object,
@ -79,7 +80,7 @@ export default {
default: false,
},
},
data() {
idState() {
return {
isLoadingCollapsedDiff: false,
forkMessageVisible: false,
@ -101,7 +102,9 @@ export default {
return getShortShaFromFile(this.file);
},
showLoadingIcon() {
return this.isLoadingCollapsedDiff || (!this.file.renderIt && !this.isCollapsed);
return (
this.idState.isLoadingCollapsedDiff || (!this.file.renderIt && !this.idState.isCollapsed)
);
},
hasDiff() {
return hasDiff(this.file);
@ -145,13 +148,13 @@ export default {
return collapsedType(this.file) === DIFF_FILE_MANUAL_COLLAPSE;
},
showBody() {
return !this.isCollapsed || this.automaticallyCollapsed;
return !this.idState.isCollapsed || this.automaticallyCollapsed;
},
showWarning() {
return this.isCollapsed && this.automaticallyCollapsed && !this.viewDiffsFileByFile;
return this.idState.isCollapsed && this.automaticallyCollapsed && !this.viewDiffsFileByFile;
},
showContent() {
return !this.isCollapsed && !this.isFileTooLarge;
return !this.idState.isCollapsed && !this.isFileTooLarge;
},
showLocalFileReviews() {
const loggedIn = Boolean(gon.current_user_id);
@ -179,23 +182,16 @@ export default {
this.requestDiff();
}
},
immediate: true,
},
'file.viewer.automaticallyCollapsed': {
handler: function autoChangeWatch(automaticValue) {
if (collapsedType(this.file) !== DIFF_FILE_MANUAL_COLLAPSE) {
this.isCollapsed = this.viewDiffsFileByFile ? false : automaticValue;
}
this.handleAutomaticallyCollapsed(automaticValue);
},
immediate: true,
},
'file.viewer.manuallyCollapsed': {
handler: function manualChangeWatch(manualValue) {
if (manualValue !== null) {
this.isCollapsed = manualValue;
}
this.handleManualChangeWatch(manualValue);
},
immediate: true,
},
},
created() {
@ -212,6 +208,8 @@ export default {
}
this.manageViewedEffects();
this.handleAutomaticallyCollapsed(this.file.viewer.automaticallyCollapsed);
this.handleManualChangeWatch(this.file.viewer.manuallyCollapsed);
},
beforeDestroy() {
if (this.preRender) return;
@ -226,12 +224,12 @@ export default {
'setFileCollapsedByUser',
]),
manageViewedEffects() {
if (this.reviewed && !this.isCollapsed && this.showLocalFileReviews) {
if (this.reviewed && !this.idState.isCollapsed && this.showLocalFileReviews) {
this.handleToggle();
}
},
expandAllListener() {
if (this.isCollapsed) {
if (this.idState.isCollapsed) {
this.handleToggle();
}
},
@ -253,7 +251,7 @@ export default {
});
},
handleToggle({ viaUserInteraction = false } = {}) {
const collapsingNow = !this.isCollapsed;
const collapsingNow = !this.idState.isCollapsed;
const contentElement = this.$el.querySelector(`#diff-content-${this.file.file_hash}`);
this.setFileCollapsedByUser({
@ -270,11 +268,11 @@ export default {
}
},
requestDiff() {
this.isLoadingCollapsedDiff = true;
this.idState.isLoadingCollapsedDiff = true;
this.loadCollapsedDiff(this.file)
.then(() => {
this.isLoadingCollapsedDiff = false;
this.idState.isLoadingCollapsedDiff = false;
this.setRenderIt(this.file);
})
.then(() => {
@ -287,17 +285,27 @@ export default {
);
})
.catch(() => {
this.isLoadingCollapsedDiff = false;
this.idState.isLoadingCollapsedDiff = false;
createFlash({
message: this.$options.i18n.genericError,
});
});
},
showForkMessage() {
this.forkMessageVisible = true;
this.idState.forkMessageVisible = true;
},
hideForkMessage() {
this.forkMessageVisible = false;
this.idState.forkMessageVisible = false;
},
handleAutomaticallyCollapsed(automaticValue) {
if (collapsedType(this.file) !== DIFF_FILE_MANUAL_COLLAPSE) {
this.idState.isCollapsed = this.viewDiffsFileByFile ? false : automaticValue;
}
},
handleManualChangeWatch(manualValue) {
if (manualValue !== null) {
this.idState.isCollapsed = manualValue;
}
},
},
};
@ -320,7 +328,7 @@ export default {
:diff-file="file"
:collapsible="true"
:reviewed="reviewed"
:expanded="!isCollapsed"
:expanded="!idState.isCollapsed"
:add-merge-request-buttons="true"
:view-diffs-file-by-file="viewDiffsFileByFile"
:show-local-file-reviews="showLocalFileReviews"
@ -331,7 +339,10 @@ export default {
@showForkMessage="showForkMessage"
/>
<div v-if="forkMessageVisible" class="js-file-fork-suggestion-section file-fork-suggestion">
<div
v-if="idState.forkMessageVisible"
class="js-file-fork-suggestion-section file-fork-suggestion"
>
<span v-safe-html="forkMessage" class="file-fork-suggestion-note"></span>
<a
:href="file.fork_path"

View File

@ -13,6 +13,7 @@ import {
} from '@gitlab/ui';
import { escape } from 'lodash';
import { mapActions, mapGetters, mapState } from 'vuex';
import { IdState } from 'vendor/vue-virtual-scroller';
import { diffViewerModes } from '~/ide/constants';
import { scrollToElement } from '~/lib/utils/common_utils';
import { truncateSha } from '~/lib/utils/text_utility';
@ -47,7 +48,7 @@ export default {
GlTooltip: GlTooltipDirective,
SafeHtml: GlSafeHtmlDirective,
},
mixins: [glFeatureFlagsMixin()],
mixins: [glFeatureFlagsMixin(), IdState({ idProp: (vm) => vm.diffFile.file_hash })],
i18n: {
...DIFF_FILE_HEADER,
compareButtonLabel: s__('Compare submodule commit revisions'),
@ -102,7 +103,7 @@ export default {
default: () => [],
},
},
data() {
idState() {
return {
moreActionsShown: false,
};
@ -239,7 +240,7 @@ export default {
}
},
setMoreActionsShown(val) {
this.moreActionsShown = val;
this.idState.moreActionsShown = val;
},
toggleReview(newReviewedStatus) {
const autoCollapsed =
@ -268,7 +269,7 @@ export default {
<template>
<div
ref="header"
:class="{ 'gl-z-dropdown-menu!': moreActionsShown }"
:class="{ 'gl-z-dropdown-menu!': idState.moreActionsShown }"
class="js-file-title file-title file-title-flex-parent"
data-qa-selector="file_title_container"
:data-qa-file-name="filePath"

View File

@ -1,5 +1,6 @@
<script>
import { mapGetters, mapState, mapActions } from 'vuex';
import { IdState } from 'vendor/vue-virtual-scroller';
import DraftNote from '~/batch_comments/components/draft_note.vue';
import draftCommentsMixin from '~/diffs/mixins/draft_comments';
import { getCommentedLines } from '~/notes/components/multiline_comment_utils';
@ -17,7 +18,11 @@ export default {
DiffCommentCell,
DraftNote,
},
mixins: [draftCommentsMixin, glFeatureFlagsMixin()],
mixins: [
draftCommentsMixin,
glFeatureFlagsMixin(),
IdState({ idProp: (vm) => vm.diffFile.file_hash }),
],
props: {
diffFile: {
type: Object,
@ -38,7 +43,7 @@ export default {
default: false,
},
},
data() {
idState() {
return {
dragStart: null,
updatedLineRange: null,
@ -80,29 +85,29 @@ export default {
if (event.target?.parentNode) {
hide(event.target.parentNode);
}
this.dragStart = line;
this.idState.dragStart = line;
},
onDragOver(line) {
if (line.chunk !== this.dragStart.chunk) return;
if (line.chunk !== this.idState.dragStart.chunk) return;
let start = this.dragStart;
let start = this.idState.dragStart;
let end = line;
if (this.dragStart.index >= line.index) {
if (this.idState.dragStart.index >= line.index) {
start = line;
end = this.dragStart;
end = this.idState.dragStart;
}
this.updatedLineRange = { start, end };
this.idState.updatedLineRange = { start, end };
this.setSelectedCommentPosition(this.updatedLineRange);
this.setSelectedCommentPosition(this.idState.updatedLineRange);
},
onStopDragging() {
this.showCommentForm({
lineCode: this.updatedLineRange?.end?.line_code,
lineCode: this.idState.updatedLineRange?.end?.line_code,
fileHash: this.diffFile.file_hash,
});
this.dragStart = null;
this.idState.dragStart = null;
},
isHighlighted(line) {
return isHighlighted(

View File

@ -3,6 +3,7 @@ import { GlDropdownItem } from '@gitlab/ui';
import { cloneDeep } from 'lodash';
import Vue from 'vue';
import createFlash from '~/flash';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import { IssuableType } from '~/issue_show/constants';
import { __, n__ } from '~/locale';
import SidebarAssigneesRealtime from '~/sidebar/components/assignees/assignees_realtime.vue';
@ -80,6 +81,8 @@ export default {
selected: [],
isSettingAssignees: false,
isDirty: false,
oldIid: null,
oldSelected: null,
};
},
apollo: {
@ -142,6 +145,14 @@ export default {
return this.currentUser.username !== undefined;
},
},
watch: {
iid(_, oldIid) {
if (this.isDirty) {
this.oldIid = oldIid;
this.oldSelected = this.selected;
}
},
},
created() {
assigneesWidget.updateAssignees = this.updateAssignees;
},
@ -157,10 +168,14 @@ export default {
variables: {
...this.queryVariables,
assigneeUsernames,
iid: this.oldIid || this.iid,
},
})
.then(({ data }) => {
this.$emit('assignees-updated', data.issuableSetAssignees.issuable.assignees.nodes);
this.$emit('assignees-updated', {
id: getIdFromGraphQLId(data.issuableSetAssignees.issuable.id),
assignees: data.issuableSetAssignees.issuable.assignees.nodes,
});
return data;
})
.catch(() => {
@ -176,7 +191,10 @@ export default {
saveAssignees() {
if (this.isDirty) {
this.isDirty = false;
this.updateAssignees(this.selected.map(({ username }) => username));
const usernames = this.oldSelected || this.selected;
this.updateAssignees(usernames.map(({ username }) => username));
this.oldIid = null;
this.oldSelected = null;
}
this.$el.dispatchEvent(hideDropdownEvent);
},

View File

@ -279,9 +279,12 @@ class Namespace < ApplicationRecord
# Includes projects from this namespace and projects from all subgroups
# that belongs to this namespace
def all_projects
namespace = user? ? self : self_and_descendant_ids
Project.where(namespace: namespace)
if Feature.enabled?(:recursive_approach_for_all_projects, default_enabled: :yaml)
namespace = user? ? self : self_and_descendants
Project.where(namespace: namespace)
else
Project.inside_path(full_path)
end
end
def has_parent?

View File

@ -66,7 +66,8 @@ module Git
def strip_extension(filename)
return unless filename
File.basename(filename, File.extname(filename))
encoded_filename = Gitlab::EncodingHelper.encode_utf8(filename.dup)
File.basename(encoded_filename, File.extname(encoded_filename))
end
end
end

View File

@ -5,7 +5,7 @@ module Gitlab
module StuckImportJob
extend ActiveSupport::Concern
IMPORT_JOBS_EXPIRATION = 15.hours.seconds.to_i
IMPORT_JOBS_EXPIRATION = 24.hours.seconds.to_i
included do
include ApplicationWorker

View File

@ -0,0 +1,8 @@
---
name: recursive_approach_for_all_projects
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64632
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334817
milestone: '14.1'
type: development
group: group::fulfillment
default_enabled: true

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts_monthly.deployments
description: Total deployments count for recent 28 days
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: redis_hll_counters.analytics.analytics_total_unique_counts_monthly
description: The number of unique users who visited any analytics feature by month
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.configure.project_clusters_enabled
description: Total GitLab Managed enabled clusters attached to projects
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.user_dast_jobs
description: Users who run a DAST job
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.dast_pipeline
description: Count of pipelines that have at least 1 DAST job
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.user_api_fuzzing_jobs
description: Count of API Fuzzing jobs by job name
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.user_api_fuzzing_dnd_jobs
description: Count of API Fuzzing `docker-in-docker` jobs by job names
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: redis_hll_counters.incident_management.incident_management_total_unique_counts_monthly
description: Count of unique users performing events related with incidents per month
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.plan.service_desk_issues
description:
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.plan.projects_jira_active
description:
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.plan.projects_jira_dvcs_cloud_active
description:
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.plan.projects_jira_dvcs_server_active
description:
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: redis_hll_counters.issues_edit.g_project_management_issue_created_monthly
description: Count of MAU creating new issues
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: redis_hll_counters.issues_edit.g_project_management_issue_closed_monthly
description: Count of MAU closing an issue
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: redis_hll_counters.issues_edit.issues_edit_total_unique_counts_monthly
description: Aggregate count of MAU taking an action related to an issue
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.user_unique_users_all_secure_scanners
description:
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.user_sast_jobs
description: Users who run a SAST job
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: 28d
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.user_secret_detection_jobs
description: Users who run a Secret Detection job
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: 28d
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.sast_pipeline
description: Counts of Pipelines that have at least 1 SAST job
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: 28d
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.secret_detection_pipeline
description: Counts of Pipelines that have at least 1 Secret Detection job
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: 28d
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.user_coverage_fuzzing_jobs
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.sast_scans
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.container_scanning_scans
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.dast_scans
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.secret_detection_scans
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.coverage_fuzzing_scans
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage_monthly.secure.api_fuzzing_scans
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: redis_hll_counters.terraform.p_terraform_state_api_unique_users_monthly
description: Monthly active users of GitLab Managed Terraform states
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: redis_hll_counters.user_packages.user_packages_total_unique_counts_monthly
description: A monthly count of users that have published a package to the registry
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: gitaly.servers
description: Total Gitalty Servers
product_section: growth

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: gitaly.clusters
description: Total GitLab Managed clusters both enabled and disabled
product_section: growth

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.service_desk_issues
description: Count of service desk issues
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.merge_requests
description: Count of the number of merge requests
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.clusters_applications_cilium
description: Total GitLab Managed clusters with GitLab Managed App:Cilium installed
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_with_terraform_reports
description: Count of projects with Terraform MR reports
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_with_terraform_states
description: Count of projects with GitLab Managed Terraform State
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ingress_modsecurity_packets_processed
description: Cumulative count of packets processed by ModSecurity since Usage Ping
was last reported

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ingress_modsecurity_packets_anomalous
description: Cumulative count of packets identified as anomalous by ModSecurity since
Usage Ping was last reported

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.network_policy_forwards
description: Cumulative count of packets forwarded by Cilium (Container Network Security)
since Usage Ping was last reported

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.network_policy_drops
description: Cumulative count of packets dropped by Cilium (Container Network Security)
since Usage Ping was last reported

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ingress_modsecurity_logging
description: Whether or not ModSecurity is set to logging mode
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ingress_modsecurity_blocking
description: Whether or not ModSecurity is set to blocking mode
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ingress_modsecurity_disabled
description: Whether or not ModSecurity is disabled within Ingress
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ingress_modsecurity_not_installed
description: Whether or not ModSecurity has not been installed into the cluster
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ci_builds
description: Unique builds in project
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ci_internal_pipelines
description: Total pipelines in GitLab repositories
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.ci_external_pipelines
description: Total pipelines in external repositories
product_section: ops

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.dast_jobs
description: Count of DAST jobs run
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.secure.user_dast_jobs
description: Count of DAST jobs
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_bamboo_active
description: Count of projects with active integrations for Bamboo CI
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_drone_ci_active
description: Count of projects with active integrations for Drone CI
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_jenkins_active
description: Count of projects with active integrations for Jenkins
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_jira_active
description: Count of projects with active integrations for Jira
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_jira_server_active
description: Count of active integrations with Jira Software (server)
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_jira_cloud_active
description: Count of active integrations with Jira Cloud (Saas)
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_jira_dvcs_cloud_active
description: Count of active integrations with Jira Cloud (DVCS Connector)
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_jira_dvcs_server_active
description: Count of active integrations with Jira Software (DVCS connector)
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.secure.user_api_fuzzing_jobs
description: Count of API Fuzzing jobs by job name
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.secure.user_api_fuzzing_dnd_jobs
description: Count of API Fuzzing `docker-in-docker` jobs by job name
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects_imported_from_github
description:
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.manage.issue_imports.jira
description: Count of projects imported from Jira
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.issues
description: Count of Issues created
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.plan.issues
description: Count of users creating Issues
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.plan.epics
description:
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.projects
description: Count of Projects created
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.todos
description: Count of todos created
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.secure.user_unique_users_all_secure_scanners
description:
product_section: sec

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.remote_mirrors
description: Count of total remote mirrors. Includes both push and pull mirrors
product_section: dev

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.sast_jobs
description: Count of SAST CI jobs for the month. Job names ending in '-sast'
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: all
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: counts.secret_detection_jobs
description: Count of all 'secret-detection' CI jobs.
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: all
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.secure.user_sast_jobs
description: Count of SAST jobs per user
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: all
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.secure.user_secret_detection_jobs
description: Count of Secret Detection Jobs per user
product_section: sec
@ -10,7 +10,6 @@ value_type: number
status: data_available
time_frame: all
data_source: database
data_category: Optional
distribution:
- ce
- ee

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: usage_activity_by_stage.secure.user_coverage_fuzzing_jobs
description: ''
product_section: ''

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: gitaly.version
description: Version of Gitaly
product_section: growth

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: git.version
description: Information about Git version
product_section: enablement

View File

@ -1,5 +1,5 @@
---
data_category: Optional
data_category: Operational
key_path: ingress_modsecurity_enabled
description: Whether or not ModSecurity is enabled within Ingress
product_section: sec

View File

@ -70,7 +70,7 @@ is the same as [getting the job's artifacts](#get-job-artifacts), but by
defining the job's name instead of its ID.
NOTE:
If a pipeline is [parent of other child pipelines](../ci/parent_child_pipelines.md), artifacts
If a pipeline is [parent of other child pipelines](../ci/pipelines/parent_child_pipelines.md), artifacts
are searched in hierarchical order from parent to child. For example, if both parent and
child pipelines have a job with the same name, the artifact from the parent pipeline is returned.
@ -172,7 +172,7 @@ pipeline for the given reference name from inside the job's artifacts archive.
The file is extracted from the archive and streamed to the client.
In [GitLab 13.5](https://gitlab.com/gitlab-org/gitlab/-/issues/201784) and later, artifacts
for [parent and child pipelines](../ci/parent_child_pipelines.md) are searched in hierarchical
for [parent and child pipelines](../ci/pipelines/parent_child_pipelines.md) are searched in hierarchical
order from parent to child. For example, if both parent and child pipelines have a
job with the same name, the artifact from the parent pipeline is returned.

View File

@ -295,7 +295,7 @@ Example of response
```
In GitLab 13.3 and later, this endpoint [returns data for any pipeline](pipelines.md#single-pipeline-requests)
including [child pipelines](../ci/parent_child_pipelines.md).
including [child pipelines](../ci/pipelines/parent_child_pipelines.md).
In GitLab 13.5 and later, this endpoint does not return retried jobs in the response
by default. Additionally, jobs are sorted by ID in descending order (newest first).

View File

@ -11,7 +11,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36494) in GitLab 13.3.
Endpoints that request information about a single pipeline return data for any pipeline.
Before 13.3, requests for [child pipelines](../ci/parent_child_pipelines.md) returned
Before 13.3, requests for [child pipelines](../ci/pipelines/parent_child_pipelines.md) returned
a 404 error.
## Pipelines pagination

View File

@ -129,7 +129,7 @@ All project maintainers have access to production secrets. If you need to limit
that can deploy to a production environment, you can create a separate project and configure a new
permission model that isolates the CD permissions from the original project and prevents the
original project's maintainers from accessing the production secret and CD configuration. You can
connect the CD project to your development projects by using [multi-project pipelines](../multi_project_pipelines.md).
connect the CD project to your development projects by using [multi-project pipelines](../pipelines/multi_project_pipelines.md).
## Protect `gitlab-ci.yml` from change

View File

@ -221,8 +221,8 @@ check the value of the `$CI_PIPELINE_SOURCE` variable:
| `external` | When you use CI services other than GitLab. |
| `external_pull_request_event` | When an external pull request on GitHub is created or updated. See [Pipelines for external pull requests](../ci_cd_for_external_repos/index.md#pipelines-for-external-pull-requests). |
| `merge_request_event` | For pipelines created when a merge request is created or updated. Required to enable [merge request pipelines](../pipelines/merge_request_pipelines.md), [merged results pipelines](../pipelines/pipelines_for_merged_results.md), and [merge trains](../pipelines/merge_trains.md). |
| `parent_pipeline` | For pipelines triggered by a [parent/child pipeline](../parent_child_pipelines.md) with `rules`. Use this pipeline source in the child pipeline configuration so that it can be triggered by the parent pipeline. |
| `pipeline` | For [multi-project pipelines](../multi_project_pipelines.md) created by [using the API with `CI_JOB_TOKEN`](../multi_project_pipelines.md#create-multi-project-pipelines-by-using-the-api), or the [`trigger`](../yaml/index.md#trigger) keyword. |
| `parent_pipeline` | For pipelines triggered by a [parent/child pipeline](../pipelines/parent_child_pipelines.md) with `rules`. Use this pipeline source in the child pipeline configuration so that it can be triggered by the parent pipeline. |
| `pipeline` | For [multi-project pipelines](../pipelines/multi_project_pipelines.md) created by [using the API with `CI_JOB_TOKEN`](../pipelines/multi_project_pipelines.md#create-multi-project-pipelines-by-using-the-api), or the [`trigger`](../yaml/index.md#trigger) keyword. |
| `push` | For pipelines triggered by a `git push` event, including for branches and tags. |
| `schedule` | For [scheduled pipelines](../pipelines/schedules.md). |
| `trigger` | For pipelines created by using a [trigger token](../triggers/index.md#trigger-token). |

View File

@ -1,314 +1,8 @@
---
stage: Verify
group: Pipeline Authoring
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: reference
redirect_to: 'pipelines/multi_project_pipelines.md'
---
# Multi-project pipelines **(FREE)**
This document was moved to [another location](pipelines/multi_project_pipelines.md).
> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8.
You can set up [GitLab CI/CD](index.md) across multiple projects, so that a pipeline
in one project can trigger a pipeline in another project. You can visualize the entire pipeline
in one place, including all cross-project interdependencies.
For example, you might deploy your web application from three different projects in GitLab.
Each project has its own build, test, and deploy process. With multi-project pipelines you can
visualize the entire pipeline, including all build and test stages for all three projects.
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For an overview, see the [Multi-project pipelines demo](https://www.youtube.com/watch?v=g_PIwBM1J84).
Multi-project pipelines are also useful for larger products that require cross-project interdependencies, like those
with a [microservices architecture](https://about.gitlab.com/blog/2016/08/16/trends-in-version-control-land-microservices/).
Learn more in the [Cross-project Pipeline Triggering and Visualization demo](https://about.gitlab.com/learn/)
at GitLab@learn, in the Continuous Integration section.
If you trigger a pipeline in a downstream private project, on the upstream project's pipelines page,
you can view:
- The name of the project.
- The status of the pipeline.
If you have a public project that can trigger downstream pipelines in a private project,
make sure there are no confidentiality problems.
## Create multi-project pipelines
To create multi-project pipelines, you can:
- [Define them in your `.gitlab-ci.yml` file](#define-multi-project-pipelines-in-your-gitlab-ciyml-file).
- [Use the API](#create-multi-project-pipelines-by-using-the-api).
### Define multi-project pipelines in your `.gitlab-ci.yml` file
> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8.
When you create a multi-project pipeline in your `.gitlab-ci.yml` file,
you create what is called a *trigger job*. For example:
```yaml
rspec:
stage: test
script: bundle exec rspec
staging:
variables:
ENVIRONMENT: staging
stage: deploy
trigger: my/deployment
```
In this example, after the `rspec` job succeeds in the `test` stage,
the `staging` trigger job starts. The initial status of this
job is `pending`.
GitLab then creates a downstream pipeline in the
`my/deployment` project and, as soon as the pipeline is created, the
`staging` job succeeds. The full path to the project is `my/deployment`.
You can view the status for the pipeline, or you can display
[the downstream pipeline's status instead](#mirror-status-of-a-triggered-pipeline-in-the-trigger-job).
The user that creates the upstream pipeline must be able to create pipelines in the
downstream project (`my/deployment`) too. If the downstream project is not found,
or the user does not have [permission](../user/permissions.md) to create a pipeline there,
the `staging` job is marked as _failed_.
#### Trigger job configuration keywords
Trigger jobs can use only a limited set of the GitLab CI/CD [configuration keywords](yaml/index.md).
The keywords available for use in trigger jobs are:
- [`trigger`](yaml/index.md#trigger)
- [`stage`](yaml/index.md#stage)
- [`allow_failure`](yaml/index.md#allow_failure)
- [`rules`](yaml/index.md#rules)
- [`only` and `except`](yaml/index.md#only--except)
- [`when`](yaml/index.md#when) (only with a value of `on_success`, `on_failure`, or `always`)
- [`extends`](yaml/index.md#extends)
- [`needs`](yaml/index.md#needs)
#### Specify a downstream pipeline branch
You can specify a branch name for the downstream pipeline to use.
GitLab uses the commit on the head of the branch to
create the downstream pipeline.
```yaml
rspec:
stage: test
script: bundle exec rspec
staging:
stage: deploy
trigger:
project: my/deployment
branch: stable-11-2
```
Use:
- The `project` keyword to specify the full path to a downstream project.
- The `branch` keyword to specify the name of a branch in the project specified by `project`.
[In GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/-/issues/10126) and later, variable expansion is
supported.
Pipelines triggered on a protected branch in a downstream project use the [role](../user/permissions.md)
of the user that ran the trigger job in the upstream project. If the user does not
have permission to run CI/CD pipelines against the protected branch, the pipeline fails. See
[pipeline security for protected branches](pipelines/index.md#pipeline-security-on-protected-branches).
#### Pass CI/CD variables to a downstream pipeline by using the `variables` keyword
Sometimes you might want to pass CI/CD variables to a downstream pipeline.
You can do that by using the `variables` keyword, just like you would for any other job.
```yaml
rspec:
stage: test
script: bundle exec rspec
staging:
variables:
ENVIRONMENT: staging
stage: deploy
trigger: my/deployment
```
The `ENVIRONMENT` variable is passed to every job defined in a downstream
pipeline. It is available as a variable when GitLab Runner picks a job.
In the following configuration, the `MY_VARIABLE` variable is passed to the downstream pipeline
that is created when the `trigger-downstream` job is queued. This is because `trigger-downstream`
job inherits variables declared in global variables blocks, and then we pass these variables to a downstream pipeline.
```yaml
variables:
MY_VARIABLE: my-value
trigger-downstream:
variables:
ENVIRONMENT: something
trigger: my/project
```
You might want to pass some information about the upstream pipeline using, for
example, predefined variables. In order to do that, you can use interpolation
to pass any variable. For example:
```yaml
downstream-job:
variables:
UPSTREAM_BRANCH: $CI_COMMIT_REF_NAME
trigger: my/project
```
In this scenario, the `UPSTREAM_BRANCH` variable with a value related to the
upstream pipeline is passed to the `downstream-job` job. It is available
in the context of all downstream builds.
Upstream pipelines take precedence over downstream ones. If there are two
variables with the same name defined in both upstream and downstream projects,
the ones defined in the upstream project take precedence.
#### Pass CI/CD variables to a downstream pipeline by using variable inheritance
You can pass variables to a downstream pipeline with [`dotenv` variable inheritance](variables/index.md#pass-an-environment-variable-to-another-job) and [cross project artifact downloads](yaml/index.md#cross-project-artifact-downloads-with-needs).
In the upstream pipeline:
1. Save the variables in a `.env` file.
1. Save the `.env` file as a `dotenv` report.
1. Trigger the downstream pipeline.
```yaml
build_vars:
stage: build
script:
- echo "BUILD_VERSION=hello" >> build.env
artifacts:
reports:
dotenv: build.env
deploy:
stage: deploy
trigger: my/downstream_project
```
1. Set the `test` job in the downstream pipeline to inherit the variables from the `build_vars`
job in the upstream project with `needs:`. The `test` job inherits the variables in the
`dotenv` report and it can access `BUILD_VERSION` in the script:
```yaml
test:
stage: test
script:
- echo $BUILD_VERSION
needs:
- project: my/upstream_project
job: build_vars
ref: master
artifacts: true
```
#### Use `rules` or `only`/`except` with multi-project pipelines
You can use CI/CD variables or the [`rules`](yaml/index.md#rulesif) keyword to
[control job behavior](jobs/job_control.md) for multi-project pipelines. When a
downstream pipeline is triggered with the [`trigger`](yaml/index.md#trigger) keyword,
the value of the [`$CI_PIPELINE_SOURCE` predefined variable](variables/predefined_variables.md)
is `pipeline` for all its jobs.
If you use [`only/except`](yaml/index.md#only--except) to control job behavior, use the
[`pipelines`](yaml/index.md#onlyrefs--exceptrefs) keyword.
#### Mirror status of a triggered pipeline in the trigger job
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/11238) in GitLab Premium 12.3.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8.
You can mirror the pipeline status from the triggered pipeline to the source
trigger job by using `strategy: depend`. For example:
```yaml
trigger_job:
trigger:
project: my/project
strategy: depend
```
#### Mirror status from upstream pipeline
You can mirror the pipeline status from an upstream pipeline to a bridge job by
using the `needs:pipeline` keyword. The latest pipeline status from the default branch is
replicated to the bridge job.
For example:
```yaml
upstream_bridge:
stage: test
needs:
pipeline: other/project
```
### Create multi-project pipelines by using the API
> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/31573) to GitLab Free in 12.4.
When you use the [`CI_JOB_TOKEN` to trigger pipelines](triggers/index.md#ci-job-token),
GitLab recognizes the source of the job token. The pipelines become related,
so you can visualize their relationships on pipeline graphs.
These relationships are displayed in the pipeline graph by showing inbound and
outbound connections for upstream and downstream pipeline dependencies.
When using:
- CI/CD variables or [`rules`](yaml/index.md#rulesif) to control job behavior, the value of
the [`$CI_PIPELINE_SOURCE` predefined variable](variables/predefined_variables.md) is
`pipeline` for multi-project pipeline triggered through the API with `CI_JOB_TOKEN`.
- [`only/except`](yaml/index.md#only--except) to control job behavior, use the
`pipelines` keyword.
## Trigger a pipeline when an upstream project is rebuilt **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/9045) in GitLab Premium 12.8.
You can trigger a pipeline in your project whenever a pipeline finishes for a new
tag in a different project.
Prerequisites:
- The upstream project must be [public](../public_access/public_access.md).
- The user must have the [Developer role](../user/permissions.md#project-members-permissions)
in the upstream project.
To trigger the pipeline when the upstream project is rebuilt:
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Settings > CI/CD** page.
1. Expand the **Pipeline subscriptions** section.
1. Enter the project you want to subscribe to, in the format `<namespace>/<project>`.
For example, if the project is `https://gitlab.com/gitlab-org/gitlab`, use `gitlab-org/gitlab`.
1. Select **Subscribe**.
Any pipelines that complete successfully for new tags in the subscribed project
now trigger a pipeline on the current project's default branch. The maximum
number of upstream pipeline subscriptions is 2 by default, for both the upstream and
downstream projects. On self-managed instances, an administrator can change this
[limit](../administration/instance_limits.md#number-of-cicd-subscriptions-to-a-project).
## Multi-project pipeline visualization **(PREMIUM)**
When you configure GitLab CI/CD for your project, you can visualize the stages of your
[jobs](pipelines/index.md#configure-a-pipeline) on a [pipeline graph](pipelines/index.md#visualize-pipelines).
![Multi-project pipeline graph](img/multi_project_pipeline_graph.png)
In the merge request, on the **Pipelines** tab, multi-project pipeline mini-graphs are displayed.
They expand and are shown adjacent to each other when hovering (or tapping on touchscreen devices).
![Multi-project mini graph](img/multi_pipeline_mini_graph.gif)
<!-- This redirect file can be deleted after 2021-09-29. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->

View File

@ -1,192 +1,8 @@
---
stage: Verify
group: Pipeline Execution
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: reference
redirect_to: 'pipelines/parent_child_pipelines.md'
---
# Parent-child pipelines **(FREE)**
This document was moved to [another location](pipelines/parent_child_pipelines.md).
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/16094) in GitLab 12.7.
As pipelines grow more complex, a few related problems start to emerge:
- The staged structure, where all steps in a stage must be completed before the first
job in next stage begins, causes arbitrary waits, slowing things down.
- Configuration for the single global pipeline becomes very long and complicated,
making it hard to manage.
- Imports with [`include`](yaml/index.md#include) increase the complexity of the configuration, and create the potential
for namespace collisions where jobs are unintentionally duplicated.
- Pipeline UX can become unwieldy with so many jobs and stages to work with.
Additionally, sometimes the behavior of a pipeline needs to be more dynamic. The ability
to choose to start sub-pipelines (or not) is a powerful ability, especially if the
YAML is dynamically generated.
![Parent pipeline graph expanded](img/parent_pipeline_graph_expanded_v12_6.png)
Similarly to [multi-project pipelines](multi_project_pipelines.md), a pipeline can trigger a
set of concurrently running child pipelines, but within the same project:
- Child pipelines still execute each of their jobs according to a stage sequence, but
would be free to continue forward through their stages without waiting for unrelated
jobs in the parent pipeline to finish.
- The configuration is split up into smaller child pipeline configurations, which are
easier to understand. This reduces the cognitive load to understand the overall configuration.
- Imports are done at the child pipeline level, reducing the likelihood of collisions.
- Each pipeline has only relevant steps, making it easier to understand what's going on.
Child pipelines work well with other GitLab CI/CD features:
- Use [`rules: changes`](yaml/index.md#ruleschanges) to trigger pipelines only when
certain files change. This is useful for monorepos, for example.
- Since the parent pipeline in `.gitlab-ci.yml` and the child pipeline run as normal
pipelines, they can have their own behaviors and sequencing in relation to triggers.
See the [`trigger:`](yaml/index.md#trigger) keyword documentation for full details on how to
include the child pipeline configuration.
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For an overview, see [Parent-Child Pipelines feature demo](https://youtu.be/n8KpBSqZNbk).
## Examples
The simplest case is [triggering a child pipeline](yaml/index.md#trigger) using a
local YAML file to define the pipeline configuration. In this case, the parent pipeline
triggers the child pipeline, and continues without waiting:
```yaml
microservice_a:
trigger:
include: path/to/microservice_a.yml
```
You can include multiple files when composing a child pipeline:
```yaml
microservice_a:
trigger:
include:
- local: path/to/microservice_a.yml
- template: Security/SAST.gitlab-ci.yml
```
In [GitLab 13.5](https://gitlab.com/gitlab-org/gitlab/-/issues/205157) and later,
you can use [`include:file`](yaml/index.md#includefile) to trigger child pipelines
with a configuration file in a different project:
```yaml
microservice_a:
trigger:
include:
- project: 'my-group/my-pipeline-library'
file: 'path/to/ci-config.yml'
```
The maximum number of entries that are accepted for `trigger:include:` is three.
Similar to [multi-project pipelines](multi_project_pipelines.md#mirror-status-of-a-triggered-pipeline-in-the-trigger-job),
we can set the parent pipeline to depend on the status of the child pipeline upon completion:
```yaml
microservice_a:
trigger:
include:
- local: path/to/microservice_a.yml
- template: Security/SAST.gitlab-ci.yml
strategy: depend
```
## Merge Request child pipelines
To trigger a child pipeline as a [Merge Request Pipeline](pipelines/merge_request_pipelines.md) we need to:
- Set the trigger job to run on merge requests:
```yaml
# parent .gitlab-ci.yml
microservice_a:
trigger:
include: path/to/microservice_a.yml
rules:
- if: $CI_MERGE_REQUEST_ID
```
- Configure the child pipeline by either:
- Setting all jobs in the child pipeline to evaluate in the context of a merge request:
```yaml
# child path/to/microservice_a.yml
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
job1:
script: ...
job2:
script: ...
```
- Alternatively, setting the rule per job. For example, to create only `job1` in
the context of merge request pipelines:
```yaml
# child path/to/microservice_a.yml
job1:
script: ...
rules:
- if: $CI_MERGE_REQUEST_ID
job2:
script: ...
```
## Dynamic child pipelines
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9.
Instead of running a child pipeline from a static YAML file, you can define a job that runs
your own script to generate a YAML file, which is then [used to trigger a child pipeline](yaml/index.md#trigger-child-pipeline-with-generated-configuration-file).
This technique can be very powerful in generating pipelines targeting content that changed or to
build a matrix of targets and architectures.
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For an overview, see [Create child pipelines using dynamically generated configurations](https://youtu.be/nMdfus2JWHM).
<!-- vale gitlab.Spelling = NO -->
We also have an example project using
[Dynamic Child Pipelines with Jsonnet](https://gitlab.com/gitlab-org/project-templates/jsonnet)
which shows how to use a data templating language to generate your `.gitlab-ci.yml` at runtime. You could use a similar process for other templating languages like [Dhall](https://dhall-lang.org/) or [`ytt`](https://get-ytt.io/).
<!-- vale gitlab.Spelling = NO -->
The artifact path is parsed by GitLab, not the runner, so the path must match the
syntax for the OS running GitLab. If GitLab is running on Linux but using a Windows
runner for testing, the path separator for the trigger job would be `/`. Other CI/CD
configuration for jobs, like scripts, that use the Windows runner would use `\`.
In GitLab 12.9, the child pipeline could fail to be created in certain cases, causing the parent pipeline to fail.
This is [resolved in GitLab 12.10](https://gitlab.com/gitlab-org/gitlab/-/issues/209070).
## Nested child pipelines
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/29651) in GitLab 13.4.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/243747) in GitLab 13.5.
Parent and child pipelines were introduced with a maximum depth of one level of child
pipelines, which was later increased to two. A parent pipeline can trigger many child
pipelines, and these child pipelines can trigger their own child pipelines. It's not
possible to trigger another level of child pipelines.
<i class="fa fa-youtube-play youtube" aria-hidden="true"></i>
For an overview, see [Nested Dynamic Pipelines](https://youtu.be/C5j3ju9je2M).
## Pass CI/CD variables to a child pipeline
You can pass CI/CD variables to a downstream pipeline using the same methods as
multi-project pipelines:
- [By using the `variable` keyword](multi_project_pipelines.md#pass-cicd-variables-to-a-downstream-pipeline-by-using-the-variables-keyword).
- [By using variable inheritance](multi_project_pipelines.md#pass-cicd-variables-to-a-downstream-pipeline-by-using-variable-inheritance).
<!-- This redirect file can be deleted after 2021-09-29. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -50,8 +50,8 @@ Pipelines can be configured in many different ways:
followed by the next stage.
- [Directed Acyclic Graph Pipeline (DAG) pipelines](../directed_acyclic_graph/index.md) are based on relationships
between jobs and can run more quickly than basic pipelines.
- [Multi-project pipelines](../multi_project_pipelines.md) combine pipelines for different projects together.
- [Parent-Child pipelines](../parent_child_pipelines.md) break down complex pipelines
- [Multi-project pipelines](multi_project_pipelines.md) combine pipelines for different projects together.
- [Parent-Child pipelines](parent_child_pipelines.md) break down complex pipelines
into one parent pipeline that can trigger multiple child sub-pipelines, which all
run in the same project and with the same SHA.
- [Pipelines for Merge Requests](../pipelines/merge_request_pipelines.md) run for merge
@ -349,7 +349,7 @@ You can group the jobs by:
- [Job dependencies](#view-job-dependencies-in-the-pipeline-graph), which arranges
jobs based on their [`needs`](../yaml/index.md#needs) dependencies.
[Multi-project pipeline graphs](../multi_project_pipelines.md#multi-project-pipeline-visualization) help
[Multi-project pipeline graphs](multi_project_pipelines.md#multi-project-pipeline-visualization) help
you visualize the entire pipeline, including all cross-project inter-dependencies. **(PREMIUM)**
### View job dependencies in the pipeline graph

Some files were not shown because too many files have changed in this diff Show More