Rename ci_config_file to ci_config_path
This commit is contained in:
parent
9f7e5e45df
commit
9f5ac179d1
15 changed files with 36 additions and 36 deletions
|
@ -23,7 +23,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
|
|||
def update_params
|
||||
params.require(:project).permit(
|
||||
: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
|
||||
|
|
|
@ -327,10 +327,10 @@ module Ci
|
|||
end
|
||||
|
||||
def ci_yaml_file_path
|
||||
if project.ci_config_file.blank?
|
||||
if project.ci_config_path.blank?
|
||||
'.gitlab-ci.yml'
|
||||
else
|
||||
project.ci_config_file
|
||||
project.ci_config_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ class Project < ActiveRecord::Base
|
|||
# Validations
|
||||
validates :creator, presence: true, on: :create
|
||||
validates :description, length: { maximum: 2000 }, allow_blank: true
|
||||
validates :ci_config_file,
|
||||
validates :ci_config_path,
|
||||
format: { without: /\.{2}/,
|
||||
message: 'cannot include directory traversal.' },
|
||||
length: { maximum: 255 },
|
||||
|
@ -526,7 +526,7 @@ class Project < ActiveRecord::Base
|
|||
import_data&.destroy
|
||||
end
|
||||
|
||||
def ci_config_file=(value)
|
||||
def ci_config_path=(value)
|
||||
# Strip all leading slashes so that //foo -> foo
|
||||
super(value&.sub(%r{\A/+}, '')&.delete("\0"))
|
||||
end
|
||||
|
@ -1025,7 +1025,7 @@ class Project < ActiveRecord::Base
|
|||
visibility_level: visibility_level,
|
||||
path_with_namespace: path_with_namespace,
|
||||
default_branch: default_branch,
|
||||
ci_config_file: ci_config_file
|
||||
ci_config_path: ci_config_path
|
||||
}
|
||||
|
||||
# Backward compatibility
|
||||
|
|
|
@ -47,11 +47,11 @@
|
|||
|
||||
%hr
|
||||
.form-group
|
||||
= f.label :ci_config_file, 'Custom CI config file', class: 'label-light'
|
||||
= f.text_field :ci_config_file, class: 'form-control', placeholder: '.gitlab-ci.yml'
|
||||
= f.label :ci_config_path, 'Custom CI config path', class: 'label-light'
|
||||
= f.text_field :ci_config_path, class: 'form-control', placeholder: '.gitlab-ci.yml'
|
||||
%p.help-block
|
||||
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
|
||||
.form-group
|
||||
|
|
|
@ -2,10 +2,10 @@ class AddCiConfigFileToProject < ActiveRecord::Migration
|
|||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :projects, :ci_config_file, :string
|
||||
add_column :projects, :ci_config_path, :string
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :projects, :ci_config_file
|
||||
remove_column :projects, :ci_config_path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1085,7 +1085,7 @@ ActiveRecord::Schema.define(version: 20170622162730) do
|
|||
t.string "import_jid"
|
||||
t.integer "cached_markdown_version"
|
||||
t.datetime "last_repository_updated_at"
|
||||
t.string "ci_config_file"
|
||||
t.string "ci_config_path"
|
||||
end
|
||||
|
||||
add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree
|
||||
|
|
|
@ -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 |
|
||||
| `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 |
|
||||
| `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
|
||||
|
||||
|
@ -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 |
|
||||
| `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 |
|
||||
| `ci_config_file` | string | no | The path to CI config file |
|
||||
| `ci_config_path` | string | no | The path to CI config file |
|
||||
|
||||
### Edit project
|
||||
|
||||
|
@ -418,7 +418,7 @@ Parameters:
|
|||
| `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 |
|
||||
| `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
|
||||
|
||||
|
|
|
@ -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,
|
||||
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.
|
||||
|
||||
|
|
|
@ -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 :runners_token, if: lambda { |_project, options| options[:user_can_admin_project] }
|
||||
expose :public_builds, as: :public_jobs
|
||||
expose :ci_config_file
|
||||
expose :ci_config_path
|
||||
expose :shared_with_groups do |project, options|
|
||||
SharedGroup.represent(project.project_group_links.all, options)
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ module API
|
|||
helpers do
|
||||
params :optional_params_ce do
|
||||
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 :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'
|
||||
|
|
|
@ -383,7 +383,7 @@ Project:
|
|||
- printing_merge_request_link_enabled
|
||||
- build_allow_git_fetch
|
||||
- last_repository_updated_at
|
||||
- ci_config_file
|
||||
- ci_config_path
|
||||
Author:
|
||||
- name
|
||||
ProjectFeature:
|
||||
|
|
|
@ -1474,7 +1474,7 @@ describe Ci::Build, :models do
|
|||
let(:ci_config_path) { { key: 'CI_CONFIG_PATH', value: 'custom', public: true } }
|
||||
|
||||
before do
|
||||
project.update(ci_config_file: 'custom')
|
||||
project.update(ci_config_path: 'custom')
|
||||
end
|
||||
|
||||
it { is_expected.to include(ci_config_path) }
|
||||
|
|
|
@ -752,19 +752,19 @@ describe Ci::Pipeline, models: true do
|
|||
subject { pipeline.ci_yaml_file_path }
|
||||
|
||||
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')
|
||||
end
|
||||
|
||||
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')
|
||||
end
|
||||
|
||||
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')
|
||||
end
|
||||
|
@ -772,7 +772,7 @@ describe Ci::Pipeline, models: true do
|
|||
|
||||
describe '#ci_yaml_file' 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
|
||||
|
||||
|
|
|
@ -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(:ci_config_file).is_at_most(255) }
|
||||
it { is_expected.to allow_value('').for(:ci_config_file) }
|
||||
it { is_expected.not_to allow_value('test/../foo').for(:ci_config_file) }
|
||||
it { is_expected.to validate_length_of(:ci_config_path).is_at_most(255) }
|
||||
it { is_expected.to allow_value('').for(:ci_config_path) }
|
||||
it { is_expected.not_to allow_value('test/../foo').for(:ci_config_path) }
|
||||
|
||||
it { is_expected.to validate_presence_of(:creator) }
|
||||
|
||||
|
@ -1493,25 +1493,25 @@ describe Project, models: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#ci_config_file=' do
|
||||
describe '#ci_config_path=' do
|
||||
let(:project) { create(:empty_project) }
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -348,7 +348,7 @@ describe API::Projects do
|
|||
only_allow_merge_if_pipeline_succeeds: false,
|
||||
request_access_enabled: true,
|
||||
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
|
||||
|
@ -654,7 +654,7 @@ describe API::Projects do
|
|||
expect(json_response['star_count']).to be_present
|
||||
expect(json_response['forks_count']).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'].length).to eq(1)
|
||||
expect(json_response['shared_with_groups'][0]['group_id']).to eq(group.id)
|
||||
|
|
Loading…
Reference in a new issue