Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
71da67f3
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
71da67f3
编写于
3月 23, 2020
作者:
G
GitLab Bot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add latest changes from gitlab-org/gitlab@master
上级
f2dfd9ee
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
107 addition
and
8 deletion
+107
-8
GITLAB_WORKHORSE_VERSION
GITLAB_WORKHORSE_VERSION
+1
-1
app/models/alerting/project_alerting_setting.rb
app/models/alerting/project_alerting_setting.rb
+28
-0
app/models/project.rb
app/models/project.rb
+2
-0
doc/ci/ci_cd_for_external_repos/index.md
doc/ci/ci_cd_for_external_repos/index.md
+0
-4
doc/user/img/new_personal_snippet_from_project_v12_10.png
doc/user/img/new_personal_snippet_from_project_v12_10.png
+0
-0
doc/user/img/new_personal_snippet_v12_10.png
doc/user/img/new_personal_snippet_v12_10.png
+0
-0
doc/user/img/new_project_snippet_from_project_v12_10.png
doc/user/img/new_project_snippet_from_project_v12_10.png
+0
-0
doc/user/project/repository/repository_mirroring.md
doc/user/project/repository/repository_mirroring.md
+0
-3
doc/user/snippets.md
doc/user/snippets.md
+27
-0
spec/factories/project_alerting_settings.rb
spec/factories/project_alerting_settings.rb
+8
-0
spec/models/alerting/project_alerting_setting_spec.rb
spec/models/alerting/project_alerting_setting_spec.rb
+40
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-0
未找到文件。
GITLAB_WORKHORSE_VERSION
浏览文件 @
71da67f3
8.2
6
.0
8.2
7
.0
app/models/alerting/project_alerting_setting.rb
0 → 100644
浏览文件 @
71da67f3
# frozen_string_literal: true
require
'securerandom'
module
Alerting
class
ProjectAlertingSetting
<
ApplicationRecord
belongs_to
:project
validates
:token
,
presence:
true
attr_encrypted
:token
,
mode: :per_attribute_iv
,
key:
Settings
.
attr_encrypted_db_key_base_truncated
,
algorithm:
'aes-256-gcm'
before_validation
:ensure_token
private
def
ensure_token
self
.
token
||=
generate_token
end
def
generate_token
SecureRandom
.
hex
end
end
end
app/models/project.rb
浏览文件 @
71da67f3
...
@@ -199,6 +199,7 @@ class Project < ApplicationRecord
...
@@ -199,6 +199,7 @@ class Project < ApplicationRecord
has_one
:metrics_setting
,
inverse_of: :project
,
class_name:
'ProjectMetricsSetting'
has_one
:metrics_setting
,
inverse_of: :project
,
class_name:
'ProjectMetricsSetting'
has_one
:grafana_integration
,
inverse_of: :project
has_one
:grafana_integration
,
inverse_of: :project
has_one
:project_setting
,
->
(
project
)
{
where_or_create_by
(
project:
project
)
},
inverse_of: :project
has_one
:project_setting
,
->
(
project
)
{
where_or_create_by
(
project:
project
)
},
inverse_of: :project
has_one
:alerting_setting
,
inverse_of: :project
,
class_name:
'Alerting::ProjectAlertingSetting'
# Merge Requests for target project should be removed with it
# Merge Requests for target project should be removed with it
has_many
:merge_requests
,
foreign_key:
'target_project_id'
,
inverse_of: :target_project
has_many
:merge_requests
,
foreign_key:
'target_project_id'
,
inverse_of: :target_project
...
@@ -332,6 +333,7 @@ class Project < ApplicationRecord
...
@@ -332,6 +333,7 @@ class Project < ApplicationRecord
accepts_nested_attributes_for
:metrics_setting
,
update_only:
true
,
allow_destroy:
true
accepts_nested_attributes_for
:metrics_setting
,
update_only:
true
,
allow_destroy:
true
accepts_nested_attributes_for
:grafana_integration
,
update_only:
true
,
allow_destroy:
true
accepts_nested_attributes_for
:grafana_integration
,
update_only:
true
,
allow_destroy:
true
accepts_nested_attributes_for
:prometheus_service
,
update_only:
true
accepts_nested_attributes_for
:prometheus_service
,
update_only:
true
accepts_nested_attributes_for
:alerting_setting
,
update_only:
true
delegate
:feature_available?
,
:builds_enabled?
,
:wiki_enabled?
,
delegate
:feature_available?
,
:builds_enabled?
,
:wiki_enabled?
,
:merge_requests_enabled?
,
:forking_enabled?
,
:issues_enabled?
,
:merge_requests_enabled?
,
:forking_enabled?
,
:issues_enabled?
,
...
...
doc/ci/ci_cd_for_external_repos/index.md
浏览文件 @
71da67f3
...
@@ -6,10 +6,6 @@ type: index, howto
...
@@ -6,10 +6,6 @@ type: index, howto
>[Introduced][ee-4642] in [GitLab Premium][eep] 10.6.
>[Introduced][ee-4642] in [GitLab Premium][eep] 10.6.
NOTE:
**Note:**
This feature
[
is available for free
](
https://about.gitlab.com/blog/2019/09/09/ci-cd-github-extended-again/
)
to
GitLab.com users until March 22nd, 2020.
GitLab CI/CD can be used with:
GitLab CI/CD can be used with:
-
[
GitHub
](
github_integration.md
)
.
-
[
GitHub
](
github_integration.md
)
.
...
...
doc/user/img/new_personal_snippet_from_project_v12_10.png
0 → 100644
浏览文件 @
71da67f3
75.3 KB
doc/user/img/new_personal_snippet_v12_10.png
0 → 100644
浏览文件 @
71da67f3
38.9 KB
doc/user/img/new_project_snippet_from_project_v12_10.png
0 → 100644
浏览文件 @
71da67f3
72.1 KB
doc/user/project/repository/repository_mirroring.md
浏览文件 @
71da67f3
...
@@ -110,9 +110,6 @@ The repository will push soon. To force a push, click the appropriate button.
...
@@ -110,9 +110,6 @@ The repository will push soon. To force a push, click the appropriate button.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51) in GitLab Enterprise Edition 8.2.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51) in GitLab Enterprise Edition 8.2.
> - [Added Git LFS support](https://gitlab.com/gitlab-org/gitlab/issues/10871) in [GitLab Starter](https://about.gitlab.com/pricing/) 11.11.
> - [Added Git LFS support](https://gitlab.com/gitlab-org/gitlab/issues/10871) in [GitLab Starter](https://about.gitlab.com/pricing/) 11.11.
NOTE:
**Note:**
This feature
[
is available for free
](
https://gitlab.com/gitlab-org/gitlab/issues/10361
)
to
GitLab.com users until March 22nd, 2020.
You can set up a repository to automatically have its branches, tags, and commits updated from an
You can set up a repository to automatically have its branches, tags, and commits updated from an
upstream repository.
upstream repository.
...
...
doc/user/snippets.md
浏览文件 @
71da67f3
...
@@ -22,6 +22,33 @@ and private. See [Public access](../public_access/public_access.md) for more inf
...
@@ -22,6 +22,33 @@ and private. See [Public access](../public_access/public_access.md) for more inf
Project snippets are always related to a specific project.
Project snippets are always related to a specific project.
See
[
Project features
](
project/index.md#project-features
)
for more information.
See
[
Project features
](
project/index.md#project-features
)
for more information.
## Create a snippet
To create a personal snippet, click the plus icon (
**{plus-square-o}**
)
on the top navigation and select
**New snippet**
from the dropdown menu:
![
New personal snippet from non-project pages
](
img/new_personal_snippet_v12_10.png
)
If you're on a project's page but you want to create a new personal snippet,
click the plus icon (
**{plus-square-o}**
) and select
**New snippet**
from the
lower part of the dropdown (
**GitLab**
on GitLab.com;
**Your Instance**
on
self-managed instances):
![
New personal snippet from project pages
](
img/new_personal_snippet_from_project_v12_10.png
)
To create a project snippet, navigate to your project's page and click the
plus icon (
**{plus-square-o}**
), then select
**New snippet**
from the upper
part of the dropdown (
**This project**
).
![
New personal snippet from project pages
](
img/new_project_snippet_from_project_v12_10.png
)
From there, add the
**Title**
,
**Description**
, and a
**File**
name with the
appropriate extension (for example,
`example.rb`
,
`index.html`
).
CAUTION:
**Warning:**
Make sure to add the file name to get code highlighting and to avoid this
[
copy-pasting bug
](
https://gitlab.com/gitlab-org/gitlab/-/issues/22870
)
.
## Discover snippets
## Discover snippets
There are two main ways of how you can discover snippets in GitLab.
There are two main ways of how you can discover snippets in GitLab.
...
...
spec/factories/project_alerting_settings.rb
0 → 100644
浏览文件 @
71da67f3
# frozen_string_literal: true
FactoryBot
.
define
do
factory
:project_alerting_setting
,
class:
'Alerting::ProjectAlertingSetting'
do
project
token
{
'access_token_123'
}
end
end
spec/models/alerting/project_alerting_setting_spec.rb
0 → 100644
浏览文件 @
71da67f3
# frozen_string_literal: true
require
'spec_helper'
describe
Alerting
::
ProjectAlertingSetting
do
let_it_be
(
:project
)
{
create
(
:project
)
}
subject
{
create
(
:project_alerting_setting
,
project:
project
)
}
describe
'Associations'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
end
describe
'#token'
do
context
'when set'
do
let
(
:token
)
{
SecureRandom
.
hex
}
subject
do
create
(
:project_alerting_setting
,
project:
project
,
token:
token
)
end
it
'reads the token'
do
expect
(
subject
.
token
).
to
eq
(
token
)
expect
(
subject
.
encrypted_token
).
not_to
be_nil
expect
(
subject
.
encrypted_token_iv
).
not_to
be_nil
end
end
context
'when not set'
do
before
do
subject
.
token
=
nil
end
it
'generates a token before validation'
do
expect
(
subject
).
to
be_valid
expect
(
subject
.
token
).
to
match
(
/\A\h{32}\z/
)
end
end
end
end
spec/models/project_spec.rb
浏览文件 @
71da67f3
...
@@ -70,6 +70,7 @@ describe Project do
...
@@ -70,6 +70,7 @@ describe Project do
it
{
is_expected
.
to
have_one
(
:auto_devops
).
class_name
(
'ProjectAutoDevops'
)
}
it
{
is_expected
.
to
have_one
(
:auto_devops
).
class_name
(
'ProjectAutoDevops'
)
}
it
{
is_expected
.
to
have_one
(
:error_tracking_setting
).
class_name
(
'ErrorTracking::ProjectErrorTrackingSetting'
)
}
it
{
is_expected
.
to
have_one
(
:error_tracking_setting
).
class_name
(
'ErrorTracking::ProjectErrorTrackingSetting'
)
}
it
{
is_expected
.
to
have_one
(
:project_setting
)
}
it
{
is_expected
.
to
have_one
(
:project_setting
)
}
it
{
is_expected
.
to
have_one
(
:alerting_setting
).
class_name
(
'Alerting::ProjectAlertingSetting'
)
}
it
{
is_expected
.
to
have_many
(
:commit_statuses
)
}
it
{
is_expected
.
to
have_many
(
:commit_statuses
)
}
it
{
is_expected
.
to
have_many
(
:ci_pipelines
)
}
it
{
is_expected
.
to
have_many
(
:ci_pipelines
)
}
it
{
is_expected
.
to
have_many
(
:ci_refs
)
}
it
{
is_expected
.
to
have_many
(
:ci_refs
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录