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
Jérome Perrin
gitlab-ce
Commits
c4c383e6
Commit
c4c383e6
authored
Sep 07, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert set_protected
parent
4b8c52f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
app/models/ci/build.rb
app/models/ci/build.rb
+1
-5
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+1
-5
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+2
-1
lib/gitlab/ci/stage/seed.rb
lib/gitlab/ci/stage/seed.rb
+8
-1
No files found.
app/models/ci/build.rb
View file @
c4c383e6
...
@@ -27,6 +27,7 @@ module Ci
...
@@ -27,6 +27,7 @@ module Ci
validates
:coverage
,
numericality:
true
,
allow_blank:
true
validates
:coverage
,
numericality:
true
,
allow_blank:
true
validates
:ref
,
presence:
true
validates
:ref
,
presence:
true
validates
:protected
,
inclusion:
{
in:
[
true
,
false
],
unless: :importing?
},
on: :create
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
...
@@ -46,7 +47,6 @@ module Ci
...
@@ -46,7 +47,6 @@ module Ci
before_save
:update_artifacts_size
,
if: :artifacts_file_changed?
before_save
:update_artifacts_size
,
if: :artifacts_file_changed?
before_save
:ensure_token
before_save
:ensure_token
before_save
:set_protected
before_destroy
{
unscoped_project
}
before_destroy
{
unscoped_project
}
after_create
do
|
build
|
after_create
do
|
build
|
...
@@ -461,10 +461,6 @@ module Ci
...
@@ -461,10 +461,6 @@ module Ci
end
end
end
end
def
set_protected
self
.
protected
=
pipeline
.
protected
end
def
erase_trace!
def
erase_trace!
trace
.
erase!
trace
.
erase!
end
end
...
...
app/models/ci/pipeline.rb
View file @
c4c383e6
...
@@ -36,9 +36,9 @@ module Ci
...
@@ -36,9 +36,9 @@ module Ci
validates
:sha
,
presence:
{
unless: :importing?
}
validates
:sha
,
presence:
{
unless: :importing?
}
validates
:ref
,
presence:
{
unless: :importing?
}
validates
:ref
,
presence:
{
unless: :importing?
}
validates
:status
,
presence:
{
unless: :importing?
}
validates
:status
,
presence:
{
unless: :importing?
}
validates
:protected
,
inclusion:
{
in:
[
true
,
false
],
unless: :importing?
},
on: :create
validate
:valid_commit_sha
,
unless: :importing?
validate
:valid_commit_sha
,
unless: :importing?
before_save
:set_protected
after_create
:keep_around_commits
,
unless: :importing?
after_create
:keep_around_commits
,
unless: :importing?
enum
source:
{
enum
source:
{
...
@@ -445,10 +445,6 @@ module Ci
...
@@ -445,10 +445,6 @@ module Ci
statuses
.
latest
.
status
||
'skipped'
statuses
.
latest
.
status
||
'skipped'
end
end
def
set_protected
self
.
protected
=
project
.
protected_for?
(
self
.
ref
)
end
def
keep_around_commits
def
keep_around_commits
return
unless
project
return
unless
project
...
...
app/services/ci/create_pipeline_service.rb
View file @
c4c383e6
...
@@ -12,7 +12,8 @@ module Ci
...
@@ -12,7 +12,8 @@ module Ci
tag:
tag?
,
tag:
tag?
,
trigger_requests:
Array
(
trigger_request
),
trigger_requests:
Array
(
trigger_request
),
user:
current_user
,
user:
current_user
,
pipeline_schedule:
schedule
pipeline_schedule:
schedule
,
protected:
project
.
protected_for?
(
ref
)
)
)
result
=
validate
(
current_user
,
result
=
validate
(
current_user
,
...
...
lib/gitlab/ci/stage/seed.rb
View file @
c4c383e6
...
@@ -28,7 +28,8 @@ module Gitlab
...
@@ -28,7 +28,8 @@ module Gitlab
attributes
.
merge
(
project:
project
,
attributes
.
merge
(
project:
project
,
ref:
pipeline
.
ref
,
ref:
pipeline
.
ref
,
tag:
pipeline
.
tag
,
tag:
pipeline
.
tag
,
trigger_request:
trigger
)
trigger_request:
trigger
,
protected:
protected_ref?
)
end
end
end
end
...
@@ -43,6 +44,12 @@ module Gitlab
...
@@ -43,6 +44,12 @@ module Gitlab
end
end
end
end
end
end
private
def
protected_ref?
@protected_ref
||=
project
.
protected_for?
(
pipeline
.
ref
)
end
end
end
end
end
end
end
...
...
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