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
Boxiang Sun
gitlab-ce
Commits
9f5ac179
Commit
9f5ac179
authored
Jul 05, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ci_config_file to ci_config_path
parent
9f7e5e45
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
36 additions
and
36 deletions
+36
-36
app/controllers/projects/pipelines_settings_controller.rb
app/controllers/projects/pipelines_settings_controller.rb
+1
-1
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+2
-2
app/models/project.rb
app/models/project.rb
+3
-3
app/views/projects/pipelines_settings/_show.html.haml
app/views/projects/pipelines_settings/_show.html.haml
+3
-3
db/migrate/20160804142904_add_ci_config_file_to_project.rb
db/migrate/20160804142904_add_ci_config_file_to_project.rb
+2
-2
db/schema.rb
db/schema.rb
+1
-1
doc/api/projects.md
doc/api/projects.md
+3
-3
doc/user/project/pipelines/settings.md
doc/user/project/pipelines/settings.md
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+1
-1
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+1
-1
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+4
-4
spec/models/project_spec.rb
spec/models/project_spec.rb
+10
-10
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+2
-2
No files found.
app/controllers/projects/pipelines_settings_controller.rb
View file @
9f5ac179
...
@@ -23,7 +23,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
...
@@ -23,7 +23,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
def
update_params
def
update_params
params
.
require
(
:project
).
permit
(
params
.
require
(
:project
).
permit
(
:runners_token
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
:runners_token
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
:public_builds
,
:auto_cancel_pending_pipelines
,
:ci_config_
file
:public_builds
,
:auto_cancel_pending_pipelines
,
:ci_config_
path
)
)
end
end
end
end
app/models/ci/pipeline.rb
View file @
9f5ac179
...
@@ -327,10 +327,10 @@ module Ci
...
@@ -327,10 +327,10 @@ module Ci
end
end
def
ci_yaml_file_path
def
ci_yaml_file_path
if
project
.
ci_config_
file
.
blank?
if
project
.
ci_config_
path
.
blank?
'.gitlab-ci.yml'
'.gitlab-ci.yml'
else
else
project
.
ci_config_
file
project
.
ci_config_
path
end
end
end
end
...
...
app/models/project.rb
View file @
9f5ac179
...
@@ -186,7 +186,7 @@ class Project < ActiveRecord::Base
...
@@ -186,7 +186,7 @@ class Project < ActiveRecord::Base
# Validations
# Validations
validates
:creator
,
presence:
true
,
on: :create
validates
:creator
,
presence:
true
,
on: :create
validates
:description
,
length:
{
maximum:
2000
},
allow_blank:
true
validates
:description
,
length:
{
maximum:
2000
},
allow_blank:
true
validates
:ci_config_
file
,
validates
:ci_config_
path
,
format:
{
without:
/\.{2}/
,
format:
{
without:
/\.{2}/
,
message:
'cannot include directory traversal.'
},
message:
'cannot include directory traversal.'
},
length:
{
maximum:
255
},
length:
{
maximum:
255
},
...
@@ -526,7 +526,7 @@ class Project < ActiveRecord::Base
...
@@ -526,7 +526,7 @@ class Project < ActiveRecord::Base
import_data
&
.
destroy
import_data
&
.
destroy
end
end
def
ci_config_
file
=
(
value
)
def
ci_config_
path
=
(
value
)
# Strip all leading slashes so that //foo -> foo
# Strip all leading slashes so that //foo -> foo
super
(
value
&
.
sub
(
%r{
\A
/+}
,
''
)
&
.
delete
(
"
\0
"
))
super
(
value
&
.
sub
(
%r{
\A
/+}
,
''
)
&
.
delete
(
"
\0
"
))
end
end
...
@@ -1025,7 +1025,7 @@ class Project < ActiveRecord::Base
...
@@ -1025,7 +1025,7 @@ class Project < ActiveRecord::Base
visibility_level:
visibility_level
,
visibility_level:
visibility_level
,
path_with_namespace:
path_with_namespace
,
path_with_namespace:
path_with_namespace
,
default_branch:
default_branch
,
default_branch:
default_branch
,
ci_config_
file:
ci_config_file
ci_config_
path:
ci_config_path
}
}
# Backward compatibility
# Backward compatibility
...
...
app/views/projects/pipelines_settings/_show.html.haml
View file @
9f5ac179
...
@@ -47,11 +47,11 @@
...
@@ -47,11 +47,11 @@
%hr
%hr
.form-group
.form-group
=
f
.
label
:ci_config_
file
,
'Custom CI config file
'
,
class:
'label-light'
=
f
.
label
:ci_config_
path
,
'Custom CI config path
'
,
class:
'label-light'
=
f
.
text_field
:ci_config_
file
,
class:
'form-control'
,
placeholder:
'.gitlab-ci.yml'
=
f
.
text_field
:ci_config_
path
,
class:
'form-control'
,
placeholder:
'.gitlab-ci.yml'
%p
.help-block
%p
.help-block
The path to CI config file. Defaults to
<code>
.gitlab-ci.yml
</code>
The path to CI config file. Defaults to
<code>
.gitlab-ci.yml
</code>
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'user/project/pipelines/settings'
,
anchor:
'custom-ci-config-
file
'
),
target:
'_blank'
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'user/project/pipelines/settings'
,
anchor:
'custom-ci-config-
path
'
),
target:
'_blank'
%hr
%hr
.form-group
.form-group
...
...
db/migrate/20160804142904_add_ci_config_file_to_project.rb
View file @
9f5ac179
...
@@ -2,10 +2,10 @@ class AddCiConfigFileToProject < ActiveRecord::Migration
...
@@ -2,10 +2,10 @@ class AddCiConfigFileToProject < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
def
change
def
change
add_column
:projects
,
:ci_config_
file
,
:string
add_column
:projects
,
:ci_config_
path
,
:string
end
end
def
down
def
down
remove_column
:projects
,
:ci_config_
file
remove_column
:projects
,
:ci_config_
path
end
end
end
end
db/schema.rb
View file @
9f5ac179
...
@@ -1085,7 +1085,7 @@ ActiveRecord::Schema.define(version: 20170622162730) do
...
@@ -1085,7 +1085,7 @@ ActiveRecord::Schema.define(version: 20170622162730) do
t
.
string
"import_jid"
t
.
string
"import_jid"
t
.
integer
"cached_markdown_version"
t
.
integer
"cached_markdown_version"
t
.
datetime
"last_repository_updated_at"
t
.
datetime
"last_repository_updated_at"
t
.
string
"ci_config_
file
"
t
.
string
"ci_config_
path
"
end
end
add_index
"projects"
,
[
"ci_id"
],
name:
"index_projects_on_ci_id"
,
using: :btree
add_index
"projects"
,
[
"ci_id"
],
name:
"index_projects_on_ci_id"
,
using: :btree
...
...
doc/api/projects.md
View file @
9f5ac179
...
@@ -346,7 +346,7 @@ Parameters:
...
@@ -346,7 +346,7 @@ Parameters:
|
`tag_list`
| array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
|
`tag_list`
| array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
|
`avatar`
| mixed | no | Image file for avatar of the project |
|
`avatar`
| mixed | no | Image file for avatar of the project |
|
`printing_merge_request_link_enabled`
| boolean | no | Show link to create/view merge request when pushing from the command line |
|
`printing_merge_request_link_enabled`
| boolean | no | Show link to create/view merge request when pushing from the command line |
|
`ci_config_
file
`
| string | no | The path to CI config file |
|
`ci_config_
path
`
| string | no | The path to CI config file |
### Create project for user
### Create project for user
...
@@ -383,7 +383,7 @@ Parameters:
...
@@ -383,7 +383,7 @@ Parameters:
|
`tag_list`
| array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
|
`tag_list`
| array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
|
`avatar`
| mixed | no | Image file for avatar of the project |
|
`avatar`
| mixed | no | Image file for avatar of the project |
|
`printing_merge_request_link_enabled`
| boolean | no | Show link to create/view merge request when pushing from the command line |
|
`printing_merge_request_link_enabled`
| boolean | no | Show link to create/view merge request when pushing from the command line |
|
`ci_config_
file
`
| string | no | The path to CI config file |
|
`ci_config_
path
`
| string | no | The path to CI config file |
### Edit project
### Edit project
...
@@ -418,7 +418,7 @@ Parameters:
...
@@ -418,7 +418,7 @@ Parameters:
|
`request_access_enabled`
| boolean | no | Allow users to request member access |
|
`request_access_enabled`
| boolean | no | Allow users to request member access |
|
`tag_list`
| array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
|
`tag_list`
| array | no | The list of tags for a project; put array of tags, that should be finally assigned to a project |
|
`avatar`
| mixed | no | Image file for avatar of the project |
|
`avatar`
| mixed | no | Image file for avatar of the project |
|
`ci_config_
file
`
| string | no | The path to CI config file |
|
`ci_config_
path
`
| string | no | The path to CI config file |
### Fork project
### Fork project
...
...
doc/user/project/pipelines/settings.md
View file @
9f5ac179
...
@@ -27,7 +27,7 @@ The default value is 60 minutes. Decrease the time limit if you want to impose
...
@@ -27,7 +27,7 @@ The default value is 60 minutes. Decrease the time limit if you want to impose
a hard limit on your jobs' running time or increase it otherwise. In any case,
a hard limit on your jobs' running time or increase it otherwise. In any case,
if the job surpasses the threshold, it is marked as failed.
if the job surpasses the threshold, it is marked as failed.
## Custom CI config
file
## Custom CI config
path
> - [Introduced][ce-12509] in GitLab 9.4.
> - [Introduced][ce-12509] in GitLab 9.4.
...
...
lib/api/entities.rb
View file @
9f5ac179
...
@@ -112,7 +112,7 @@ module API
...
@@ -112,7 +112,7 @@ module API
expose
:open_issues_count
,
if:
lambda
{
|
project
,
options
|
project
.
feature_available?
(
:issues
,
options
[
:current_user
])
&&
project
.
default_issues_tracker?
}
expose
:open_issues_count
,
if:
lambda
{
|
project
,
options
|
project
.
feature_available?
(
:issues
,
options
[
:current_user
])
&&
project
.
default_issues_tracker?
}
expose
:runners_token
,
if:
lambda
{
|
_project
,
options
|
options
[
:user_can_admin_project
]
}
expose
:runners_token
,
if:
lambda
{
|
_project
,
options
|
options
[
:user_can_admin_project
]
}
expose
:public_builds
,
as: :public_jobs
expose
:public_builds
,
as: :public_jobs
expose
:ci_config_
file
expose
:ci_config_
path
expose
:shared_with_groups
do
|
project
,
options
|
expose
:shared_with_groups
do
|
project
,
options
|
SharedGroup
.
represent
(
project
.
project_group_links
.
all
,
options
)
SharedGroup
.
represent
(
project
.
project_group_links
.
all
,
options
)
end
end
...
...
lib/api/projects.rb
View file @
9f5ac179
...
@@ -10,7 +10,7 @@ module API
...
@@ -10,7 +10,7 @@ module API
helpers
do
helpers
do
params
:optional_params_ce
do
params
:optional_params_ce
do
optional
:description
,
type:
String
,
desc:
'The description of the project'
optional
:description
,
type:
String
,
desc:
'The description of the project'
optional
:ci_config_
file
,
type:
String
,
desc:
'The path to CI config file. Defaults to `.gitlab-ci.yml`'
optional
:ci_config_
path
,
type:
String
,
desc:
'The path to CI config file. Defaults to `.gitlab-ci.yml`'
optional
:issues_enabled
,
type:
Boolean
,
desc:
'Flag indication if the issue tracker is enabled'
optional
:issues_enabled
,
type:
Boolean
,
desc:
'Flag indication if the issue tracker is enabled'
optional
:merge_requests_enabled
,
type:
Boolean
,
desc:
'Flag indication if merge requests are enabled'
optional
:merge_requests_enabled
,
type:
Boolean
,
desc:
'Flag indication if merge requests are enabled'
optional
:wiki_enabled
,
type:
Boolean
,
desc:
'Flag indication if the wiki is enabled'
optional
:wiki_enabled
,
type:
Boolean
,
desc:
'Flag indication if the wiki is enabled'
...
...
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
9f5ac179
...
@@ -383,7 +383,7 @@ Project:
...
@@ -383,7 +383,7 @@ Project:
-
printing_merge_request_link_enabled
-
printing_merge_request_link_enabled
-
build_allow_git_fetch
-
build_allow_git_fetch
-
last_repository_updated_at
-
last_repository_updated_at
-
ci_config_
file
-
ci_config_
path
Author
:
Author
:
-
name
-
name
ProjectFeature
:
ProjectFeature
:
...
...
spec/models/ci/build_spec.rb
View file @
9f5ac179
...
@@ -1474,7 +1474,7 @@ describe Ci::Build, :models do
...
@@ -1474,7 +1474,7 @@ describe Ci::Build, :models do
let
(
:ci_config_path
)
{
{
key:
'CI_CONFIG_PATH'
,
value:
'custom'
,
public:
true
}
}
let
(
:ci_config_path
)
{
{
key:
'CI_CONFIG_PATH'
,
value:
'custom'
,
public:
true
}
}
before
do
before
do
project
.
update
(
ci_config_
file
:
'custom'
)
project
.
update
(
ci_config_
path
:
'custom'
)
end
end
it
{
is_expected
.
to
include
(
ci_config_path
)
}
it
{
is_expected
.
to
include
(
ci_config_path
)
}
...
...
spec/models/ci/pipeline_spec.rb
View file @
9f5ac179
...
@@ -752,19 +752,19 @@ describe Ci::Pipeline, models: true do
...
@@ -752,19 +752,19 @@ describe Ci::Pipeline, models: true do
subject
{
pipeline
.
ci_yaml_file_path
}
subject
{
pipeline
.
ci_yaml_file_path
}
it
'returns the path from project'
do
it
'returns the path from project'
do
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
file
)
{
'custom/path'
}
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
path
)
{
'custom/path'
}
is_expected
.
to
eq
(
'custom/path'
)
is_expected
.
to
eq
(
'custom/path'
)
end
end
it
'returns default when custom path is nil'
do
it
'returns default when custom path is nil'
do
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
file
)
{
nil
}
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
path
)
{
nil
}
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
end
end
it
'returns default when custom path is empty'
do
it
'returns default when custom path is empty'
do
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
file
)
{
''
}
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
path
)
{
''
}
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
is_expected
.
to
eq
(
'.gitlab-ci.yml'
)
end
end
...
@@ -772,7 +772,7 @@ describe Ci::Pipeline, models: true do
...
@@ -772,7 +772,7 @@ describe Ci::Pipeline, models: true do
describe
'#ci_yaml_file'
do
describe
'#ci_yaml_file'
do
it
'reports error if the file is not found'
do
it
'reports error if the file is not found'
do
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
file
)
{
'custom'
}
allow
(
pipeline
.
project
).
to
receive
(
:ci_config_
path
)
{
'custom'
}
pipeline
.
ci_yaml_file
pipeline
.
ci_yaml_file
...
...
spec/models/project_spec.rb
View file @
9f5ac179
...
@@ -143,9 +143,9 @@ describe Project, models: true do
...
@@ -143,9 +143,9 @@ describe Project, models: true do
it
{
is_expected
.
to
validate_length_of
(
:description
).
is_at_most
(
2000
)
}
it
{
is_expected
.
to
validate_length_of
(
:description
).
is_at_most
(
2000
)
}
it
{
is_expected
.
to
validate_length_of
(
:ci_config_
file
).
is_at_most
(
255
)
}
it
{
is_expected
.
to
validate_length_of
(
:ci_config_
path
).
is_at_most
(
255
)
}
it
{
is_expected
.
to
allow_value
(
''
).
for
(
:ci_config_
file
)
}
it
{
is_expected
.
to
allow_value
(
''
).
for
(
:ci_config_
path
)
}
it
{
is_expected
.
not_to
allow_value
(
'test/../foo'
).
for
(
:ci_config_
file
)
}
it
{
is_expected
.
not_to
allow_value
(
'test/../foo'
).
for
(
:ci_config_
path
)
}
it
{
is_expected
.
to
validate_presence_of
(
:creator
)
}
it
{
is_expected
.
to
validate_presence_of
(
:creator
)
}
...
@@ -1493,25 +1493,25 @@ describe Project, models: true do
...
@@ -1493,25 +1493,25 @@ describe Project, models: true do
end
end
end
end
describe
'#ci_config_
file
='
do
describe
'#ci_config_
path
='
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
it
'sets nil'
do
it
'sets nil'
do
project
.
update!
(
ci_config_
file
:
nil
)
project
.
update!
(
ci_config_
path
:
nil
)
expect
(
project
.
ci_config_
file
).
to
be_nil
expect
(
project
.
ci_config_
path
).
to
be_nil
end
end
it
'sets a string'
do
it
'sets a string'
do
project
.
update!
(
ci_config_
file
:
'foo/.gitlab_ci.yml'
)
project
.
update!
(
ci_config_
path
:
'foo/.gitlab_ci.yml'
)
expect
(
project
.
ci_config_
file
).
to
eq
(
'foo/.gitlab_ci.yml'
)
expect
(
project
.
ci_config_
path
).
to
eq
(
'foo/.gitlab_ci.yml'
)
end
end
it
'sets a string but remove all leading slashes and null characters'
do
it
'sets a string but remove all leading slashes and null characters'
do
project
.
update!
(
ci_config_
file
:
"///f
\0
oo/
\0
/.gitlab_ci.yml"
)
project
.
update!
(
ci_config_
path
:
"///f
\0
oo/
\0
/.gitlab_ci.yml"
)
expect
(
project
.
ci_config_
file
).
to
eq
(
'foo//.gitlab_ci.yml'
)
expect
(
project
.
ci_config_
path
).
to
eq
(
'foo//.gitlab_ci.yml'
)
end
end
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
9f5ac179
...
@@ -348,7 +348,7 @@ describe API::Projects do
...
@@ -348,7 +348,7 @@ describe API::Projects do
only_allow_merge_if_pipeline_succeeds:
false
,
only_allow_merge_if_pipeline_succeeds:
false
,
request_access_enabled:
true
,
request_access_enabled:
true
,
only_allow_merge_if_all_discussions_are_resolved:
false
,
only_allow_merge_if_all_discussions_are_resolved:
false
,
ci_config_
file
:
'a/custom/path'
ci_config_
path
:
'a/custom/path'
})
})
post
api
(
'/projects'
,
user
),
project
post
api
(
'/projects'
,
user
),
project
...
@@ -654,7 +654,7 @@ describe API::Projects do
...
@@ -654,7 +654,7 @@ describe API::Projects do
expect
(
json_response
[
'star_count'
]).
to
be_present
expect
(
json_response
[
'star_count'
]).
to
be_present
expect
(
json_response
[
'forks_count'
]).
to
be_present
expect
(
json_response
[
'forks_count'
]).
to
be_present
expect
(
json_response
[
'public_jobs'
]).
to
be_present
expect
(
json_response
[
'public_jobs'
]).
to
be_present
expect
(
json_response
[
'ci_config_
file
'
]).
to
be_nil
expect
(
json_response
[
'ci_config_
path
'
]).
to
be_nil
expect
(
json_response
[
'shared_with_groups'
]).
to
be_an
Array
expect
(
json_response
[
'shared_with_groups'
]).
to
be_an
Array
expect
(
json_response
[
'shared_with_groups'
].
length
).
to
eq
(
1
)
expect
(
json_response
[
'shared_with_groups'
].
length
).
to
eq
(
1
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_id'
]).
to
eq
(
group
.
id
)
expect
(
json_response
[
'shared_with_groups'
][
0
][
'group_id'
]).
to
eq
(
group
.
id
)
...
...
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