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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e1ef436d
Commit
e1ef436d
authored
Aug 17, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update application code by the db schema change
parent
0a7b3ae9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
19 deletions
+15
-19
app/models/ci/build.rb
app/models/ci/build.rb
+1
-5
app/models/ci/runner.rb
app/models/ci/runner.rb
+3
-3
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+1
-6
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+1
-1
app/views/projects/runners/_form.html.haml
app/views/projects/runners/_form.html.haml
+1
-1
app/views/projects/runners/show.html.haml
app/views/projects/runners/show.html.haml
+1
-1
db/migrate/20170816133938_add_access_level_to_ci_runners.rb
db/migrate/20170816133938_add_access_level_to_ci_runners.rb
+1
-1
lib/gitlab/ci/stage/seed.rb
lib/gitlab/ci/stage/seed.rb
+6
-1
No files found.
app/models/ci/build.rb
View file @
e1ef436d
...
@@ -34,11 +34,7 @@ module Ci
...
@@ -34,11 +34,7 @@ module Ci
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:manual_actions
,
->
()
{
where
(
when: :manual
,
status:
COMPLETED_STATUSES
+
[
:manual
])
}
scope
:manual_actions
,
->
()
{
where
(
when: :manual
,
status:
COMPLETED_STATUSES
+
[
:manual
])
}
scope
:protected_
,
->
{
where
(
protected:
true
)
}
scope
:on_protected
,
->
()
do
joins
(
"LEFT JOIN ci_pipelines ON ci_builds.commit_id = ci_pipelines.id"
)
.
where
(
'ci_pipelines.protected IS TRUE'
)
end
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
...
...
app/models/ci/runner.rb
View file @
e1ef436d
...
@@ -5,7 +5,7 @@ module Ci
...
@@ -5,7 +5,7 @@ module Ci
RUNNER_QUEUE_EXPIRY_TIME
=
60
.
minutes
RUNNER_QUEUE_EXPIRY_TIME
=
60
.
minutes
ONLINE_CONTACT_TIMEOUT
=
1
.
hour
ONLINE_CONTACT_TIMEOUT
=
1
.
hour
AVAILABLE_SCOPES
=
%w[specific shared active paused online]
.
freeze
AVAILABLE_SCOPES
=
%w[specific shared active paused online]
.
freeze
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked
protected
]
.
freeze
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked
access_level
]
.
freeze
has_many
:builds
has_many
:builds
has_many
:runner_projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:runner_projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
...
@@ -41,8 +41,8 @@ module Ci
...
@@ -41,8 +41,8 @@ module Ci
after_destroy
:cleanup_runner_queue
after_destroy
:cleanup_runner_queue
enum
access_level:
{
enum
access_level:
{
protection_none
:
0
,
unprotected
:
0
,
protect
ion_full
:
1
protect
ed_
:
1
}
}
# Searches for runners matching the given query.
# Searches for runners matching the given query.
...
...
app/services/ci/create_pipeline_service.rb
View file @
e1ef436d
...
@@ -12,8 +12,7 @@ module Ci
...
@@ -12,8 +12,7 @@ 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:
protected
?
)
)
result
=
validate
(
current_user
,
result
=
validate
(
current_user
,
...
@@ -176,10 +175,6 @@ module Ci
...
@@ -176,10 +175,6 @@ module Ci
origin_sha
&&
origin_sha
!=
Gitlab
::
Git
::
BLANK_SHA
origin_sha
&&
origin_sha
!=
Gitlab
::
Git
::
BLANK_SHA
end
end
def
protected?
project
.
protected_for?
(
ref
)
end
def
error
(
message
,
save:
false
)
def
error
(
message
,
save:
false
)
pipeline
.
tap
do
pipeline
.
tap
do
pipeline
.
errors
.
add
(
:base
,
message
)
pipeline
.
errors
.
add
(
:base
,
message
)
...
...
app/services/ci/register_job_service.rb
View file @
e1ef436d
...
@@ -78,7 +78,7 @@ module Ci
...
@@ -78,7 +78,7 @@ module Ci
def
new_builds
def
new_builds
builds
=
Ci
::
Build
.
pending
.
unstarted
builds
=
Ci
::
Build
.
pending
.
unstarted
builds
=
builds
.
on_protected
if
runner
.
protected
?
builds
=
builds
.
protected_
if
runner
.
protected_
?
builds
builds
end
end
...
...
app/views/projects/runners/_form.html.haml
View file @
e1ef436d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
=
label
:protected
,
"Protected"
,
class:
'control-label'
=
label
:protected
,
"Protected"
,
class:
'control-label'
.col-sm-10
.col-sm-10
.checkbox
.checkbox
=
f
.
check_box
:
protected
=
f
.
check_box
:
access_level
,
1
,
0
%span
.light
This runner will only run on pipelines trigged on protected branches
%span
.light
This runner will only run on pipelines trigged on protected branches
.form-group
.form-group
=
label
:run_untagged
,
'Run untagged jobs'
,
class:
'control-label'
=
label
:run_untagged
,
'Run untagged jobs'
,
class:
'control-label'
...
...
app/views/projects/runners/show.html.haml
View file @
e1ef436d
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
%td
=
@runner
.
active?
?
'Yes'
:
'No'
%td
=
@runner
.
active?
?
'Yes'
:
'No'
%tr
%tr
%td
Protected
%td
Protected
%td
=
@runner
.
protected?
?
'Yes'
:
'No'
%td
=
@runner
.
protected
_
?
?
'Yes'
:
'No'
%tr
%tr
%td
Can run untagged jobs
%td
Can run untagged jobs
%td
=
@runner
.
run_untagged?
?
'Yes'
:
'No'
%td
=
@runner
.
run_untagged?
?
'Yes'
:
'No'
...
...
db/migrate/20170816133938_add_access_level_to_ci_runners.rb
View file @
e1ef436d
...
@@ -6,7 +6,7 @@ class AddAccessLevelToCiRunners < ActiveRecord::Migration
...
@@ -6,7 +6,7 @@ class AddAccessLevelToCiRunners < ActiveRecord::Migration
disable_ddl_transaction!
disable_ddl_transaction!
def
up
def
up
# Ci::Runner.
protection_none
: 0
# Ci::Runner.
unprotected
: 0
add_column_with_default
(
:ci_runners
,
:access_level
,
:integer
,
default:
0
)
add_column_with_default
(
:ci_runners
,
:access_level
,
:integer
,
default:
0
)
end
end
...
...
lib/gitlab/ci/stage/seed.rb
View file @
e1ef436d
...
@@ -28,10 +28,15 @@ module Gitlab
...
@@ -28,10 +28,15 @@ 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
?)
end
end
end
end
def
protected?
@protected
||=
project
.
protected_for?
(
pipeline
.
ref
)
end
def
create!
def
create!
pipeline
.
stages
.
create!
(
stage
).
tap
do
|
stage
|
pipeline
.
stages
.
create!
(
stage
).
tap
do
|
stage
|
builds_attributes
=
builds
.
map
do
|
attributes
|
builds_attributes
=
builds
.
map
do
|
attributes
|
...
...
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