Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
71da67f3
Commit
71da67f3
authored
Mar 23, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
f2dfd9ee
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
107 additions
and
8 deletions
+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
No files found.
GITLAB_WORKHORSE_VERSION
View file @
71da67f3
8.2
6
.0
8.2
7
.0
app/models/alerting/project_alerting_setting.rb
0 → 100644
View file @
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
View file @
71da67f3
...
...
@@ -199,6 +199,7 @@ class Project < ApplicationRecord
has_one
:metrics_setting
,
inverse_of: :project
,
class_name:
'ProjectMetricsSetting'
has_one
:grafana_integration
,
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
has_many
:merge_requests
,
foreign_key:
'target_project_id'
,
inverse_of: :target_project
...
...
@@ -332,6 +333,7 @@ class Project < ApplicationRecord
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
:prometheus_service
,
update_only:
true
accepts_nested_attributes_for
:alerting_setting
,
update_only:
true
delegate
:feature_available?
,
:builds_enabled?
,
:wiki_enabled?
,
:merge_requests_enabled?
,
:forking_enabled?
,
:issues_enabled?
,
...
...
doc/ci/ci_cd_for_external_repos/index.md
View file @
71da67f3
...
...
@@ -6,10 +6,6 @@ type: index, howto
>[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:
-
[
GitHub
](
github_integration.md
)
.
...
...
doc/user/img/new_personal_snippet_from_project_v12_10.png
0 → 100644
View file @
71da67f3
75.3 KB
doc/user/img/new_personal_snippet_v12_10.png
0 → 100644
View file @
71da67f3
38.9 KB
doc/user/img/new_project_snippet_from_project_v12_10.png
0 → 100644
View file @
71da67f3
72.1 KB
doc/user/project/repository/repository_mirroring.md
View file @
71da67f3
...
...
@@ -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.
> - [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
upstream repository.
...
...
doc/user/snippets.md
View file @
71da67f3
...
...
@@ -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.
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
There are two main ways of how you can discover snippets in GitLab.
...
...
spec/factories/project_alerting_settings.rb
0 → 100644
View file @
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
View file @
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
View file @
71da67f3
...
...
@@ -70,6 +70,7 @@ describe Project do
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
(
: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
(
:ci_pipelines
)
}
it
{
is_expected
.
to
have_many
(
:ci_refs
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment