Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-02-09 09:09:19 +00:00
parent 43d38aaae0
commit e7462f7b49
77 changed files with 1389 additions and 605 deletions

View File

@ -0,0 +1,5 @@
query getKeepLatestArtifactApplicationSetting {
ciApplicationSettings {
keepLatestArtifact
}
}

View File

@ -2,12 +2,22 @@
import { GlAlert, GlFormCheckbox, GlLink } from '@gitlab/ui';
import { __ } from '~/locale';
import GetKeepLatestArtifactProjectSetting from './graphql/queries/get_keep_latest_artifact_project_setting.query.graphql';
import GetKeepLatestArtifactApplicationSetting from './graphql/queries/get_keep_latest_artifact_application_setting.query.graphql';
import UpdateKeepLatestArtifactProjectSetting from './graphql/mutations/update_keep_latest_artifact_project_setting.mutation.graphql';
const FETCH_ERROR = __('There was a problem fetching the keep latest artifact setting.');
const UPDATE_ERROR = __('There was a problem updating the keep latest artifact setting.');
export default {
errors: {
fetchError: __('There was a problem fetching the keep latest artifacts setting.'),
updateError: __('There was a problem updating the keep latest artifacts setting.'),
},
i18n: {
enabledHelpText: __(
'The latest artifacts created by jobs in the most recent successful pipeline will be stored.',
),
disabledHelpText: __('This feature is disabled at the instance level.'),
helpLinkText: __('More information'),
checkboxText: __('Keep artifacts from most recent successful jobs'),
},
components: {
GlAlert,
GlFormCheckbox,
@ -33,21 +43,33 @@ export default {
return data.project?.ciCdSettings?.keepLatestArtifact;
},
error() {
this.reportError(FETCH_ERROR);
this.reportError(this.$options.errors.fetchError);
},
},
projectSettingDisabled: {
query: GetKeepLatestArtifactApplicationSetting,
update(data) {
return !data.ciApplicationSettings?.keepLatestArtifact;
},
},
},
data() {
return {
keepLatestArtifact: true,
keepLatestArtifact: null,
errorMessage: '',
isAlertDismissed: false,
projectSettingDisabled: true,
};
},
computed: {
shouldShowAlert() {
return this.errorMessage && !this.isAlertDismissed;
},
helpText() {
return this.projectSettingDisabled
? this.$options.i18n.disabledHelpText
: this.$options.i18n.enabledHelpText;
},
},
methods: {
reportError(error) {
@ -65,10 +87,10 @@ export default {
});
if (data.ciCdSettingsUpdate.errors.length) {
this.reportError(UPDATE_ERROR);
this.reportError(this.$options.errors.updateError);
}
} catch (error) {
this.reportError(UPDATE_ERROR);
this.reportError(this.$options.errors.updateError);
}
},
},
@ -84,16 +106,13 @@ export default {
@dismiss="isAlertDismissed = true"
>{{ errorMessage }}</gl-alert
>
<gl-form-checkbox v-model="keepLatestArtifact" @change="updateSetting"
><b class="gl-mr-3">{{ __('Keep artifacts from most recent successful jobs') }}</b>
<gl-link :href="helpPagePath">{{ __('More information') }}</gl-link></gl-form-checkbox
>
<p>
{{
__(
'The latest artifacts created by jobs in the most recent successful pipeline will be stored.',
)
}}
</p>
<gl-form-checkbox
v-model="keepLatestArtifact"
:disabled="projectSettingDisabled"
@change="updateSetting"
><strong class="gl-mr-3">{{ $options.i18n.checkboxText }}</strong>
<gl-link :href="helpPagePath">{{ $options.i18n.helpLinkText }}</gl-link>
<template v-if="!$apollo.loading" #help>{{ helpText }}</template>
</gl-form-checkbox>
</div>
</template>

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
module Types
module Ci
class ApplicationSettingType < BaseObject
graphql_name 'CiApplicationSettings'
authorize :read_application_setting
field :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether to keep the latest jobs artifacts.'
end
end
end

View File

@ -14,7 +14,8 @@ module Types
description: 'Whether merge trains are enabled.',
method: :merge_trains_enabled?
field :keep_latest_artifact, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether to keep the latest builds artifacts.'
description: 'Whether to keep the latest builds artifacts.',
method: :keep_latest_artifacts_available?
field :project, Types::ProjectType, null: true,
description: 'Project the CI/CD settings belong to.'
end

View File

@ -87,6 +87,10 @@ module Types
description: 'Get statistics on the instance.',
resolver: Resolvers::Admin::Analytics::InstanceStatistics::MeasurementsResolver
field :ci_application_settings, Types::Ci::ApplicationSettingType,
null: true,
description: 'CI related settings that apply to the entire instance.'
field :runner_platforms, Types::Ci::RunnerPlatformType.connection_type,
null: true, description: 'Supported runner platforms.',
resolver: Resolvers::Ci::RunnerPlatformsResolver
@ -128,6 +132,14 @@ module Types
def current_user
context[:current_user]
end
def ci_application_settings
application_settings
end
def application_settings
Gitlab::CurrentSettings.current_application_settings
end
end
end

View File

@ -339,7 +339,8 @@ module ApplicationSettingsHelper
:container_registry_delete_tags_service_timeout,
:rate_limiting_response_text,
:container_registry_expiration_policies_worker_capacity,
:container_registry_cleanup_tags_service_max_list_size
:container_registry_cleanup_tags_service_max_list_size,
:keep_latest_artifact
]
end

View File

@ -525,6 +525,10 @@ class ApplicationSetting < ApplicationRecord
current_without_cache
end
def self.find_or_create_without_cache
current_without_cache || create_from_defaults
end
# Due to the frequency with which settings are accessed, it is
# likely that during a backup restore a running GitLab process
# will insert a new `application_settings` row before the

View File

@ -411,7 +411,7 @@ class Project < ApplicationRecord
delegate :dashboard_timezone, to: :metrics_setting, allow_nil: true, prefix: true
delegate :default_git_depth, :default_git_depth=, to: :ci_cd_settings, prefix: :ci
delegate :forward_deployment_enabled, :forward_deployment_enabled=, :forward_deployment_enabled?, to: :ci_cd_settings, prefix: :ci
delegate :keep_latest_artifact, :keep_latest_artifact=, :keep_latest_artifact?, to: :ci_cd_settings, prefix: :ci
delegate :keep_latest_artifact, :keep_latest_artifact=, :keep_latest_artifact?, :keep_latest_artifacts_available?, to: :ci_cd_settings
delegate :restrict_user_defined_variables, :restrict_user_defined_variables=, :restrict_user_defined_variables?,
to: :ci_cd_settings
delegate :actual_limits, :actual_plan_name, to: :namespace, allow_nil: true
@ -837,8 +837,12 @@ class Project < ApplicationRecord
webide_pipelines.running_or_pending.for_user(user)
end
def latest_pipeline_locked
ci_keep_latest_artifact? ? :artifacts_locked : :unlocked
def default_pipeline_lock
if keep_latest_artifacts_available?
return :artifacts_locked
end
:unlocked
end
def autoclose_referenced_issues

View File

@ -21,6 +21,11 @@ class ProjectCiCdSetting < ApplicationRecord
super && ::Feature.enabled?(:forward_deployment_enabled, project, default_enabled: true)
end
def keep_latest_artifacts_available?
# The project level feature can only be enabled when the feature is enabled instance wide
Gitlab::CurrentSettings.current_application_settings.keep_latest_artifact? && keep_latest_artifact?
end
private
def set_default_git_depth

View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
class ApplicationSettingPolicy < BasePolicy # rubocop:disable Gitlab/NamespacedClass
rule { admin }.enable :read_application_setting
end

View File

@ -41,6 +41,14 @@
.form-text.text-muted
= html_escape(_("Set the default expiration time for each job's artifacts. 0 for unlimited. The default unit is in seconds, but you can define an alternative. For example: %{code_open}4 mins 2 sec%{code_close}, %{code_open}2h42min%{code_close}.")) % { code_open: '<code>'.html_safe, code_close: '</code>'.html_safe }
= link_to sprite_icon('question-o'), help_page_path('user/admin_area/settings/continuous_integration', anchor: 'default-artifacts-expiration')
.form-group
.form-check
= f.check_box :keep_latest_artifact, class: 'form-check-input'
= f.label :keep_latest_artifact, class: 'form-check-label' do
%strong
= s_('AdminSettings|Keep the latest artifacts for all jobs in the latest successful pipelines')
.form-text.text-muted
= s_('AdminSettings|The latest artifacts for all jobs in the most recent successful pipelines in each project are stored and do not expire.')
.form-group
= f.label :archive_builds_in_human_readable, _('Archive jobs'), class: 'label-bold'
= f.text_field :archive_builds_in_human_readable, class: 'form-control gl-form-input', placeholder: 'never'
@ -51,8 +59,8 @@
= f.check_box :protected_ci_variables, class: 'form-check-input'
= f.label :protected_ci_variables, class: 'form-check-label' do
= s_('AdminSettings|Environment variables are protected by default')
.form-text.text-muted
= s_('AdminSettings|When creating a new environment variable it will be protected by default.')
.form-text.text-muted
= s_('AdminSettings|When creating a new environment variable it will be protected by default.')
.form-group
= f.label :ci_config_path, _('Default CI configuration path'), class: 'label-bold'
= f.text_field :default_ci_config_path, class: 'form-control gl-form-input', placeholder: '.gitlab-ci.yml'

View File

@ -3,7 +3,7 @@
%h4
= _('Variables')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p

View File

@ -8,4 +8,4 @@
%span.input-group-append
= clipboard_button(text: push_to_create_project_command, title: _("Copy command"), class: 'input-group-text', placement: "right")
%p
= link_to("What does this command do?", help_page_path("gitlab-basics/create-project", anchor: "push-to-create-a-new-project"), target: "_blank")
= link_to("What does this command do?", help_page_path("user/project/working_with_projects", anchor: "push-to-create-a-new-project"), target: "_blank")

View File

@ -28,7 +28,7 @@
%p
%strong= _("Tip:")
= _("You can also create a project from the command line.")
%a.push-new-project-tip{ data: { title: _("Push to create a project") }, href: help_page_path('gitlab-basics/create-project', anchor: 'push-to-create-a-new-project'), target: "_blank", rel: "noopener noreferrer" }
%a.push-new-project-tip{ data: { title: _("Push to create a project") }, href: help_page_path('user/project/working_with_projects', anchor: 'push-to-create-a-new-project'), target: "_blank", rel: "noopener noreferrer" }
= _("Show command")
%template.push-new-project-tip-template= render partial: "new_project_push_tip"

View File

@ -54,4 +54,4 @@
= s_('CICD|Automatic deployment to staging, manual deployment to production')
= link_to sprite_icon('question-o'), help_page_path('topics/autodevops/customize.md', anchor: 'incremental-rollout-to-production'), target: '_blank'
= f.submit _('Save changes'), class: "btn btn-success gl-mt-5", data: { qa_selector: 'save_changes_button' }
= f.submit _('Save changes'), class: "btn gl-button btn-success gl-mt-5", data: { qa_selector: 'save_changes_button' }

View File

@ -9,7 +9,7 @@
.settings-header
%h4
= _("General pipelines")
%button.btn.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("Customize your pipeline configuration and coverage report.")
@ -20,7 +20,7 @@
.settings-header
%h4
= s_('CICD|Auto DevOps')
%button.btn.btn-default.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
- auto_devops_url = help_page_path('topics/autodevops/index')
@ -37,7 +37,7 @@
.settings-header
%h4
= _("Runners")
%button.btn.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("Runners are processes that pick up and execute CI/CD jobs for GitLab.")
@ -49,7 +49,7 @@
.settings-header
%h4
= _("Artifacts")
%button.btn.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("A job artifact is an archive of files and directories saved by a job when it finishes.")
@ -66,7 +66,7 @@
.settings-header
%h4
= _("Pipeline triggers")
%button.btn.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("Trigger a pipeline for a branch or tag by generating a trigger token and using it with an API call. The token impersonates a user's project access and permissions.")
@ -79,7 +79,7 @@
.settings-header
%h4
= _("Clean up image tags")
%button.btn.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("Save space and find images in the Container Registry. Remove unneeded tags and keep only the ones you want.")
@ -94,7 +94,7 @@
.settings-header
%h4
= _("Deploy freezes")
%button.btn.js-settings-toggle{ type: 'button' }
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
- freeze_period_docs = help_page_path('user/project/releases/index', anchor: 'prevent-unintentional-releases-by-setting-a-deploy-freeze')

View File

@ -0,0 +1,5 @@
---
title: Add keep latest artifact option for instances
merge_request: 50889
author:
type: added

View File

@ -0,0 +1,5 @@
---
title: Apply new GitLab UI for toggle buttons in CI/CD settings page
merge_request: 53556
author: Yogi (@yo)
type: other

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class AddKeepLatestArtifactsToApplicationSettings < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
# This is named keep_latest_artifact for consistency with the project level setting but
# turning it on keeps all (multiple) artifacts on the latest pipeline per ref
add_column :application_settings, :keep_latest_artifact, :boolean, default: true, null: false
end
end

View File

@ -0,0 +1 @@
a0561e52982756aded22563e833ab8005b4f45b84c81e872dd8c7188aeb84434

View File

@ -9412,6 +9412,7 @@ CREATE TABLE application_settings (
enforce_ssh_key_expiration boolean DEFAULT false NOT NULL,
git_two_factor_session_expiry integer DEFAULT 15 NOT NULL,
asset_proxy_allowlist text,
keep_latest_artifact boolean DEFAULT true NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
CONSTRAINT check_17d9558205 CHECK ((char_length((kroki_url)::text) <= 1024)),

View File

@ -1161,7 +1161,7 @@ Confirm the following are all true:
- When any user adds or modifies a file from the repository using the GitLab
UI, it immediately fails with a red `401 Unauthorized` banner.
- Creating a new project and [initializing it with a README](../../gitlab-basics/create-project.md#blank-projects)
- Creating a new project and [initializing it with a README](../../user/project/working_with_projects.md#blank-projects)
successfully creates the project, but doesn't create the README.
- When [tailing the logs](https://docs.gitlab.com/omnibus/settings/logs.html#tail-logs-in-a-console-on-the-server)
on a Gitaly client and reproducing the error, you get `401` errors

View File

@ -298,7 +298,7 @@ Confirm the following are all true:
- When any user adds or modifies a file from the repository using the GitLab
UI, it immediately fails with a red `401 Unauthorized` banner.
- Creating a new project and [initializing it with a README](../../gitlab-basics/create-project.md#blank-projects)
- Creating a new project and [initializing it with a README](../../user/project/working_with_projects.md#blank-projects)
successfully creates the project but doesn't create the README.
- When [tailing the logs](https://docs.gitlab.com/omnibus/settings/logs.html#tail-logs-in-a-console-on-the-server) on an app node and reproducing the error, you get `401` errors
when reaching the `/api/v4/internal/allowed` endpoint:

View File

@ -1077,6 +1077,56 @@ Identifier of Analytics::DevopsAdoption::Segment.
"""
scalar AnalyticsDevopsAdoptionSegmentID
"""
Data associated with configuring API fuzzing scans in GitLab CI
"""
type ApiFuzzingCiConfiguration {
"""
All available scan modes.
"""
scanModes: [ApiFuzzingScanMode!]
"""
All default scan profiles.
"""
scanProfiles: [ApiFuzzingScanProfile!]
}
"""
All possible ways to specify the API surface for an API fuzzing scan
"""
enum ApiFuzzingScanMode {
"""
The API surface is specified by a HAR file.
"""
HAR
"""
The API surface is specified by a OPENAPI file.
"""
OPENAPI
}
"""
An API Fuzzing scan profile.
"""
type ApiFuzzingScanProfile {
"""
A short description of the profile.
"""
description: String
"""
The unique name of the profile.
"""
name: String
"""
A syntax highlit HTML representation of the YAML.
"""
yaml: String
}
"""
User availability status
"""
@ -2483,6 +2533,13 @@ type BurnupChartDailyTotals {
scopeWeight: Int!
}
type CiApplicationSettings {
"""
Whether to keep the latest jobs artifacts.
"""
keepLatestArtifact: Boolean
}
type CiBuildNeed {
"""
Name of the job we need to complete.
@ -18465,6 +18522,11 @@ type Project {
"""
allowMergeOnSkippedPipeline: Boolean
"""
API fuzzing configuration for the project. Available only when feature flag `api_fuzzing_configuration_ui` is enabled.
"""
apiFuzzingCiConfiguration: ApiFuzzingCiConfiguration
"""
Indicates the archived status of the project.
"""
@ -20843,6 +20905,11 @@ type PromoteToEpicPayload {
}
type Query {
"""
CI related settings that apply to the entire instance.
"""
ciApplicationSettings: CiApplicationSettings
"""
Get linted and processed contents of a CI config. Should not be requested more than once per request.
"""

View File

@ -2678,6 +2678,141 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "ApiFuzzingCiConfiguration",
"description": "Data associated with configuring API fuzzing scans in GitLab CI",
"fields": [
{
"name": "scanModes",
"description": "All available scan modes.",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "ApiFuzzingScanMode",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "scanProfiles",
"description": "All default scan profiles.",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "ApiFuzzingScanProfile",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "ApiFuzzingScanMode",
"description": "All possible ways to specify the API surface for an API fuzzing scan",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "HAR",
"description": "The API surface is specified by a HAR file.",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "OPENAPI",
"description": "The API surface is specified by a OPENAPI file.",
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "ApiFuzzingScanProfile",
"description": "An API Fuzzing scan profile.",
"fields": [
{
"name": "description",
"description": "A short description of the profile.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": "The unique name of the profile.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "yaml",
"description": "A syntax highlit HTML representation of the YAML.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "ENUM",
"name": "AvailabilityEnum",
@ -6546,6 +6681,33 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "CiApplicationSettings",
"description": null,
"fields": [
{
"name": "keepLatestArtifact",
"description": "Whether to keep the latest jobs artifacts.",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "CiBuildNeed",
@ -54452,6 +54614,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "apiFuzzingCiConfiguration",
"description": "API fuzzing configuration for the project. Available only when feature flag `api_fuzzing_configuration_ui` is enabled.",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "ApiFuzzingCiConfiguration",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "archived",
"description": "Indicates the archived status of the project.",
@ -60658,6 +60834,20 @@
"name": "Query",
"description": null,
"fields": [
{
"name": "ciApplicationSettings",
"description": "CI related settings that apply to the entire instance.",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "CiApplicationSettings",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "ciConfig",
"description": "Get linted and processed contents of a CI config. Should not be requested more than once per request.",

View File

@ -180,6 +180,25 @@ Autogenerated return type of AlertTodoCreate.
| `issue` | Issue | The issue created after mutation. |
| `todo` | Todo | The to-do item after mutation. |
### ApiFuzzingCiConfiguration
Data associated with configuring API fuzzing scans in GitLab CI.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `scanModes` | ApiFuzzingScanMode! => Array | All available scan modes. |
| `scanProfiles` | ApiFuzzingScanProfile! => Array | All default scan profiles. |
### ApiFuzzingScanProfile
An API Fuzzing scan profile..
| Field | Type | Description |
| ----- | ---- | ----------- |
| `description` | String | A short description of the profile. |
| `name` | String | The unique name of the profile. |
| `yaml` | String | A syntax highlit HTML representation of the YAML. |
### AwardEmoji
An emoji awarded by a user.
@ -388,6 +407,12 @@ Represents the total number of issues and their weights for a particular day.
| `scopeCount` | Int! | Number of issues as of this day |
| `scopeWeight` | Int! | Total weight of issues as of this day |
### CiApplicationSettings
| Field | Type | Description |
| ----- | ---- | ----------- |
| `keepLatestArtifact` | Boolean | Whether to keep the latest jobs artifacts. |
### CiBuildNeed
| Field | Type | Description |
@ -2800,6 +2825,7 @@ Autogenerated return type of PipelineRetry.
| `alertManagementIntegrations` | AlertManagementIntegrationConnection | Integrations which can receive alerts for the project. |
| `alertManagementPayloadFields` | AlertManagementPayloadAlertField! => Array | Extract alert fields from payload for custom mapping |
| `allowMergeOnSkippedPipeline` | Boolean | If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs. |
| `apiFuzzingCiConfiguration` | ApiFuzzingCiConfiguration | API fuzzing configuration for the project. Available only when feature flag `api_fuzzing_configuration_ui` is enabled. |
| `archived` | Boolean | Indicates the archived status of the project. |
| `autocloseReferencedIssues` | Boolean | Indicates if issues referenced by merge requests and commits within the default branch are closed automatically. |
| `avatarUrl` | String | URL to avatar image file of the project. |
@ -4575,6 +4601,15 @@ Alert status values.
| `RESOLVED` | Resolved status |
| `TRIGGERED` | Triggered status |
### ApiFuzzingScanMode
All possible ways to specify the API surface for an API fuzzing scan.
| Value | Description |
| ----- | ----------- |
| `HAR` | The API surface is specified by a HAR file. |
| `OPENAPI` | The API surface is specified by a OPENAPI file. |
### AvailabilityEnum
User availability status.

View File

@ -1104,7 +1104,7 @@ POST /projects
| `snippets_access_level` | string | **{dotted-circle}** No | One of `disabled`, `private`, or `enabled`. |
| `snippets_enabled` | boolean | **{dotted-circle}** No | _(Deprecated)_ Enable snippets for this project. Use `snippets_access_level` instead. |
| `tag_list` | array | **{dotted-circle}** No | The list of tags for a project; put array of tags, that should be finally assigned to a project. |
| `template_name` | string | **{dotted-circle}** No | When used without `use_custom_template`, name of a [built-in project template](../gitlab-basics/create-project.md#built-in-templates). When used with `use_custom_template`, name of a custom project template. |
| `template_name` | string | **{dotted-circle}** No | When used without `use_custom_template`, name of a [built-in project template](../user/project/working_with_projects.md#built-in-templates). When used with `use_custom_template`, name of a custom project template. |
| `template_project_id` **(PREMIUM)** | integer | **{dotted-circle}** No | When used with `use_custom_template`, project ID of a custom project template. This is preferable to using `template_name` since `template_name` may be ambiguous. |
| `use_custom_template` **(PREMIUM)** | boolean | **{dotted-circle}** No | Use either custom [instance](../user/admin_area/custom_project_templates.md) or [group](../user/group/custom_project_templates.md) (with `group_with_project_templates_id`) project template. |
| `visibility` | string | **{dotted-circle}** No | See [project visibility level](#project-visibility-level). |
@ -1177,7 +1177,7 @@ POST /projects/user/:user_id
| `snippets_enabled` | boolean | **{dotted-circle}** No | _(Deprecated)_ Enable snippets for this project. Use `snippets_access_level` instead. |
| `suggestion_commit_message` | string | **{dotted-circle}** No | The commit message used to apply merge request suggestions. |
| `tag_list` | array | **{dotted-circle}** No | The list of tags for a project; put array of tags, that should be finally assigned to a project. |
| `template_name` | string | **{dotted-circle}** No | When used without `use_custom_template`, name of a [built-in project template](../gitlab-basics/create-project.md#built-in-templates). When used with `use_custom_template`, name of a custom project template. |
| `template_name` | string | **{dotted-circle}** No | When used without `use_custom_template`, name of a [built-in project template](../user/project/working_with_projects.md#built-in-templates). When used with `use_custom_template`, name of a custom project template. |
| `use_custom_template` **(PREMIUM)** | boolean | **{dotted-circle}** No | Use either custom [instance](../user/admin_area/custom_project_templates.md) or [group](../user/group/custom_project_templates.md) (with `group_with_project_templates_id`) project template. |
| `user_id` | integer | **{check-circle}** Yes | The user ID of the project owner. |
| `visibility` | string | **{dotted-circle}** No | See [project visibility level](#project-visibility-level). |

View File

@ -85,7 +85,8 @@ Example response:
"wiki_page_max_content_bytes": 52428800,
"require_admin_approval_after_user_signup": false,
"personal_access_token_prefix": "GL-",
"rate_limiting_response_text": null
"rate_limiting_response_text": null,
"keep_latest_artifact": true
}
```
@ -179,7 +180,8 @@ Example response:
"wiki_page_max_content_bytes": 52428800,
"require_admin_approval_after_user_signup": false,
"personal_access_token_prefix": "GL-",
"rate_limiting_response_text": null
"rate_limiting_response_text": null,
"keep_latest_artifact": true
}
```

View File

@ -35,7 +35,7 @@ repositories:
your project, update commit statuses, and create a web hook to notify
GitLab of new commits.
1. In GitLab, go to the [new project page](../../gitlab-basics/create-project.md#create-a-project-in-gitlab), select the **CI/CD for external repository** tab, and then click
1. In GitLab, go to the [new project page](../../user/project/working_with_projects.md#create-a-project), select the **CI/CD for external repository** tab, and then click
**GitHub**.
1. Paste the token into the **Personal access token** field and click **List

View File

@ -299,7 +299,7 @@ include:
- template: Auto-DevOps.gitlab-ci.yml
variables:
- AUTO_DEVOPS_PLATFORM_TARGET: EC2
AUTO_DEVOPS_PLATFORM_TARGET: EC2
build_artifact:
stage: build

View File

@ -57,7 +57,7 @@ Configuring environments involves:
The rest of this section illustrates how to configure environments and deployments using
an example scenario. It assumes you have already:
- Created a [project](../../gitlab-basics/create-project.md) in GitLab.
- Created a [project](../../user/project/working_with_projects.md#create-a-project) in GitLab.
- Set up [a runner](../runners/README.md).
In the scenario:

View File

@ -69,7 +69,7 @@ This test will be used later for continuously testing our app with GitLab CI/CD.
### Push to GitLab
Since we have our app up and running locally, it's time to push the codebase to our remote repository.
Let's create [a new project](../../../gitlab-basics/create-project.md) in GitLab named `laravel-sample`.
Let's create [a new project](../../../user/project/working_with_projects.md#create-a-project) in GitLab named `laravel-sample`.
After that, follow the command line instructions displayed on the project's homepage to initiate the repository on our machine and push the first commit.
```shell

View File

@ -484,6 +484,9 @@ a project, you can disable this behavior to save space:
1. Navigate to **Settings > CI/CD > Artifacts**.
1. Uncheck **Keep artifacts from most recent successful jobs**.
You can disable this behavior for all projects on a self-managed instance in the
[instance's CI/CD settings](../../user/admin_area/settings/continuous_integration.md#keep-the-latest-artifacts-for-all-jobs-in-the-latest-successful-pipelines). **(CORE ONLY)**
When you disable the feature, the latest artifacts do not immediately expire.
A new pipeline must run before the latest artifacts can expire and be deleted.

View File

@ -3331,7 +3331,9 @@ job:
The latest artifacts for refs are locked against deletion, and kept regardless of
the expiry time. [Introduced in](https://gitlab.com/gitlab-org/gitlab/-/issues/16267)
GitLab 13.0 behind a disabled feature flag, and [made the default behavior](https://gitlab.com/gitlab-org/gitlab/-/issues/229936)
in GitLab 13.4. In [GitLab 13.8 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/241026), you can [disable this behavior in the CI/CD settings](../pipelines/job_artifacts.md#keep-artifacts-from-most-recent-successful-jobs).
in GitLab 13.4.
In [GitLab 13.8 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/241026), you can [disable this behavior at the project level in the CI/CD settings](../pipelines/job_artifacts.md#keep-artifacts-from-most-recent-successful-jobs). In [GitLab 13.9 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/276583), you can [disable this behavior instance-wide](../../user/admin_area/settings/continuous_integration.md#keep-the-latest-artifacts-for-all-jobs-in-the-latest-successful-pipelines).
#### `artifacts:reports`

View File

@ -385,9 +385,12 @@ When ready to merge:
- Consider using the [Squash and
merge](../user/project/merge_requests/squash_and_merge.md#squash-and-merge)
feature when the merge request has a lot of commits.
When merging code a maintainer should only use the squash feature if the
author has already set this option or if the merge request clearly contains a
messy commit history that is intended to be squashed.
When merging code, a maintainer should only use the squash feature if the
author has already set this option, or if the merge request clearly contains a
messy commit history, it will be more efficient to squash commits instead of
circling back with the author about that. Otherwise, if the MR only has a few commits, we'll
be respecting the author's setting by not squashing them.
- **Start a new merge request pipeline with the `Run Pipeline` button in the merge
request's "Pipelines" tab, and enable "Merge When Pipeline Succeeds" (MWPS).** Note that:
- If the **latest [Pipeline for Merged Results](../ci/merge_request_pipelines/pipelines_for_merged_results/#pipelines-for-merged-results)** finished less than 2 hours ago, you

View File

@ -29,5 +29,5 @@ See also [File Storage in GitLab](file_storage.md).
### Forks
GitLab supports a great amount of features for [merge requests](../user/project/merge_requests/index.md). One
of them is the ability to create merge requests from and to [forks](../gitlab-basics/fork-project.md),
of them is the ability to create merge requests from and to [forks](../user/project/working_with_projects.md#fork-a-project),
which should also be highly considered and tested upon development phase.

View File

@ -67,6 +67,8 @@ tier: ['free', 'starter', 'premium', 'ultimate', 'bronze', 'silver', 'gold']
The GitLab codebase provides a dedicated [generator](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/generators/gitlab/usage_metric_definition_generator.rb) to create new metric definitions.
For uniqueness, the generated file includes a timestamp prefix, in ISO 8601 format.
The generator takes the key path argument and 2 options and creates the metric YAML definition in corresponding location:
- `--ee`, `--no-ee` Indicates if metric is for EE.

View File

@ -22,12 +22,12 @@ This documentation is split into the following groups:
The following are guides to basic GitLab functionality:
- [Create and add your SSH public key](../ssh/README.md), for enabling Git over SSH.
- [Create a project](create-project.md), to start using GitLab.
- [Create a project](../user/project/working_with_projects.md#create-a-project), to start using GitLab.
- [Create a group](../user/group/index.md#create-a-new-group), to combine and administer
projects together.
- [Create a branch](create-branch.md), to make changes to files stored in a project's repository.
- [Feature branch workflow](feature_branch_workflow.md).
- [Fork a project](fork-project.md), to duplicate projects so they can be worked on in parallel.
- [Fork a project](../user/project/working_with_projects.md#fork-a-project), to duplicate projects so they can be worked on in parallel.
- [Add a file](add-file.md), to add new files to a project's repository.
- [Create an issue](../user/project/issues/managing_issues.md#create-a-new-issue),
to start collaborating within a project.

View File

@ -1,175 +1,8 @@
---
stage: Create
group: Source Code
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: howto
redirect_to: '../user/project/working_with_projects.md'
---
# Create a project
This document was moved to [another location](../user/project/working_with_projects.md).
Most work in GitLab is done within a [Project](../user/project/index.md). Files and
code are saved in projects, and most features are used within the scope of projects.
## Create a project in GitLab
To create a project in GitLab:
1. In your dashboard, click the green **New project** button or use the plus
icon in the navigation bar. This opens the **New project** page.
1. On the **New project** page, choose if you want to:
- Create a [blank project](#blank-projects).
- Create a project using one of the available [project templates](#project-templates).
- [Import a project](../user/project/import/index.md) from a different repository,
if enabled on your GitLab instance. Contact your GitLab administrator if this is unavailable.
- Run [CI/CD pipelines for external repositories](../ci/ci_cd_for_external_repos/index.md). **(PREMIUM)**
NOTE:
For a list of words that can't be used as project names see
[Reserved project and group names](../user/reserved_names.md).
### Blank projects
To create a new blank project on the **New project** page:
1. On the **Blank project** tab, provide the following information:
- The name of your project in the **Project name** field. You can't use
special characters, but you can use spaces, hyphens, underscores, or even
emoji. When adding the name, the **Project slug** auto populates.
The slug is what the GitLab instance uses as the URL path to the project.
If you want a different slug, input the project name first,
then change the slug after.
- The path to your project in the **Project slug** field. This is the URL
path for your project that the GitLab instance uses. If the
**Project name** is blank, it auto populates when you fill in
the **Project slug**.
- The **Project description (optional)** field enables you to enter a
description for your project's dashboard, which helps others
understand what your project is about. Though it's not required, it's a good
idea to fill this in.
- Changing the **Visibility Level** modifies the project's
[viewing and access rights](../public_access/public_access.md) for users.
- Selecting the **Initialize repository with a README** option creates a
README file so that the Git repository is initialized, has a default branch, and
can be cloned.
1. Click **Create project**.
### Project templates
Project templates can pre-populate a new project with the necessary files to get you
started quickly.
There are two main types of project templates:
- [Built-in templates](#built-in-templates), sourced from the following groups:
- [`project-templates`](https://gitlab.com/gitlab-org/project-templates)
- [`pages`](https://gitlab.com/pages)
- [Custom project templates](#custom-project-templates), for custom templates
configured by GitLab administrators and users.
#### Built-in templates
Built-in templates are project templates that are:
- Developed and maintained in the [`project-templates`](https://gitlab.com/gitlab-org/project-templates)
and [`pages`](https://gitlab.com/pages) groups.
- Released with GitLab.
To use a built-in template on the **New project** page:
1. On the **Create from template** tab, select the **Built-in** tab.
1. From the list of available built-in templates, click the:
- **Preview** button to look at the template source itself.
- **Use template** button to start creating the project.
1. Finish creating the project by filling out the project's details. The process is
the same as creating a [blank project](#blank-projects).
##### Enterprise templates **(ULTIMATE)**
GitLab is developing Enterprise templates to help you streamline audit management with selected regulatory standards. These templates automatically import issues that correspond to each regulatory requirement.
To create a new project with an Enterprise template, on the **New project** page:
1. On the **Create from template** tab, select the **Built-in** tab.
1. From the list of available built-in Enterprise templates, click the:
- **Preview** button to look at the template source itself.
- **Use template** button to start creating the project.
1. Finish creating the project by filling out the project's details. The process is the same as creating a [blank project](#blank-projects).
Available Enterprise templates include:
- HIPAA Audit Protocol template ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13756) in GitLab 12.10)
NOTE:
You can improve the existing built-in templates or contribute new ones in the
[`project-templates`](https://gitlab.com/gitlab-org/project-templates) and
[`pages`](https://gitlab.com/pages) groups by following [these steps](https://gitlab.com/gitlab-org/project-templates/contributing).
#### Custom project templates **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/6860) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.2.
Creating new projects based on custom project templates is a convenient option for
quickly starting projects.
Custom projects are available at the [instance-level](../user/admin_area/custom_project_templates.md)
from the **Instance** tab, or at the [group-level](../user/group/custom_project_templates.md)
from the **Group** tab, under the **Create from template** tab.
To use a custom project template on the **New project** page:
1. On the **Create from template** tab, select the **Instance** tab or the **Group** tab.
1. From the list of available custom templates, click the:
- **Preview** button to look at the template source itself.
- **Use template** button to start creating the project.
1. Finish creating the project by filling out the project's details. The process is
the same as creating a [blank project](#blank-projects).
## Push to create a new project
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/26388) in GitLab 10.5.
When you create a new repository locally, instead of manually creating a new project in GitLab
and then [cloning the repository](start-using-git.md#clone-a-repository)
locally, you can directly push it to GitLab to create the new project, all without leaving
your terminal. If you have access rights to the associated namespace, GitLab
automatically creates a new project under that GitLab namespace with its visibility
set to Private by default (you can later change it in the [project's settings](../public_access/public_access.md#how-to-change-project-visibility)).
This can be done by using either SSH or HTTPS:
```shell
## Git push using SSH
git push --set-upstream git@gitlab.example.com:namespace/nonexistent-project.git master
## Git push using HTTPS
git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
```
You can pass the flag `--tags` to the `git push` command to export existing repository tags.
Once the push finishes successfully, a remote message indicates
the command to set the remote and the URL to the new project:
```plaintext
remote:
remote: The private project namespace/nonexistent-project was created.
remote:
remote: To configure the remote, run:
remote: git remote add origin https://gitlab.example.com/namespace/nonexistent-project.git
remote:
remote: To view the project, visit:
remote: https://gitlab.example.com/namespace/nonexistent-project
remote:
```
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->
<!-- This redirect file can be deleted after <2021-05-05>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->

View File

@ -1,14 +1,8 @@
---
stage: Create
group: Source Code
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: howto
redirect_to: '../user/project/working_with_projects.md'
---
# How to fork a project
This document was moved to [another location](../user/project/working_with_projects.md).
A fork is a copy of an original repository that you put in another namespace
where you can experiment and apply changes that you can later decide whether or
not to share, without affecting the original project.
It takes just a few steps to [fork a project in GitLab](../user/project/repository/forking_workflow.md#creating-a-fork).
<!-- This redirect file can be deleted after <2021-05-04>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->

View File

@ -278,7 +278,7 @@ identified by Git as the local content for that specific remote project.
To add a remote repository to your local copy:
1. In GitLab, [create a new project](../gitlab-basics/create-project.md#push-to-create-a-new-project) to hold your files.
1. In GitLab, [create a new project](../user/project/working_with_projects.md#create-a-project) to hold your files.
1. Visit this project's homepage, scroll down to **Push an existing folder**, and copy the command that starts with `git remote add`.
1. On your computer, open the terminal in the directory you've initialized, paste the command you copied, and press <kbd>enter</kbd>:

View File

@ -11,7 +11,7 @@ comments: false
Create projects and groups.
- [Create a new project](../gitlab-basics/create-project.md)
- [Create a new project](../user/project/working_with_projects.md#create-a-project)
- [Create a new group](../user/group/index.md#create-a-new-group)
## Prioritize

View File

@ -86,6 +86,25 @@ be updated for artifacts created before this setting was changed.
The administrator may need to manually search for and expire previously-created
artifacts, as described in the [troubleshooting documentation](../../../administration/troubleshooting/gitlab_rails_cheat_sheet.md#remove-artifacts-more-than-a-week-old).
## Keep the latest artifacts for all jobs in the latest successful pipelines **(CORE ONLY)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50889) in GitLab Core 13.9.
When enabled (default), the artifacts for the most recent pipeline for a ref are
locked against deletion and kept regardless of the expiry time.
When disabled, the latest artifacts for any **new** successful or fixed pipelines
are allowed to expire.
This setting takes precedence over the [project level setting](../../../ci/pipelines/job_artifacts.md#keep-artifacts-from-most-recent-successful-jobs).
If disabled at the instance level, you cannot enable this per-project.
When you disable the feature, the latest artifacts do not immediately expire.
A new pipeline must run before the latest artifacts can expire and be deleted.
NOTE:
All application settings have a [customizable cache expiry interval](../../../administration/application_settings_cache.md) which can delay the settings affect.
## Shared runners pipeline minutes quota **(PREMIUM SELF)**
> [Moved](https://about.gitlab.com/blog/2021/01/26/new-gitlab-product-subscription-model/) to GitLab Premium in 13.9.
@ -217,14 +236,13 @@ To set the maximum file size:
1. Enter the maximum file size, in bytes.
1. Click **Save size limits**.
<!-- ## Troubleshooting
## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
### 413 Request Entity Too Large
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->
When build jobs fail with the following error,
increase the [maximum artifacts size](#maximum-artifacts-size).
```plaintext
Uploading artifacts as "archive" to coordinator... too large archive <job-id> responseStatus=413 Request Entity Too Large status=413" at end of a build job on pipeline when trying to store artifacts to <object-storage>.
```

View File

@ -288,7 +288,7 @@ In [GitLab Premium or higher](https://about.gitlab.com/pricing/), GitLab adminis
There are two different ways to add a new project to a group:
- Select a group, and then click **New project**. You can then continue [creating your project](../../gitlab-basics/create-project.md).
- Select a group, and then click **New project**. You can then continue [creating your project](../../user/project/working_with_projects.md#create-a-project).
![New project](img/create_new_project_from_group_v13_6.png)
@ -504,7 +504,7 @@ From GitLab 10.5, you can transfer groups in the following ways:
When transferring groups, note:
- Changing a group's parent can have unintended side effects. See [Redirects when changing repository paths](../project/index.md#redirects-when-changing-repository-paths).
- Changing a group's parent can have unintended side effects. See [Redirects when changing repository paths](../project/repository/index.md#redirects-when-changing-repository-paths).
- You can only transfer groups to groups you manage.
- You must update your local repositories to point to the new location.
- If the immediate parent group's visibility is lower than the group's current visibility, visibility levels for subgroups and projects will change to match the new parent group's visibility.
@ -527,7 +527,7 @@ access further configurations for your group.
#### Changing a group's path
Changing a group's path (group URL) can have unintended side effects. Read
[how redirects will behave](../project/index.md#redirects-when-changing-repository-paths)
[how redirects will behave](../project/repository/index.md#redirects-when-changing-repository-paths)
before proceeding.
If you are vacating the path so it can be claimed by another group or user,

View File

@ -522,4 +522,4 @@ Read through the documentation on [LDAP users permissions](group/index.md#manage
## Project aliases
Project aliases can only be read, created and deleted by a GitLab administrator.
Read through the documentation on [Project aliases](../user/project/index.md#project-aliases) to learn more.
Read through the documentation on [Project aliases](../user/project/import/index.md#project-aliases) to learn more.

View File

@ -92,7 +92,7 @@ If you don't know your current password, select the 'I forgot my password' link.
Your `username` is a unique [`namespace`](../group/index.md#namespaces)
related to your user ID. Changing it can have unintended side effects, read
[how redirects behave](../project/index.md#redirects-when-changing-repository-paths)
[how redirects behave](../project/repository/index.md#redirects-when-changing-repository-paths)
before proceeding.
To change your `username`:

View File

@ -25,7 +25,7 @@ Additionally, in the [How To section](#how-to), you can read about different use
- Working with secrets.
- Setting up CORS.
Alternatively, you can quickly [create a new project with a template](../../../../gitlab-basics/create-project.md#project-templates). The [`Serverless Framework/JS` template](https://gitlab.com/gitlab-org/project-templates/serverless-framework/) already includes all parts described below.
Alternatively, you can quickly [create a new project with a template](../../working_with_projects.md#create-a-project). The [`Serverless Framework/JS` template](https://gitlab.com/gitlab-org/project-templates/serverless-framework/) already includes all parts described below.
### Example
@ -290,7 +290,7 @@ The example code is available:
- As a [clonable repository](https://gitlab.com/gitlab-org/serverless/examples/serverless-framework-js).
- In a version with [tests and secret variables](https://gitlab.com/gitlab-org/project-templates/serverless-framework/).
You can also use a [template](../../../../gitlab-basics/create-project.md#project-templates)
You can also use a [template](../../working_with_projects.md#project-templates)
(based on the version with tests and secret variables) from within the GitLab UI (see
the `Serverless Framework/JS` template).

View File

@ -74,3 +74,25 @@ In the event of merging two GitLab instances together (for example, both instanc
refer to the instructions in [Migrating from self-managed GitLab to GitLab.com](#migrating-from-self-managed-gitlab-to-gitlabcom).
Additionally, you can migrate users using the [Users API](../../../api/users.md) with an administrator user.
## Project aliases **(PREMIUM SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3264) in GitLab Premium 12.1.
When migrating repositories to GitLab and they are being accessed by other systems,
it's very useful to be able to access them using the same name especially when
they are a lot. It reduces the risk of changing significant number of Git URLs in
a large number of systems.
GitLab provides a functionality to help with this. In GitLab, repositories are
usually accessed with a namespace and project name. It is also possible to access
them via a project alias. This feature is only available on Git over SSH.
A project alias can be only created via API and only by GitLab administrators.
Follow the [Project Aliases API documentation](../../../api/project_aliases.md) for
more details.
After an alias has been created for a project (such as an alias `gitlab` for the
project `https://gitlab.com/gitlab-org/gitlab`), you can clone the repository
with the alias (e.g `git clone git@gitlab.com:gitlab.git` instead of
`git clone git@gitlab.com:gitlab-org/gitlab.git`).

View File

@ -17,8 +17,7 @@ the number of private projects you create.
## Project features
When you create a project in GitLab, you receive access to a large number of
[features](https://about.gitlab.com/features/):
Projects include the following [features](https://about.gitlab.com/features/):
**Repositories:**
@ -115,63 +114,11 @@ When you create a project in GitLab, you receive access to a large number of
- [Static Site Editor](static_site_editor/index.md): quickly edit content on static websites without prior knowledge of the codebase or Git commands.
- [Code Intelligence](code_intelligence.md): code navigation features.
### Project integrations
## Project integrations
[Integrate your project](integrations/index.md) with Jira, Mattermost,
Kubernetes, Slack, and a lot more.
## New project
Learn how to [create a new project](../../gitlab-basics/create-project.md) in GitLab.
### Fork a project
You can [fork a project](repository/forking_workflow.md) in order to:
- Collaborate on code by forking a project and creating a merge request
from your fork to the upstream project
- Fork a sample project to work on the top of that
### Star a project
You can star a project to make it easier to find projects you frequently use.
The number of stars a project has can indicate its popularity.
To star a project:
1. Go to the home page of the project you want to star.
1. In the upper right corner of the page, click **Star**.
To view your starred projects:
1. Click **Projects** in the navigation bar.
1. Click **Starred Projects**.
1. GitLab displays information about your starred projects, including:
- Project description, including name, description, and icon
- Number of times this project has been starred
- Number of times this project has been forked
- Number of open merge requests
- Number of open issues
### Explore projects
You can explore other popular projects available on GitLab. To explore projects:
1. Click **Projects** in the navigation bar.
1. Click **Explore Projects**.
GitLab displays a list of projects, sorted by last updated date. To view
projects with the most [stars](#star-a-project), click **Most stars**. To view
projects with the largest number of comments in the past month, click **Trending**.
## Project settings
Set the project's visibility level and the access levels to its various pages
and perform actions like archiving, renaming or transferring a project.
Read through the documentation on [project settings](settings/index.md).
## Import or export a project
- [Import a project](import/index.md) from:
@ -182,18 +129,6 @@ Read through the documentation on [project settings](settings/index.md).
- [Export a project from GitLab](settings/import_export.md#exporting-a-project-and-its-data)
- [Importing and exporting projects between GitLab instances](settings/import_export.md)
## Delete a project
To delete a project, first navigate to the home page for that project.
1. Navigate to **Settings > General**.
1. Expand the **Advanced** section.
1. Scroll down to the **Delete project** section.
1. Click **Delete project**
1. Confirm this action by typing in the expected text.
Projects in personal namespaces are deleted immediately on request. For information on delayed deletion of projects in a group, please see [Enabling delayed project removal](../group/index.md#enabling-delayed-project-removal).
## CI/CD for external repositories **(PREMIUM)**
Instead of importing a repository directly to GitLab, you can connect your repository
@ -201,45 +136,6 @@ as a CI/CD project.
Read through the documentation on [CI/CD for external repositories](../../ci/ci_cd_for_external_repos/index.md).
## Project members
Learn how to [add members to your projects](members/index.md).
## Project activity
To view the activity of a project, navigate to **Project overview > Activity**.
From there, you can click on the tabs to see **All** the activity, or see it
filtered by **Push events**, **Merge events**, **Issue events**, **Comments**,
**Team**, and **Wiki**.
### Leave a project
**Leave project** only displays on the project's dashboard
when a project is part of a group (under a
[group namespace](../group/index.md#namespaces)).
If you choose to leave a project you are no longer a project
member, and cannot contribute.
## Project's landing page
The project's landing page shows different information depending on
the project's visibility settings and user permissions.
For public projects, and to members of internal and private projects
with [permissions to view the project's code](../permissions.md#project-members-permissions):
- The content of a
[`README` or an index file](repository/#repository-readme-and-index-files)
is displayed (if any), followed by the list of directories in the
project's repository.
- If the project doesn't contain either of these files, the
visitor sees the list of files and directories of the repository.
For users without permissions to view the project's code, GitLab displays:
- The wiki homepage, if any.
- The list of issues in the project.
## GitLab Workflow - VS Code extension
To avoid switching from the GitLab UI and VS Code while working in GitLab repositories, you can integrate
@ -248,144 +144,6 @@ the [VS Code](https://code.visualstudio.com/) editor with GitLab through the
To review or contribute to the extension's code, visit [its codebase in GitLab](https://gitlab.com/gitlab-org/gitlab-vscode-extension/).
## Redirects when changing repository paths
When a repository path changes, it is essential to smoothly transition from the
old location to the new one. GitLab provides two kinds of redirects: the web UI
and Git push/pull redirects.
Depending on the situation, different things apply.
When [renaming a user](../profile/index.md#changing-your-username),
[changing a group path](../group/index.md#changing-a-groups-path) or [renaming a repository](settings/index.md#renaming-a-repository):
- Existing web URLs for the namespace and anything under it (such as projects) will
redirect to the new URLs.
- Starting with GitLab 10.3, existing Git remote URLs for projects under the
namespace redirect to the new remote URL. Every time you push/pull to a
repository that has changed its location, a warning message to update
your remote is displayed instead of rejecting your action.
This means that any automation scripts, or Git clients continue to
work after a rename, making any transition a lot smoother.
- The redirects are available as long as the original path is not claimed by
another group, user or project.
## Use your project as a Go package
Any project can be used as a Go package. GitLab responds correctly to `go get`
and `godoc.org` discovery requests, including the
[`go-import`](https://golang.org/cmd/go/#hdr-Remote_import_paths) and
[`go-source`](https://github.com/golang/gddo/wiki/Source-Code-Links) meta tags.
Private projects, including projects in subgroups, can be used as a Go package,
but may require configuration to work correctly. GitLab responds correctly
to `go get` discovery requests for projects that *are not* in subgroups,
regardless of authentication or authorization.
[Authentication](#authenticate-go-requests) is required to use a private project
in a subgroup as a Go package. Otherwise, GitLab truncates the path for
private projects in subgroups to the first two segments, causing `go get` to
fail.
GitLab implements its own Go proxy. This feature must be enabled by an
administrator and requires additional configuration. See [GitLab Go
Proxy](../packages/go_proxy/index.md).
### Disable Go module features for private projects
In Go 1.12 and later, Go queries module proxies and checksum databases in the
process of [fetching a
module](../../development/go_guide/dependencies.md#fetching). This can be
selectively disabled with `GOPRIVATE` (disable both),
[`GONOPROXY`](../../development/go_guide/dependencies.md#proxies) (disable proxy
queries), and [`GONOSUMDB`](../../development/go_guide/dependencies.md#fetching)
(disable checksum queries).
`GOPRIVATE`, `GONOPROXY`, and `GONOSUMDB` are comma-separated lists of Go
modules and Go module prefixes. For example,
`GOPRIVATE=gitlab.example.com/my/private/project` disables queries for that
one project, but `GOPRIVATE=gitlab.example.com` disables queries for *all*
projects on GitLab.com. Go does not query module proxies if the module name or a
prefix of it appears in `GOPRIVATE` or `GONOPROXY`. Go does not query checksum
databases if the module name or a prefix of it appears in `GONOPRIVATE` or
`GONOSUMDB`.
### Authenticate Go requests
To authenticate requests to private projects made by Go, use a [`.netrc`
file](https://ec.haxx.se/usingcurl-netrc.html) and a [personal access
token](../profile/personal_access_tokens.md) in the password field. **This only
works if your GitLab instance can be accessed with HTTPS.** The `go` command
does not transmit credentials over insecure connections. This authenticates
all HTTPS requests made directly by Go, but does not authenticate requests made
through Git.
For example:
```plaintext
machine gitlab.example.com
login <gitlab_user_name>
password <personal_access_token>
```
NOTE:
On Windows, Go reads `~/_netrc` instead of `~/.netrc`.
### Authenticate Git fetches
If a module cannot be fetched from a proxy, Go falls back to using Git (for
GitLab projects). Git uses `.netrc` to authenticate requests. You can also
configure Git to either:
- Embed specific credentials in the request URL.
- Use SSH instead of HTTPS, as Go always uses HTTPS to fetch Git repositories.
```shell
# Embed credentials in any request to GitLab.com:
git config --global url."https://${user}:${personal_access_token}@gitlab.example.com".insteadOf "https://gitlab.example.com"
# Use SSH instead of HTTPS:
git config --global url."git@gitlab.example.com".insteadOf "https://gitlab.example.com"
```
## Access project page with project ID
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53671) in GitLab 11.8.
To quickly access a project from the GitLab UI using the project ID,
visit the `/projects/:id` URL in your browser or other tool accessing the project.
## Project aliases **(PREMIUM SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3264) in GitLab Premium 12.1.
When migrating repositories to GitLab and they are being accessed by other systems,
it's very useful to be able to access them using the same name especially when
they are a lot. It reduces the risk of changing significant number of Git URLs in
a large number of systems.
GitLab provides a functionality to help with this. In GitLab, repositories are
usually accessed with a namespace and project name. It is also possible to access
them via a project alias. This feature is only available on Git over SSH.
A project alias can be only created via API and only by GitLab administrators.
Follow the [Project Aliases API documentation](../../api/project_aliases.md) for
more details.
After an alias has been created for a project (such as an alias `gitlab` for the
project `https://gitlab.com/gitlab-org/gitlab`), you can clone the repository
with the alias (e.g `git clone git@gitlab.com:gitlab.git` instead of
`git clone git@gitlab.com:gitlab-org/gitlab.git`).
## Project activity analytics overview **(ULTIMATE SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/279039) in GitLab [Ultimate](https://about.gitlab.com/pricing/) 13.7 as a [Beta feature](https://about.gitlab.com/handbook/product/gitlab-the-product/#beta).
Project details include the following analytics:
- Deployment Frequency
For more information, see [Project Analytics API](../../api/project_analytics.md).
## Project APIs
There are numerous [APIs](../../api/README.md) to use with your projects:
@ -407,3 +165,13 @@ There are numerous [APIs](../../api/README.md) to use with your projects:
- [Variables](../../api/project_level_variables.md)
- [Aliases](../../api/project_aliases.md)
- [Analytics](../../api/project_analytics.md)
## Project activity analytics overview **(ULTIMATE SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/279039) in GitLab [Ultimate](https://about.gitlab.com/pricing/) 13.7 as a [Beta feature](https://about.gitlab.com/handbook/product/gitlab-the-product/#beta).
Project details include the following analytics:
- Deployment Frequency
For more information, see [Project Analytics API](../../api/project_analytics.md).

View File

@ -259,4 +259,4 @@ This will be rendered as:
User activity events on designs (creation, deletion, and updates) are tracked by GitLab and
displayed on the [user profile](../../profile/index.md#user-profile),
[group](../../group/index.md#view-group-activity),
and [project](../index.md#project-activity) activity pages.
and [project](../working_with_projects.md#project-activity) activity pages.

View File

@ -18,7 +18,7 @@ configured to generate a Pages site.
To fork a sample project and create a Pages website:
1. View the sample projects by navigating to the [GitLab Pages examples](https://gitlab.com/pages) group.
1. Click the name of the project you want to [fork](../../../../gitlab-basics/fork-project.md).
1. Click the name of the project you want to [fork](../../../../user/project/working_with_projects.md#fork-a-project).
1. In the top right, click the **Fork** button, and then choose a namespace to fork to.
1. Go to your project's **CI/CD > Pipelines** and click **Run pipeline**.
GitLab CI/CD builds and deploys your site.

View File

@ -14,7 +14,7 @@ A repository is part of a [project](../index.md), which has a lot of other featu
## Create a repository
To create a new repository, all you need to do is
[create a new project](../../../gitlab-basics/create-project.md) or
[create a new project](../../../user/project/working_with_projects.md#create-a-project) or
[fork an existing project](forking_workflow.md).
Once you create a new project, you can add new files via UI
@ -270,6 +270,28 @@ By clicking the download icon, a dropdown will open with links to download the f
- **Artifacts:**
allows users to download the artifacts of the latest CI build.
## Redirects when changing repository paths
When a repository path changes, it is essential to smoothly transition from the
old location to the new one. GitLab provides two kinds of redirects: the web UI
and Git push/pull redirects.
Depending on the situation, different things apply.
When [renaming a user](../../profile/index.md#changing-your-username),
[changing a group path](../../group/index.md#changing-a-groups-path) or [renaming a repository](../settings/index.md#renaming-a-repository):
- Existing web URLs for the namespace and anything under it (such as projects) will
redirect to the new URLs.
- Starting with GitLab 10.3, existing Git remote URLs for projects under the
namespace redirect to the new remote URL. Every time you push/pull to a
repository that has changed its location, a warning message to update
your remote is displayed instead of rejecting your action.
This means that any automation scripts, or Git clients continue to
work after a rename, making any transition a lot smoother.
- The redirects are available as long as the original path is not claimed by
another group, user or project.
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues

View File

@ -79,7 +79,7 @@ Use the switches to enable or disable the following features:
| **Issues** | ✓ | Activates the GitLab issues tracker |
| **Repository** | ✓ | Enables [repository](../repository/) functionality |
| **Merge Requests** | ✓ | Enables [merge request](../merge_requests/) functionality; also see [Merge request settings](#merge-request-settings) |
| **Forks** | ✓ | Enables [forking](../index.md#fork-a-project) functionality |
| **Forks** | ✓ | Enables [forking](../working_with_projects.md#fork-a-project) functionality |
| **Pipelines** | ✓ | Enables [CI/CD](../../../ci/README.md) functionality |
| **Container Registry** | | Activates a [registry](../../packages/container_registry/) for your Docker images |
| **Git Large File Storage** | | Enables the use of [large files](../../../topics/git/lfs/index.md#git-large-file-storage-lfs) |
@ -221,7 +221,7 @@ To rename a repository:
Remember that this can have unintended side effects since everyone with the
old URL won't be able to push or pull. Read more about what happens with the
[redirects when renaming repositories](../index.md#redirects-when-changing-repository-paths).
[redirects when renaming repositories](../repository/index.md#redirects-when-changing-repository-paths).
#### Transferring an existing project into another namespace
@ -245,7 +245,7 @@ To transfer a project:
Once done, you will be taken to the new project's namespace. At this point,
read what happens with the
[redirects from the old project to the new one](../index.md#redirects-when-changing-repository-paths).
[redirects from the old project to the new one](../repository/index.md#redirects-when-changing-repository-paths).
NOTE:
GitLab administrators can use the administration interface to move any project to any

View File

@ -72,7 +72,7 @@ First, set up the project. Once done, you can use the Static Site Editor to
1. To get started, create a new project from the [Static Site Editor - Middleman](https://gitlab.com/gitlab-org/project-templates/static-site-editor-middleman)
template. You can either [fork it](../repository/forking_workflow.md#creating-a-fork)
or [create a new project from a template](../../../gitlab-basics/create-project.md#built-in-templates).
or [create a new project from a template](../working_with_projects.md#built-in-templates).
1. Edit the [`data/config.yml`](#static-site-generator-configuration) configuration file
to replace `<username>` and `<project-name>` with the proper values for
your project's path.

View File

@ -184,7 +184,7 @@ Similar to versioned diff file views, you can see the changes made in a given Wi
Wiki events (creation, deletion, and updates) are tracked by GitLab and
displayed on the [user profile](../../profile/index.md#user-profile),
[group](../../group/index.md#view-group-activity),
and [project](../index.md#project-activity) activity pages.
and [project](../working_with_projects.md#project-activity) activity pages.
## Adding and editing wiki pages locally

View File

@ -0,0 +1,341 @@
---
stage: Create
group: Source Code
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"
---
# Working with projects
Most work in GitLab is done in a [project](../../user/project/index.md). Files and
code are saved in projects, and most features are in the scope of projects.
## Explore projects
You can explore other popular projects available on GitLab. To explore projects:
1. Click **Projects** in the navigation bar.
1. Click **Explore Projects**.
GitLab displays a list of projects, sorted by last updated date. To view
projects with the most [stars](#star-a-project), click **Most stars**. To view
projects with the largest number of comments in the past month, click **Trending**.
## Create a project
To create a project in GitLab:
1. In your dashboard, click the green **New project** button or use the plus
icon in the navigation bar. This opens the **New project** page.
1. On the **New project** page, choose if you want to:
- Create a [blank project](#blank-projects).
- Create a project using one of the available [project templates](#project-templates).
- [Import a project](../../user/project/import/index.md) from a different repository,
if enabled on your GitLab instance. Contact your GitLab administrator if this is unavailable.
- Run [CI/CD pipelines for external repositories](../../ci/ci_cd_for_external_repos/index.md). **(PREMIUM)**
NOTE:
For a list of words that can't be used as project names see
[Reserved project and group names](../../user/reserved_names.md).
### Blank projects
To create a new blank project on the **New project** page:
1. On the **Blank project** tab, provide the following information:
- The name of your project in the **Project name** field. You can't use
special characters, but you can use spaces, hyphens, underscores, or even
emoji. When adding the name, the **Project slug** auto populates.
The slug is what the GitLab instance uses as the URL path to the project.
If you want a different slug, input the project name first,
then change the slug after.
- The path to your project in the **Project slug** field. This is the URL
path for your project that the GitLab instance uses. If the
**Project name** is blank, it auto populates when you fill in
the **Project slug**.
- The **Project description (optional)** field enables you to enter a
description for your project's dashboard, which helps others
understand what your project is about. Though it's not required, it's a good
idea to fill this in.
- Changing the **Visibility Level** modifies the project's
[viewing and access rights](../../public_access/public_access.md) for users.
- Selecting the **Initialize repository with a README** option creates a
README file so that the Git repository is initialized, has a default branch, and
can be cloned.
1. Click **Create project**.
### Project templates
Project templates can pre-populate a new project with the necessary files to get you
started quickly.
There are two main types of project templates:
- [Built-in templates](#built-in-templates), sourced from the following groups:
- [`project-templates`](https://gitlab.com/gitlab-org/project-templates)
- [`pages`](https://gitlab.com/pages)
- [Custom project templates](#custom-project-templates), for custom templates
configured by GitLab administrators and users.
#### Built-in templates
Built-in templates are project templates that are:
- Developed and maintained in the [`project-templates`](https://gitlab.com/gitlab-org/project-templates)
and [`pages`](https://gitlab.com/pages) groups.
- Released with GitLab.
To use a built-in template on the **New project** page:
1. On the **Create from template** tab, select the **Built-in** tab.
1. From the list of available built-in templates, click the:
- **Preview** button to look at the template source itself.
- **Use template** button to start creating the project.
1. Finish creating the project by filling out the project's details. The process is
the same as creating a [blank project](#blank-projects).
##### Enterprise templates **(ULTIMATE)**
GitLab is developing Enterprise templates to help you streamline audit management with selected regulatory standards. These templates automatically import issues that correspond to each regulatory requirement.
To create a new project with an Enterprise template, on the **New project** page:
1. On the **Create from template** tab, select the **Built-in** tab.
1. From the list of available built-in Enterprise templates, click the:
- **Preview** button to look at the template source itself.
- **Use template** button to start creating the project.
1. Finish creating the project by filling out the project's details. The process is the same as creating a [blank project](#blank-projects).
Available Enterprise templates include:
- HIPAA Audit Protocol template ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13756) in GitLab 12.10)
NOTE:
You can improve the existing built-in templates or contribute new ones in the
[`project-templates`](https://gitlab.com/gitlab-org/project-templates) and
[`pages`](https://gitlab.com/pages) groups by following [these steps](https://gitlab.com/gitlab-org/project-templates/contributing).
##### Custom project templates **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/6860) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.2.
Creating new projects based on custom project templates is a convenient option for
quickly starting projects.
Custom projects are available at the [instance-level](../../user/admin_area/custom_project_templates.md)
from the **Instance** tab, or at the [group-level](../../user/group/custom_project_templates.md)
from the **Group** tab, under the **Create from template** tab.
To use a custom project template on the **New project** page:
1. On the **Create from template** tab, select the **Instance** tab or the **Group** tab.
1. From the list of available custom templates, click the:
- **Preview** button to look at the template source itself.
- **Use template** button to start creating the project.
1. Finish creating the project by filling out the project's details. The process is
the same as creating a [blank project](#blank-projects).
## Push to create a new project
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/26388) in GitLab 10.5.
When you create a new repository locally, instead of manually creating a new project in GitLab
and then [cloning the repository](../../gitlab-basics/start-using-git.md#clone-a-repository)
locally, you can directly push it to GitLab to create the new project, all without leaving
your terminal. If you have access rights to the associated namespace, GitLab
automatically creates a new project under that GitLab namespace with its visibility
set to Private by default (you can later change it in the [project's settings](../../public_access/public_access.md#how-to-change-project-visibility)).
This can be done by using either SSH or HTTPS:
```shell
## Git push using SSH
git push --set-upstream git@gitlab.example.com:namespace/nonexistent-project.git master
## Git push using HTTPS
git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
```
You can pass the flag `--tags` to the `git push` command to export existing repository tags.
Once the push finishes successfully, a remote message indicates
the command to set the remote and the URL to the new project:
```plaintext
remote:
remote: The private project namespace/nonexistent-project was created.
remote:
remote: To configure the remote, run:
remote: git remote add origin https://gitlab.example.com/namespace/nonexistent-project.git
remote:
remote: To view the project, visit:
remote: https://gitlab.example.com/namespace/nonexistent-project
remote:
```
## Fork a project
A fork is a copy of an original repository that you put in another namespace
where you can experiment and apply changes that you can later decide whether or
not to share, without affecting the original project.
It takes just a few steps to [fork a project in GitLab](repository/forking_workflow.md#creating-a-fork).
## Star a project
You can star a project to make it easier to find projects you frequently use.
The number of stars a project has can indicate its popularity.
To star a project:
1. Go to the home page of the project you want to star.
1. In the upper right corner of the page, click **Star**.
To view your starred projects:
1. Click **Projects** in the navigation bar.
1. Click **Starred Projects**.
1. GitLab displays information about your starred projects, including:
- Project description, including name, description, and icon
- Number of times this project has been starred
- Number of times this project has been forked
- Number of open merge requests
- Number of open issues
## Delete a project
To delete a project, first navigate to the home page for that project.
1. Navigate to **Settings > General**.
1. Expand the **Advanced** section.
1. Scroll down to the **Delete project** section.
1. Click **Delete project**
1. Confirm this action by typing in the expected text.
Projects in personal namespaces are deleted immediately on request. For information on delayed deletion of projects in a group, please see [Enabling delayed project removal](../group/index.md#enabling-delayed-project-removal).
## Project settings
Set the project's visibility level and the access levels to its various pages
and perform actions like archiving, renaming or transferring a project.
Read through the documentation on [project settings](settings/index.md).
## Project activity
To view the activity of a project, navigate to **Project overview > Activity**.
From there, you can click on the tabs to see **All** the activity, or see it
filtered by **Push events**, **Merge events**, **Issue events**, **Comments**,
**Team**, and **Wiki**.
### Leave a project
**Leave project** only displays on the project's dashboard
when a project is part of a group (under a
[group namespace](../group/index.md#namespaces)).
If you choose to leave a project you are no longer a project
member, and cannot contribute.
## Use your project as a Go package
Any project can be used as a Go package. GitLab responds correctly to `go get`
and `godoc.org` discovery requests, including the
[`go-import`](https://golang.org/cmd/go/#hdr-Remote_import_paths) and
[`go-source`](https://github.com/golang/gddo/wiki/Source-Code-Links) meta tags.
Private projects, including projects in subgroups, can be used as a Go package,
but may require configuration to work correctly. GitLab responds correctly
to `go get` discovery requests for projects that *are not* in subgroups,
regardless of authentication or authorization.
[Authentication](#authenticate-go-requests) is required to use a private project
in a subgroup as a Go package. Otherwise, GitLab truncates the path for
private projects in subgroups to the first two segments, causing `go get` to
fail.
GitLab implements its own Go proxy. This feature must be enabled by an
administrator and requires additional configuration. See [GitLab Go
Proxy](../packages/go_proxy/index.md).
### Disable Go module features for private projects
In Go 1.12 and later, Go queries module proxies and checksum databases in the
process of [fetching a
module](../../development/go_guide/dependencies.md#fetching). This can be
selectively disabled with `GOPRIVATE` (disable both),
[`GONOPROXY`](../../development/go_guide/dependencies.md#proxies) (disable proxy
queries), and [`GONOSUMDB`](../../development/go_guide/dependencies.md#fetching)
(disable checksum queries).
`GOPRIVATE`, `GONOPROXY`, and `GONOSUMDB` are comma-separated lists of Go
modules and Go module prefixes. For example,
`GOPRIVATE=gitlab.example.com/my/private/project` disables queries for that
one project, but `GOPRIVATE=gitlab.example.com` disables queries for *all*
projects on GitLab.com. Go does not query module proxies if the module name or a
prefix of it appears in `GOPRIVATE` or `GONOPROXY`. Go does not query checksum
databases if the module name or a prefix of it appears in `GONOPRIVATE` or
`GONOSUMDB`.
### Authenticate Go requests
To authenticate requests to private projects made by Go, use a [`.netrc`
file](https://ec.haxx.se/usingcurl-netrc.html) and a [personal access
token](../profile/personal_access_tokens.md) in the password field. **This only
works if your GitLab instance can be accessed with HTTPS.** The `go` command
does not transmit credentials over insecure connections. This authenticates
all HTTPS requests made directly by Go, but does not authenticate requests made
through Git.
For example:
```plaintext
machine gitlab.example.com
login <gitlab_user_name>
password <personal_access_token>
```
NOTE:
On Windows, Go reads `~/_netrc` instead of `~/.netrc`.
### Authenticate Git fetches
If a module cannot be fetched from a proxy, Go falls back to using Git (for
GitLab projects). Git uses `.netrc` to authenticate requests. You can also
configure Git to either:
- Embed specific credentials in the request URL.
- Use SSH instead of HTTPS, as Go always uses HTTPS to fetch Git repositories.
```shell
# Embed credentials in any request to GitLab.com:
git config --global url."https://${user}:${personal_access_token}@gitlab.example.com".insteadOf "https://gitlab.example.com"
# Use SSH instead of HTTPS:
git config --global url."git@gitlab.example.com".insteadOf "https://gitlab.example.com"
```
## Access project page with project ID
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53671) in GitLab 11.8.
To quickly access a project from the GitLab UI using the project ID,
visit the `/projects/:id` URL in your browser or other tool accessing the project.
## Project's landing page
The project's landing page shows different information depending on
the project's visibility settings and user permissions.
For public projects, and to members of internal and private projects
with [permissions to view the project's code](../permissions.md#project-members-permissions):
- The content of a
[`README` or an index file](repository/#repository-readme-and-index-files)
is displayed (if any), followed by the list of directories in the
project's repository.
- If the project doesn't contain either of these files, the
visitor sees the list of files and directories of the repository.
For users without permissions to view the project's code, GitLab displays:
- The wiki homepage, if any.
- The list of issues in the project.

View File

@ -193,7 +193,7 @@ You can search through your projects from the left menu, by clicking the menu ba
On the field **Filter by name**, type the project or group name you want to find, and GitLab
filters them for you as you type.
You can also look for the projects you [starred](../project/index.md#star-a-project) (**Starred projects**).
You can also look for the projects you [starred](../project/working_with_projects.md#star-a-project) (**Starred projects**).
You can **Explore** all public and internal projects available in GitLab.com, from which you can filter by visibility,
through **Trending**, best rated with **Most stars**, or **All** of them.

View File

@ -10,8 +10,7 @@ module API
helpers do
def current_settings
@current_setting ||=
(ApplicationSetting.current_without_cache || ApplicationSetting.create_from_defaults)
@current_setting ||= ApplicationSetting.find_or_create_without_cache
end
def filter_attributes_using_license(attrs)

View File

@ -67,8 +67,11 @@ module Gitlab
options[:dir]
end
# Example of file name
#
# 20210201124931_g_project_management_issue_title_changed_weekly.yml
def file_name
key_path.split('.').last
"#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_#{key_path.split('.').last}"
end
def directory

View File

@ -23,7 +23,7 @@ module Gitlab
pipeline_schedule: @command.schedule,
merge_request: @command.merge_request,
external_pull_request: @command.external_pull_request,
locked: @command.project.latest_pipeline_locked,
locked: @command.project.default_pipeline_lock,
variables_attributes: variables_attributes
)
end

View File

@ -1,24 +1,16 @@
# frozen_string_literal: true
require 'zlib'
module Gitlab
module ImportExport
class DecompressedArchiveSizeValidator
include Gitlab::Utils::StrongMemoize
DEFAULT_MAX_BYTES = 10.gigabytes.freeze
CHUNK_SIZE = 4096.freeze
attr_reader :error
TIMEOUT_LIMIT = 60.seconds
def initialize(archive_path:, max_bytes: self.class.max_bytes)
@archive_path = archive_path
@max_bytes = max_bytes
@bytes_read = 0
@total_reads = 0
@denominator = 5
@error = nil
end
def valid?
@ -31,59 +23,62 @@ module Gitlab
DEFAULT_MAX_BYTES
end
def archive_file
@archive_file ||= File.open(@archive_path)
end
private
def validate
until archive_file.eof?
compressed_chunk = archive_file.read(CHUNK_SIZE)
pgrp = nil
valid_archive = true
inflate_stream.inflate(compressed_chunk) do |chunk|
@bytes_read += chunk.size
@total_reads += 1
Timeout.timeout(TIMEOUT_LIMIT) do
stdin, stdout, stderr, wait_thr = Open3.popen3(command, pgroup: true)
stdin.close
pgrp = Process.getpgid(wait_thr[:pid])
status = wait_thr.value
if status.success?
result = stdout.readline
if result.to_i > @max_bytes
valid_archive = false
log_error('Decompressed archive size limit reached')
end
else
valid_archive = false
log_error(stderr.readline)
end
# Start garbage collection every 5 reads in order
# to prevent memory bloat during archive decompression
GC.start if gc_start?
if @bytes_read > @max_bytes
@error = error_message
return false
end
ensure
stdout.close
stderr.close
end
true
rescue => e
@error = error_message
valid_archive
rescue Timeout::Error
log_error('Timeout reached during archive decompression')
Gitlab::ErrorTracking.track_exception(e)
Gitlab::Import::Logger.info(
message: @error,
error: e.message
)
Process.kill(-1, pgrp) if pgrp
false
rescue => e
log_error(e.message)
Process.kill(-1, pgrp) if pgrp
false
ensure
inflate_stream.close
archive_file.close
end
def inflate_stream
@inflate_stream ||= Zlib::Inflate.new(Zlib::MAX_WBITS + 32)
def command
"gzip -dc #{@archive_path} | wc -c"
end
def gc_start?
@total_reads % @denominator == 0
end
def error_message
_('Decompressed archive size validation failed.')
def log_error(error)
Gitlab::Import::Logger.info(
message: error,
import_upload_archive_path: @archive_path,
import_upload_archive_size: File.size(@archive_path)
)
end
end
end

View File

@ -87,7 +87,7 @@ module Gitlab
end
def validate_decompressed_archive_size
raise ImporterError.new(size_validator.error) unless size_validator.valid?
raise ImporterError.new(_('Decompressed archive size validation failed.')) unless size_validator.valid?
end
def size_validator

View File

@ -2070,6 +2070,9 @@ msgstr ""
msgid "AdminSettings|Integrations configured here will automatically apply to all projects on this instance."
msgstr ""
msgid "AdminSettings|Keep the latest artifacts for all jobs in the latest successful pipelines"
msgstr ""
msgid "AdminSettings|Maximum duration of a session for Git operations when 2FA is enabled."
msgstr ""
@ -2109,6 +2112,9 @@ msgstr ""
msgid "AdminSettings|Specify a domain to use by default for every project's Auto Review Apps and Auto Deploy stages."
msgstr ""
msgid "AdminSettings|The latest artifacts for all jobs in the most recent successful pipelines in each project are stored and do not expire."
msgstr ""
msgid "AdminSettings|The required pipeline configuration can be selected from the %{code_start}gitlab-ci%{code_end} directory inside of the configured %{link_start}instance template repository%{link_end} or from GitLab provided configurations."
msgstr ""
@ -29320,7 +29326,7 @@ msgstr ""
msgid "There was a problem fetching project users."
msgstr ""
msgid "There was a problem fetching the keep latest artifact setting."
msgid "There was a problem fetching the keep latest artifacts setting."
msgstr ""
msgid "There was a problem fetching users."
@ -29335,7 +29341,7 @@ msgstr ""
msgid "There was a problem sending the confirmation email"
msgstr ""
msgid "There was a problem updating the keep latest artifact setting."
msgid "There was a problem updating the keep latest artifacts setting."
msgstr ""
msgid "There was an error %{message} todo."
@ -29689,6 +29695,9 @@ msgstr ""
msgid "This epic does not exist or you don't have sufficient permission."
msgstr ""
msgid "This feature is disabled at the instance level."
msgstr ""
msgid "This feature requires local storage to be enabled"
msgstr ""

View File

@ -0,0 +1,84 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Manage' do
describe 'User', :requires_admin do
before(:all) do
admin_api_client = Runtime::API::Client.as_admin
@user = Resource::User.fabricate_via_api! do |user|
user.api_client = admin_api_client
end
@user_api_client = Runtime::API::Client.new(:gitlab, user: @user)
@group = Resource::Group.fabricate_via_api!
@group.sandbox.add_member(@user)
@project = Resource::Project.fabricate_via_api! do |project|
project.group = @group
project.name = "project-for-user-group-access-termination"
project.initialize_with_readme = true
end
end
context 'after parent group membership termination' do
before do
@group.sandbox.remove_member(@user)
end
it 'is not allowed to push code via the CLI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1660' do
expect do
Resource::Repository::Push.fabricate! do |push|
push.repository_http_uri = @project.repository_http_location.uri
push.file_name = 'test.txt'
push.file_content = "# This is a test project named #{@project.name}"
push.commit_message = 'Add test.txt'
push.branch_name = 'new_branch'
push.user = @user
end
end.to raise_error(QA::Support::Run::CommandError, /You are not allowed to push code to this project/)
end
it 'is not allowed to create a file via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1661' do
expect do
Resource::File.fabricate_via_api! do |file|
file.api_client = @user_api_client
file.project = @project
file.branch = 'new_branch'
file.commit_message = 'Add new file'
file.name = 'test.txt'
file.content = "New file"
end
end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden/)
end
it 'is not allowed to commit via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1662' do
expect do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.api_client = @user_api_client
commit.project = @project
commit.branch = 'new_branch'
commit.start_branch = @project.default_branch
commit.commit_message = 'Add new file'
commit.add_files([
{ file_path: 'test.txt', content: 'new file' }
])
end
end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden - You are not allowed to push into this branch/)
end
end
after(:all) do
@user.remove_via_api!
@project.remove_via_api!
begin
@group.remove_via_api!
rescue Resource::ApiFabricator::ResourceNotDeletedError
# It is ok if the group is already marked for deletion by another test
end
end
end
end
end

View File

@ -0,0 +1,65 @@
# frozen_string_literal: true
module QA
RSpec.describe 'Manage' do
describe 'User', :requires_admin do
let(:admin_api_client) { Runtime::API::Client.as_admin }
let!(:user) do
Resource::User.fabricate_via_api! do |user|
user.api_client = admin_api_client
end
end
let!(:group) do
group = Resource::Group.fabricate_via_api!
group.sandbox.add_member(user)
group
end
let!(:project) do
Resource::Project.fabricate_via_api! do |project|
project.group = group
project.name = "project-for-user-access-termination"
project.initialize_with_readme = true
end
end
context 'after parent group membership termination' do
before do
Flow::Login.while_signed_in_as_admin do
group.sandbox.visit!
Page::Group::Menu.perform(&:click_group_members_item)
Page::Group::Members.perform do |members_page|
members_page.remove_member(user.username)
end
end
end
it 'is not allowed to edit the project files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1663' do
Flow::Login.sign_in(as: user)
project.visit!
Page::Project::Show.perform do |project|
project.click_file('README.md')
end
Page::File::Show.perform(&:click_edit)
expect(page).to have_text("You're not allowed to edit files in this project directly.")
end
after do
user.remove_via_api!
project.remove_via_api!
begin
group.remove_via_api!
rescue Resource::ApiFabricator::ResourceNotDeletedError
# It is ok if the group is already marked for deletion by another test
end
end
end
end
end
end

View File

@ -39,7 +39,7 @@ FactoryBot.define do
group_runners_enabled { nil }
merge_pipelines_enabled { nil }
merge_trains_enabled { nil }
ci_keep_latest_artifact { nil }
keep_latest_artifact { nil }
import_status { nil }
import_jid { nil }
import_correlation_id { nil }
@ -84,7 +84,7 @@ FactoryBot.define do
project.group_runners_enabled = evaluator.group_runners_enabled unless evaluator.group_runners_enabled.nil?
project.merge_pipelines_enabled = evaluator.merge_pipelines_enabled unless evaluator.merge_pipelines_enabled.nil?
project.merge_trains_enabled = evaluator.merge_trains_enabled unless evaluator.merge_trains_enabled.nil?
project.ci_keep_latest_artifact = evaluator.ci_keep_latest_artifact unless evaluator.ci_keep_latest_artifact.nil?
project.keep_latest_artifact = evaluator.keep_latest_artifact unless evaluator.keep_latest_artifact.nil?
project.restrict_user_defined_variables = evaluator.restrict_user_defined_variables unless evaluator.restrict_user_defined_variables.nil?
if evaluator.import_status

View File

@ -306,11 +306,13 @@ RSpec.describe 'Admin updates settings' do
page.within('.as-ci-cd') do
check 'Default to Auto DevOps pipeline for all projects'
fill_in 'application_setting_auto_devops_domain', with: 'domain.com'
uncheck 'Keep the latest artifacts for all jobs in the latest successful pipelines'
click_button 'Save changes'
end
expect(current_settings.auto_devops_enabled?).to be true
expect(current_settings.auto_devops_domain).to eq('domain.com')
expect(current_settings.keep_latest_artifact).to be false
expect(page).to have_content "Application settings saved successfully"
end

View File

@ -1,29 +1,64 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Keep latest artifact checkbox sets correct setting value in checkbox with query result 1`] = `
exports[`Keep latest artifact checkbox when application keep latest artifact setting is disabled checkbox is disabled when application setting is disabled 1`] = `
<div>
<!---->
<gl-form-checkbox-stub
<b-form-checkbox-stub
checked="true"
class="gl-form-checkbox"
disabled="true"
plain="true"
value="true"
>
<b
<strong
class="gl-mr-3"
>
Keep artifacts from most recent successful jobs
</b>
</strong>
<gl-link-stub
href="/help/ci/pipelines/job_artifacts"
>
More information
</gl-link-stub>
</gl-form-checkbox-stub>
<p>
The latest artifacts created by jobs in the most recent successful pipeline will be stored.
</p>
<p
class="help-text"
>
This feature is disabled at the instance level.
</p>
</b-form-checkbox-stub>
</div>
`;
exports[`Keep latest artifact checkbox when application keep latest artifact setting is enabled sets correct setting value in checkbox with query result 1`] = `
<div>
<!---->
<b-form-checkbox-stub
checked="true"
class="gl-form-checkbox"
plain="true"
value="true"
>
<strong
class="gl-mr-3"
>
Keep artifacts from most recent successful jobs
</strong>
<gl-link-stub
href="/help/ci/pipelines/job_artifacts"
>
More information
</gl-link-stub>
<p
class="help-text"
>
The latest artifacts created by jobs in the most recent successful pipeline will be stored.
</p>
</b-form-checkbox-stub>
</div>
`;

View File

@ -4,12 +4,13 @@ import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper';
import KeepLatestArtifactCheckbox from '~/artifacts_settings/keep_latest_artifact_checkbox.vue';
import GetKeepLatestArtifactProjectSetting from '~/artifacts_settings/graphql/queries/get_keep_latest_artifact_project_setting.query.graphql';
import GetKeepLatestArtifactApplicationSetting from '~/artifacts_settings/graphql/queries/get_keep_latest_artifact_application_setting.query.graphql';
import UpdateKeepLatestArtifactProjectSetting from '~/artifacts_settings/graphql/mutations/update_keep_latest_artifact_project_setting.mutation.graphql';
const localVue = createLocalVue();
localVue.use(VueApollo);
const keepLatestArtifactMock = {
const keepLatestArtifactProjectMock = {
data: {
project: {
ciCdSettings: { keepLatestArtifact: true },
@ -17,6 +18,14 @@ const keepLatestArtifactMock = {
},
};
const keepLatestArtifactApplicationMock = {
data: {
ciApplicationSettings: {
keepLatestArtifact: true,
},
},
};
const keepLatestArtifactMockResponse = {
data: { ciCdSettingsUpdate: { errors: [], __typename: 'CiCdSettingsUpdatePayload' } },
};
@ -34,7 +43,12 @@ describe('Keep latest artifact checkbox', () => {
const createComponent = (handlers) => {
requestHandlers = {
keepLatestArtifactQueryHandler: jest.fn().mockResolvedValue(keepLatestArtifactMock),
keepLatestArtifactProjectQueryHandler: jest
.fn()
.mockResolvedValue(keepLatestArtifactProjectMock),
keepLatestArtifactApplicationQueryHandler: jest
.fn()
.mockResolvedValue(keepLatestArtifactApplicationMock),
keepLatestArtifactMutationHandler: jest
.fn()
.mockResolvedValue(keepLatestArtifactMockResponse),
@ -42,7 +56,11 @@ describe('Keep latest artifact checkbox', () => {
};
apolloProvider = createMockApollo([
[GetKeepLatestArtifactProjectSetting, requestHandlers.keepLatestArtifactQueryHandler],
[GetKeepLatestArtifactProjectSetting, requestHandlers.keepLatestArtifactProjectQueryHandler],
[
GetKeepLatestArtifactApplicationSetting,
requestHandlers.keepLatestArtifactApplicationQueryHandler,
],
[UpdateKeepLatestArtifactProjectSetting, requestHandlers.keepLatestArtifactMutationHandler],
]);
@ -51,38 +69,74 @@ describe('Keep latest artifact checkbox', () => {
fullPath,
helpPagePath,
},
stubs: {
GlFormCheckbox,
},
localVue,
apolloProvider,
});
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
apolloProvider = null;
});
it('displays the checkbox and the help link', () => {
expect(findCheckbox().exists()).toBe(true);
expect(findHelpLink().exists()).toBe(true);
describe('default', () => {
beforeEach(() => {
createComponent();
});
it('displays the checkbox and the help link', () => {
expect(findCheckbox().exists()).toBe(true);
expect(findHelpLink().exists()).toBe(true);
});
it('calls mutation on artifact setting change with correct payload', () => {
findCheckbox().vm.$emit('change', false);
expect(requestHandlers.keepLatestArtifactMutationHandler).toHaveBeenCalledWith({
fullPath,
keepLatestArtifact: false,
});
});
});
it('sets correct setting value in checkbox with query result', async () => {
await wrapper.vm.$nextTick();
describe('when application keep latest artifact setting is enabled', () => {
beforeEach(() => {
createComponent();
});
expect(wrapper.element).toMatchSnapshot();
it('sets correct setting value in checkbox with query result', async () => {
await wrapper.vm.$nextTick();
expect(wrapper.element).toMatchSnapshot();
});
it('checkbox is enabled when application setting is enabled', async () => {
await wrapper.vm.$nextTick();
expect(findCheckbox().attributes('disabled')).toBeUndefined();
});
});
it('calls mutation on artifact setting change with correct payload', () => {
findCheckbox().vm.$emit('change', false);
describe('when application keep latest artifact setting is disabled', () => {
it('checkbox is disabled when application setting is disabled', async () => {
createComponent({
keepLatestArtifactApplicationQueryHandler: jest.fn().mockResolvedValue({
data: {
ciApplicationSettings: {
keepLatestArtifact: false,
},
},
}),
});
expect(requestHandlers.keepLatestArtifactMutationHandler).toHaveBeenCalledWith({
fullPath,
keepLatestArtifact: false,
await wrapper.vm.$nextTick();
expect(wrapper.element).toMatchSnapshot();
expect(findCheckbox().attributes('disabled')).toBe('true');
});
});
});

View File

@ -235,7 +235,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Build do
with_them do
before do
project.update!(ci_keep_latest_artifact: keep_latest_artifact)
project.update!(keep_latest_artifact: keep_latest_artifact)
end
it 'builds a pipeline with appropriate locked value' do

View File

@ -27,25 +27,55 @@ RSpec.describe Gitlab::ImportExport::DecompressedArchiveSizeValidator do
end
context 'when file exceeds allowed decompressed size' do
it 'returns false' do
it 'logs error message returns false' do
expect(Gitlab::Import::Logger)
.to receive(:info)
.with(
import_upload_archive_path: filepath,
import_upload_archive_size: File.size(filepath),
message: 'Decompressed archive size limit reached'
)
expect(subject.valid?).to eq(false)
end
end
context 'when something goes wrong during decompression' do
before do
allow(subject.archive_file).to receive(:eof?).and_raise(StandardError)
context 'when exception occurs during decompression' do
shared_examples 'logs raised exception and terminates validator process group' do
let(:std) { double(:std, close: nil, value: nil) }
let(:wait_thr) { double }
before do
allow(Process).to receive(:getpgid).and_return(2)
allow(Open3).to receive(:popen3).and_return([std, std, std, wait_thr])
allow(wait_thr).to receive(:[]).with(:pid).and_return(1)
allow(wait_thr).to receive(:value).and_raise(exception)
end
it 'logs raised exception and terminates validator process group' do
expect(Gitlab::Import::Logger)
.to receive(:info)
.with(
import_upload_archive_path: filepath,
import_upload_archive_size: File.size(filepath),
message: error_message
)
expect(Process).to receive(:kill).with(-1, 2)
expect(subject.valid?).to eq(false)
end
end
it 'logs and tracks raised exception' do
expect(Gitlab::ErrorTracking).to receive(:track_exception).with(instance_of(StandardError))
expect(Gitlab::Import::Logger).to receive(:info).with(hash_including(message: 'Decompressed archive size validation failed.'))
context 'when timeout occurs' do
let(:error_message) { 'Timeout reached during archive decompression' }
let(:exception) { Timeout::Error }
subject.valid?
include_examples 'logs raised exception and terminates validator process group'
end
it 'returns false' do
expect(subject.valid?).to eq(false)
context 'when exception occurs' do
let(:error_message) { 'Error!' }
let(:exception) { StandardError.new(error_message) }
include_examples 'logs raised exception and terminates validator process group'
end
end
end

View File

@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe ProjectCiCdSetting do
using RSpec::Parameterized::TableSyntax
describe 'validations' do
it 'validates default_git_depth is between 0 and 1000 or nil' do
expect(subject).to validate_numericality_of(:default_git_depth)
@ -36,4 +38,39 @@ RSpec.describe ProjectCiCdSetting do
expect(project.reload.ci_cd_settings.default_git_depth).to eq(0)
end
end
describe '#keep_latest_artifacts_available?' do
let(:attrs) { { keep_latest_artifact: project_enabled } }
let(:project_settings) { described_class.new(attrs) }
subject { project_settings.keep_latest_artifacts_available? }
context 'without application setting record' do
where(:project_enabled, :result_keep_latest_artifact) do
false | false
true | true
end
with_them do
it { expect(subject).to eq(result_keep_latest_artifact) }
end
end
context 'with application setting record' do
where(:instance_enabled, :project_enabled, :result_keep_latest_artifact) do
false | false | false
false | true | false
true | false | false
true | true | true
end
before do
Gitlab::CurrentSettings.current_application_settings.update!(keep_latest_artifact: instance_enabled)
end
with_them do
it { expect(subject).to eq(result_keep_latest_artifact) }
end
end
end
end

View File

@ -559,6 +559,25 @@ RSpec.describe Project, factory_default: :keep do
end
end
describe '#default_pipeline_lock' do
let(:project) { build_stubbed(:project) }
subject { project.default_pipeline_lock }
where(:keep_latest_artifact_enabled, :result_pipeline_locked) do
false | :unlocked
true | :artifacts_locked
end
before do
allow(project).to receive(:keep_latest_artifacts_available?).and_return(keep_latest_artifact_enabled)
end
with_them do
it { expect(subject).to eq(result_pipeline_locked) }
end
end
describe '#autoclose_referenced_issues' do
context 'when DB entry is nil' do
let(:project) { build(:project, autoclose_referenced_issues: nil) }

View File

@ -0,0 +1,49 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'getting Application Settings' do
include GraphqlHelpers
let(:fields) do
<<~QUERY
#{all_graphql_fields_for('CiApplicationSettings', max_depth: 1)}
QUERY
end
let(:query) do
graphql_query_for(
'ciApplicationSettings',
fields
)
end
let(:settings_data) { graphql_data['ciApplicationSettings'] }
context 'without admin permissions' do
let(:user) { create(:user) }
before do
post_graphql(query, current_user: user)
end
it_behaves_like 'a working graphql query'
specify { expect(settings_data).to be nil }
end
context 'with admin permissions' do
let(:user) { create(:user, :admin) }
before do
post_graphql(query, current_user: user)
end
it_behaves_like 'a working graphql query'
it 'fetches the settings data' do
# assert against hash to ensure no additional fields are exposed
expect(settings_data).to match({ 'keepLatestArtifact' => Gitlab::CurrentSettings.current_application_settings.keep_latest_artifact })
end
end
end

View File

@ -46,7 +46,7 @@ RSpec.describe 'Getting Ci Cd Setting' do
it 'fetches the settings data' do
expect(settings_data['mergePipelinesEnabled']).to eql project.ci_cd_settings.merge_pipelines_enabled?
expect(settings_data['mergeTrainsEnabled']).to eql project.ci_cd_settings.merge_trains_enabled?
expect(settings_data['keepLatestArtifact']).to eql project.ci_keep_latest_artifact?
expect(settings_data['keepLatestArtifact']).to eql project.keep_latest_artifacts_available?
end
end
end

View File

@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'CiCdSettingsUpdate' do
include GraphqlHelpers
let_it_be(:project) { create(:project, ci_keep_latest_artifact: true) }
let_it_be(:project) { create(:project, keep_latest_artifact: true) }
let(:variables) { { full_path: project.full_path, keep_latest_artifact: false } }
let(:mutation) { graphql_mutation(:ci_cd_settings_update, variables) }
@ -42,7 +42,7 @@ RSpec.describe 'CiCdSettingsUpdate' do
project.reload
expect(response).to have_gitlab_http_status(:success)
expect(project.ci_keep_latest_artifact).to eq(false)
expect(project.keep_latest_artifact).to eq(false)
end
context 'when bad arguments are provided' do

View File

@ -15,7 +15,7 @@ RSpec.describe 'package details' do
end
let(:depth) { 3 }
let(:excluded) { ['metadata'] }
let(:excluded) { %w[metadata apiFuzzingCiConfiguration] }
let(:query) do
graphql_query_for(:package, { id: package_global_id }, <<~FIELDS)