Commit 9f5ac179 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Rename ci_config_file to ci_config_path

parent 9f7e5e45
...@@ -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
...@@ -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
......
...@@ -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
......
...@@ -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
......
...@@ -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
...@@ -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
......
...@@ -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
......
...@@ -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.
......
...@@ -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
......
...@@ -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'
......
...@@ -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:
......
...@@ -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) }
......
...@@ -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
......
...@@ -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\0oo/\0/.gitlab_ci.yml") project.update!(ci_config_path: "///f\0oo/\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
......
...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment