Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-10 21:10:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-10 21:10:05 +0300
commitd715acda3b27b7ca9eacbd058d7cb9629638c52d (patch)
treea6a6a51f69950ca6fa19d55d22a574e571bc8cf5 /app
parentbe1b7b709e957f83b076d05c9672ab2ab5ff1940 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue44
-rw-r--r--app/assets/javascripts/pipeline_editor/components/drawer/ui/pipeline_visual_reference.vue43
-rw-r--r--app/assets/javascripts/pipeline_editor/constants.js2
-rw-r--r--app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql7
-rw-r--r--app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue28
-rw-r--r--app/helpers/form_helper.rb28
-rw-r--r--app/models/commit.rb6
-rw-r--r--app/models/concerns/cache_markdown_field.rb3
-rw-r--r--app/services/github.rb4
-rw-r--r--app/workers/all_queues.yml3
-rw-r--r--app/workers/ci/pipeline_artifacts/coverage_report_worker.rb1
11 files changed, 80 insertions, 89 deletions
diff --git a/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue b/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue
index 22c1563350d..a8ad56ab6a5 100644
--- a/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue
+++ b/app/assets/javascripts/pipeline_editor/components/drawer/cards/first_pipeline_card.vue
@@ -1,20 +1,22 @@
<script>
import { GlCard, GlLink, GlSprintf } from '@gitlab/ui';
import { s__ } from '~/locale';
-import PipelineVisualReference from '../ui/pipeline_visual_reference.vue';
export default {
i18n: {
title: s__('PipelineEditorTutorial|🚀 Run your first pipeline'),
firstParagraph: s__(
- 'PipelineEditorTutorial|A typical GitLab pipeline consists of three stages: build, test and deploy. Each stage can have one or more jobs.',
- ),
- secondParagraph: s__(
- 'PipelineEditorTutorial|In the example below, %{codeStart}build%{codeEnd} and %{codeStart}deploy%{codeEnd} each contain one job, and %{codeStart}test%{codeEnd} contains two jobs. Your scripts run in jobs like these.',
- ),
- thirdParagraph: s__(
- 'PipelineEditorTutorial|You can use %{linkStart}CI/CD examples and templates%{linkEnd} to get your first %{codeStart}.gitlab-ci.yml%{codeEnd} configuration file started. Your first pipeline runs when you commit the changes.',
+ 'PipelineEditorTutorial|This template creates a simple test pipeline. To use it:',
),
+ listItems: [
+ s__(
+ 'PipelineEditorTutorial|Commit the file to your repository. The pipeline then runs automatically.',
+ ),
+ s__('PipelineEditorTutorial|The pipeline status is at the top of the page.'),
+ s__(
+ 'PipelineEditorTutorial|Select the pipeline ID to view the full details about your first pipeline run.',
+ ),
+ ],
note: s__(
'PipelineEditorTutorial|If you’re using a self-managed GitLab instance, %{linkStart}make sure your instance has runners available.%{linkEnd}',
),
@@ -23,9 +25,8 @@ export default {
GlCard,
GlLink,
GlSprintf,
- PipelineVisualReference,
},
- inject: ['ciExamplesHelpPagePath', 'runnerHelpPagePath'],
+ inject: ['runnerHelpPagePath'],
};
</script>
<template>
@@ -33,26 +34,9 @@ export default {
<template #default>
<h4 class="gl-font-lg gl-mt-0">{{ $options.i18n.title }}</h4>
<p class="gl-mb-3">{{ $options.i18n.firstParagraph }}</p>
- <p class="gl-mb-3">
- <gl-sprintf :message="$options.i18n.secondParagraph">
- <template #code="{ content }">
- <code>{{ content }}</code>
- </template>
- </gl-sprintf>
- </p>
- <pipeline-visual-reference />
- <p class="gl-my-3">
- <gl-sprintf :message="$options.i18n.thirdParagraph">
- <template #link="{ content }">
- <gl-link :href="ciExamplesHelpPagePath" target="_blank">
- {{ content }}
- </gl-link>
- </template>
- <template #code="{ content }">
- <code>{{ content }}</code>
- </template>
- </gl-sprintf>
- </p>
+ <ol class="gl-mb-3">
+ <li v-for="(item, i) in $options.i18n.listItems" :key="`li-${i}`">{{ item }}</li>
+ </ol>
<p class="gl-mb-0">
<gl-sprintf :message="$options.i18n.note">
<template #link="{ content }">
diff --git a/app/assets/javascripts/pipeline_editor/components/drawer/ui/pipeline_visual_reference.vue b/app/assets/javascripts/pipeline_editor/components/drawer/ui/pipeline_visual_reference.vue
deleted file mode 100644
index 1017237365b..00000000000
--- a/app/assets/javascripts/pipeline_editor/components/drawer/ui/pipeline_visual_reference.vue
+++ /dev/null
@@ -1,43 +0,0 @@
-<script>
-import { s__ } from '~/locale';
-import DemoJobPill from './demo_job_pill.vue';
-
-export default {
- i18n: {
- stageNames: {
- build: s__('StageName|Build'),
- test: s__('StageName|Test'),
- deploy: s__('StageName|Deploy'),
- },
- jobNames: {
- build: s__('JobName|build-job'),
- test_1: s__('JobName|unit-test'),
- test_2: s__('JobName|lint-test'),
- deploy: s__('JobName|deploy-app'),
- },
- },
- stageClasses:
- 'gl-bg-blue-50 gl-display-flex gl-flex-direction-column gl-align-items-center gl-p-4 gl-rounded-base',
- titleClasses: 'gl-text-blue-600 gl-mb-4',
- components: {
- DemoJobPill,
- },
-};
-</script>
-<template>
- <div class="gl-display-flex gl-justify-content-center">
- <div :class="$options.stageClasses" class="gl-mr-5">
- <div :class="$options.titleClasses">{{ $options.i18n.stageNames.build }}</div>
- <demo-job-pill :job-name="$options.i18n.jobNames.build" />
- </div>
- <div :class="$options.stageClasses" class="gl-mr-5">
- <div :class="$options.titleClasses">{{ $options.i18n.stageNames.test }}</div>
- <demo-job-pill class="gl-mb-3" :job-name="$options.i18n.jobNames.test_1" />
- <demo-job-pill :job-name="$options.i18n.jobNames.test_2" />
- </div>
- <div :class="$options.stageClasses">
- <div :class="$options.titleClasses">{{ $options.i18n.stageNames.deploy }}</div>
- <demo-job-pill :job-name="$options.i18n.jobNames.deploy" />
- </div>
- </div>
-</template>
diff --git a/app/assets/javascripts/pipeline_editor/constants.js b/app/assets/javascripts/pipeline_editor/constants.js
index f0a24e0c061..1467abd7289 100644
--- a/app/assets/javascripts/pipeline_editor/constants.js
+++ b/app/assets/javascripts/pipeline_editor/constants.js
@@ -31,3 +31,5 @@ export const DRAWER_EXPANDED_KEY = 'pipeline_editor_drawer_expanded';
export const BRANCH_PAGINATION_LIMIT = 20;
export const BRANCH_SEARCH_DEBOUNCE = '500';
+
+export const STARTER_TEMPLATE_NAME = 'Getting-Started';
diff --git a/app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql b/app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql
new file mode 100644
index 00000000000..88825718f7b
--- /dev/null
+++ b/app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql
@@ -0,0 +1,7 @@
+query getTemplate($projectPath: ID!, $templateName: String!) {
+ project(fullPath: $projectPath) {
+ ciTemplate(name: $templateName) {
+ content
+ }
+ }
+}
diff --git a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
index 1ec4ee522d6..d900cfcdf2b 100644
--- a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
+++ b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
@@ -14,12 +14,14 @@ import {
EDITOR_APP_STATUS_ERROR,
EDITOR_APP_STATUS_LOADING,
LOAD_FAILURE_UNKNOWN,
+ STARTER_TEMPLATE_NAME,
} from './constants';
import getBlobContent from './graphql/queries/blob_content.graphql';
import getCiConfigData from './graphql/queries/ci_config.graphql';
import getAppStatus from './graphql/queries/client/app_status.graphql';
import getCurrentBranch from './graphql/queries/client/current_branch.graphql';
import getIsNewCiConfigFile from './graphql/queries/client/is_new_ci_config_file.graphql';
+import getTemplate from './graphql/queries/get_starter_template.query.graphql';
import PipelineEditorHome from './pipeline_editor_home.vue';
export default {
@@ -51,12 +53,13 @@ export default {
showStartScreen: false,
showSuccess: false,
showFailure: false,
+ starterTemplate: '',
};
},
apollo: {
initialCiFileContent: {
- fetchPolicy: fetchPolicies.NETWORK,
+ fetchPolicy: fetchPolicies.NETWORK_ONLY,
query: getBlobContent,
// If it's a brand new file, we don't want to fetch the content.
// Then when the user commits the first time, the query would run
@@ -135,6 +138,24 @@ export default {
isNewCiConfigFile: {
query: getIsNewCiConfigFile,
},
+ starterTemplate: {
+ query: getTemplate,
+ variables() {
+ return {
+ projectPath: this.projectFullPath,
+ templateName: STARTER_TEMPLATE_NAME,
+ };
+ },
+ skip({ isNewCiConfigFile }) {
+ return !isNewCiConfigFile;
+ },
+ update(data) {
+ return data.project?.ciTemplate?.content || '';
+ },
+ error() {
+ this.reportFailure(LOAD_FAILURE_UNKNOWN);
+ },
+ },
},
computed: {
hasUnsavedChanges() {
@@ -149,6 +170,9 @@ export default {
isEmpty() {
return this.currentCiFileContent === '';
},
+ templateOrCurrentContent() {
+ return this.isNewCiConfigFile ? this.starterTemplate : this.currentCiFileContent;
+ },
},
i18n: {
tabEdit: s__('Pipelines|Edit'),
@@ -256,7 +280,7 @@ export default {
/>
<pipeline-editor-home
:ci-config-data="ciConfigData"
- :ci-file-content="currentCiFileContent"
+ :ci-file-content="templateOrCurrentContent"
:is-new-ci-config-file="isNewCiConfigFile"
@commit="updateOnCommit"
@resetContent="resetContent"
diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb
index cf3e99eee49..9b4d0c0b9b3 100644
--- a/app/helpers/form_helper.rb
+++ b/app/helpers/form_helper.rb
@@ -2,19 +2,29 @@
module FormHelper
def form_errors(model, type: 'form', truncate: [])
- return unless model.errors.any?
+ errors = model.errors
+
+ return unless errors.any?
+
+ headline = n_(
+ 'The %{type} contains the following error:',
+ 'The %{type} contains the following errors:',
+ errors.count
+ ) % { type: type }
- headline = n_('The %{type} contains the following error:', 'The %{type} contains the following errors:', model.errors.count) % { type: type }
truncate = Array.wrap(truncate)
- content_tag(:div, class: 'alert alert-danger', id: 'error_explanation') do
- content_tag(:h4, headline) <<
- content_tag(:ul) do
- messages = model.errors.map do |attribute, message|
- message = html_escape_once(model.errors.full_message(attribute, message)).html_safe
- message = content_tag(:span, message, class: 'str-truncated-100') if truncate.include?(attribute)
+ tag.div(class: 'alert alert-danger', id: 'error_explanation') do
+ tag.h4(headline) <<
+ tag.ul do
+ messages = errors.map do |error|
+ attribute = error.attribute
+ message = error.message
+
+ message = html_escape_once(errors.full_message(attribute, message)).html_safe
+ message = tag.span(message, class: 'str-truncated-100') if truncate.include?(attribute)
- content_tag(:li, message)
+ tag.li(message)
end
messages.join.html_safe
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 09e43bb8f20..69527c114d5 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -15,8 +15,6 @@ class Commit
include ActsAsPaginatedDiff
include CacheMarkdownField
- attr_mentionable :safe_message, pipeline: :single_line
-
participant :author
participant :committer
participant :notes_with_associations
@@ -39,6 +37,10 @@ class Commit
cache_markdown_field :full_title, pipeline: :single_line, limit: 1.kilobyte
cache_markdown_field :description, pipeline: :commit_description, limit: 1.megabyte
+ # Share the cache used by the markdown fields
+ attr_mentionable :full_title, pipeline: :single_line, limit: 1.kilobyte
+ attr_mentionable :description, pipeline: :commit_description, limit: 1.megabyte
+
class << self
def decorate(commits, container)
commits.map do |commit|
diff --git a/app/models/concerns/cache_markdown_field.rb b/app/models/concerns/cache_markdown_field.rb
index 87a1bb877ae..101bff32dfe 100644
--- a/app/models/concerns/cache_markdown_field.rb
+++ b/app/models/concerns/cache_markdown_field.rb
@@ -157,6 +157,9 @@ module CacheMarkdownField
end
def store_mentions!
+ # We can only store mentions if the mentionable is a database object
+ return unless self.is_a?(ApplicationRecord)
+
refs = all_references(self.author)
references = {}
diff --git a/app/services/github.rb b/app/services/github.rb
new file mode 100644
index 00000000000..e76e7351ab9
--- /dev/null
+++ b/app/services/github.rb
@@ -0,0 +1,4 @@
+# frozen_string_literal: true
+
+module Github
+end
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml
index f3fe5c69a0c..8f6b795b2ed 100644
--- a/app/workers/all_queues.yml
+++ b/app/workers/all_queues.yml
@@ -1373,8 +1373,7 @@
:resource_boundary: :unknown
:weight: 1
:idempotent: true
- :tags:
- - :exclude_from_kubernetes
+ :tags: []
- :name: pipeline_background:ci_pipeline_artifacts_create_quality_report
:worker_name: Ci::PipelineArtifacts::CreateQualityReportWorker
:feature_category: :code_testing
diff --git a/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb b/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb
index dd7bfff4eb1..ec0cb69d0c7 100644
--- a/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb
+++ b/app/workers/ci/pipeline_artifacts/coverage_report_worker.rb
@@ -9,7 +9,6 @@ module Ci
include PipelineBackgroundQueue
feature_category :code_testing
- tags :exclude_from_kubernetes
idempotent!