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
770bcf71
Commit
770bcf71
authored
Aug 30, 2017
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Form for setting project auto devops settings
parent
6ed49040
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
62 additions
and
19 deletions
+62
-19
app/controllers/projects/pipelines_settings_controller.rb
app/controllers/projects/pipelines_settings_controller.rb
+5
-7
app/controllers/projects/settings/ci_cd_controller.rb
app/controllers/projects/settings/ci_cd_controller.rb
+5
-0
app/models/project.rb
app/models/project.rb
+1
-0
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+6
-2
app/views/projects/pipelines_settings/_show.html.haml
app/views/projects/pipelines_settings/_show.html.haml
+39
-5
db/migrate/20170828093725_create_project_auto_dev_ops.rb
db/migrate/20170828093725_create_project_auto_dev_ops.rb
+1
-1
db/schema.rb
db/schema.rb
+2
-3
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+2
-1
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
No files found.
app/controllers/projects/pipelines_settings_controller.rb
View file @
770bcf71
...
@@ -6,7 +6,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
...
@@ -6,7 +6,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
end
end
def
update
def
update
if
@project
.
update
_attributes
(
update_params
)
if
@project
.
update
(
update_params
)
flash
[
:notice
]
=
"Pipelines settings for '
#{
@project
.
name
}
' were successfully updated."
flash
[
:notice
]
=
"Pipelines settings for '
#{
@project
.
name
}
' were successfully updated."
redirect_to
project_settings_ci_cd_path
(
@project
)
redirect_to
project_settings_ci_cd_path
(
@project
)
else
else
...
@@ -16,14 +16,12 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
...
@@ -16,14 +16,12 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
private
private
def
create_params
params
.
require
(
:pipeline
).
permit
(
:ref
)
end
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
,
:public_builds
,
:auto_cancel_pending_pipelines
,
:ci_config_path
:build_timeout_in_minutes
,
:build_coverage_regex
,
:public_builds
,
:auto_cancel_pending_pipelines
,
:ci_config_path
,
auto_devops_attributes:
[
:id
,
:domain
,
:enabled
]
)
)
end
end
end
end
app/controllers/projects/settings/ci_cd_controller.rb
View file @
770bcf71
...
@@ -8,6 +8,7 @@ module Projects
...
@@ -8,6 +8,7 @@ module Projects
define_secret_variables
define_secret_variables
define_triggers_variables
define_triggers_variables
define_badges_variables
define_badges_variables
define_auto_devops_variables
end
end
private
private
...
@@ -42,6 +43,10 @@ module Projects
...
@@ -42,6 +43,10 @@ module Projects
badge
.
new
(
@project
,
@ref
).
metadata
badge
.
new
(
@project
,
@ref
).
metadata
end
end
end
end
def
define_auto_devops_variables
@auto_devops
=
@project
.
auto_devops
||
ProjectAutoDevops
.
new
end
end
end
end
end
end
end
app/models/project.rb
View file @
770bcf71
...
@@ -191,6 +191,7 @@ class Project < ActiveRecord::Base
...
@@ -191,6 +191,7 @@ class Project < ActiveRecord::Base
accepts_nested_attributes_for
:variables
,
allow_destroy:
true
accepts_nested_attributes_for
:variables
,
allow_destroy:
true
accepts_nested_attributes_for
:project_feature
accepts_nested_attributes_for
:project_feature
accepts_nested_attributes_for
:import_data
accepts_nested_attributes_for
:import_data
accepts_nested_attributes_for
:auto_devops
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:members
,
to: :team
,
prefix:
true
delegate
:members
,
to: :team
,
prefix:
true
...
...
app/views/admin/application_settings/_form.html.haml
View file @
770bcf71
...
@@ -217,13 +217,17 @@
...
@@ -217,13 +217,17 @@
.help-block
0 for unlimited
.help-block
0 for unlimited
%fieldset
%fieldset
%legend
Continuous Integration and
Continuous
Deployment
%legend
Continuous Integration and Deployment
.form-group
.form-group
.col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10
.checkbox
.checkbox
=
f
.
label
:auto_devops_enabled
do
=
f
.
label
:auto_devops_enabled
do
=
f
.
check_box
:auto_devops_enabled
=
f
.
check_box
:auto_devops_enabled
Allow projects to get automaticly configured to use GitLab CI/CD.
Enabled Auto DevOps (Beta) for projects by default
.help-block
It will automatically build, test, and deploy applications based on a predefined CI/CD configuration
-
# Fix this link
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'user/admin_area/settings/continuous_integration'
,
anchor:
'maximum-artifacts-size'
)
.form-group
.form-group
.col-sm-offset-2.col-sm-10
.col-sm-offset-2.col-sm-10
.checkbox
.checkbox
...
...
app/views/projects/pipelines_settings/_show.html.haml
View file @
770bcf71
...
@@ -5,11 +5,45 @@
...
@@ -5,11 +5,45 @@
.col-lg-8
.col-lg-8
=
form_for
@project
,
url:
project_pipelines_settings_path
(
@project
)
do
|
f
|
=
form_for
@project
,
url:
project_pipelines_settings_path
(
@project
)
do
|
f
|
%fieldset
.builds-feature
%fieldset
.builds-feature
-
unless
@repository
.
gitlab_ci_yml
.form-group
.form-group
%p
Pipelines need to have AutoDevOps enabled or have a .gitlab-ci.yml configured before you can begin using Continious Integration and Delivery.
%p
Pipelines need to be configured before you can begin using Continuous Integration.
=
f
.
label
:auto_devops_enabled
,
'Auto DevOps (Beta)'
,
class:
'label-light'
=
link_to
'Get started with Pipelines'
,
help_page_path
(
'ci/quick_start/README'
),
class:
'btn btn-info'
%p
%hr
Auto DevOps will automatically build, test, and deploy your application based on a predefined CI/CD configuration.
=
link_to
'Learn more about Auto DevOps'
,
help_page_path
(
'ci/quick_start/README'
)
#TODO fix the link
=
f
.
fields_for
:auto_devops_attributes
,
@auto_devops
do
|
form
|
.radio
=
form
.
radio_button
:enabled
,
true
%strong
Enable Auto DevOps
%br
%span
.descr
The Auto DevOps pipeline configuration will be used when ther is no .gitlab-ci.yml
in the repository.
.radio
=
form
.
radio_button
:enabled
,
false
%strong
Disable Auto DevOps
%br
%span
.descr
A specific .gitlab-ci.yml file needs to be specified before you can begin using Continious Integration and Delivery
.radio
=
form
.
radio_button
:enabled
,
nil
%strong
Instance default (status:
#{
current_application_settings
.
auto_devops_enabled?
}
)
%br
%span
.descr
Follow the instance default to either have Auto DevOps enabled or disabled when there is no .gitlab-ci.yml file specified
%br
%p
Define a domain used by Auto DevOps to deploy towards, this is required for deploys to succeed.
=
link_to
'Learn more about deploying with Auto DevOps'
,
help_page_path
(
'ci/quick_start/README'
)
#TODO fix the link
=
form
.
text_field
:domain
,
class:
'form-control'
,
placeholder:
'domain.com'
%br
%p
%strong
Project specific pipeline configuration
Define a project specific pipeline configuration by creating a .gitlab-ci.yml file.
=
link_to
'Learn more about pipelines'
,
help_page_path
(
'ci/quick_start/README'
),
class:
'btn btn-info'
%hr
.form-group.append-bottom-default
.form-group.append-bottom-default
=
f
.
label
:runners_token
,
"Runner token"
,
class:
'label-light'
=
f
.
label
:runners_token
,
"Runner token"
,
class:
'label-light'
=
f
.
text_field
:runners_token
,
class:
"form-control"
,
placeholder:
'xEeFCaDAB89'
=
f
.
text_field
:runners_token
,
class:
"form-control"
,
placeholder:
'xEeFCaDAB89'
...
...
db/migrate/20170828093725_create_project_auto_dev_ops.rb
View file @
770bcf71
...
@@ -8,7 +8,7 @@ class CreateProjectAutoDevOps < ActiveRecord::Migration
...
@@ -8,7 +8,7 @@ class CreateProjectAutoDevOps < ActiveRecord::Migration
def
up
def
up
create_table
:project_auto_devops
do
|
t
|
create_table
:project_auto_devops
do
|
t
|
t
.
belongs_to
:project
,
index:
true
t
.
belongs_to
:project
,
index:
true
t
.
boolean
:enabled
,
default:
true
t
.
boolean
:enabled
,
default:
nil
,
null:
true
t
.
string
:domain
t
.
string
:domain
end
end
...
...
db/schema.rb
View file @
770bcf71
...
@@ -250,7 +250,6 @@ ActiveRecord::Schema.define(version: 20170828093725) do
...
@@ -250,7 +250,6 @@ ActiveRecord::Schema.define(version: 20170828093725) do
add_index
"ci_builds"
,
[
"commit_id"
,
"status"
,
"type"
],
name:
"index_ci_builds_on_commit_id_and_status_and_type"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"status"
,
"type"
],
name:
"index_ci_builds_on_commit_id_and_status_and_type"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"type"
,
"name"
,
"ref"
],
name:
"index_ci_builds_on_commit_id_and_type_and_name_and_ref"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"type"
,
"name"
,
"ref"
],
name:
"index_ci_builds_on_commit_id_and_type_and_name_and_ref"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"type"
,
"ref"
],
name:
"index_ci_builds_on_commit_id_and_type_and_ref"
,
using: :btree
add_index
"ci_builds"
,
[
"commit_id"
,
"type"
,
"ref"
],
name:
"index_ci_builds_on_commit_id_and_type_and_ref"
,
using: :btree
add_index
"ci_builds"
,
[
"id"
],
name:
"index_for_ci_builds_retried_migration"
,
where:
"(retried IS NULL)"
,
using: :btree
,
opclasses:
{
"id)"
=>
"WHERE"
}
add_index
"ci_builds"
,
[
"project_id"
],
name:
"index_ci_builds_on_project_id"
,
using: :btree
add_index
"ci_builds"
,
[
"project_id"
],
name:
"index_ci_builds_on_project_id"
,
using: :btree
add_index
"ci_builds"
,
[
"runner_id"
],
name:
"index_ci_builds_on_runner_id"
,
using: :btree
add_index
"ci_builds"
,
[
"runner_id"
],
name:
"index_ci_builds_on_runner_id"
,
using: :btree
add_index
"ci_builds"
,
[
"stage_id"
],
name:
"index_ci_builds_on_stage_id"
,
using: :btree
add_index
"ci_builds"
,
[
"stage_id"
],
name:
"index_ci_builds_on_stage_id"
,
using: :btree
...
@@ -1122,8 +1121,8 @@ ActiveRecord::Schema.define(version: 20170828093725) do
...
@@ -1122,8 +1121,8 @@ ActiveRecord::Schema.define(version: 20170828093725) do
t
.
integer
"project_id"
t
.
integer
"project_id"
t
.
boolean
"enabled"
,
default:
true
t
.
boolean
"enabled"
,
default:
true
t
.
string
"domain"
t
.
string
"domain"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
_with_timezone
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
_with_timezone
"updated_at"
,
null:
false
end
end
add_index
"project_auto_devops"
,
[
"project_id"
],
name:
"index_project_auto_devops_on_project_id"
,
using: :btree
add_index
"project_auto_devops"
,
[
"project_id"
],
name:
"index_project_auto_devops_on_project_id"
,
using: :btree
...
...
lib/gitlab/import_export/import_export.yml
View file @
770bcf71
...
@@ -50,6 +50,7 @@ project_tree:
...
@@ -50,6 +50,7 @@ project_tree:
-
:push_event_payload
-
:push_event_payload
-
:stages
-
:stages
-
:statuses
-
:statuses
-
:project_auto_devops
-
:triggers
-
:triggers
-
:pipeline_schedules
-
:pipeline_schedules
-
:services
-
:services
...
@@ -141,4 +142,4 @@ methods:
...
@@ -141,4 +142,4 @@ methods:
events
:
events
:
-
:action
-
:action
push_event_payload
:
push_event_payload
:
-
:action
-
:action
\ No newline at end of file
spec/lib/gitlab/import_export/all_models.yml
View file @
770bcf71
...
@@ -256,6 +256,7 @@ project:
...
@@ -256,6 +256,7 @@ project:
-
environments
-
environments
-
deployments
-
deployments
-
project_feature
-
project_feature
-
auto_devops
-
pages_domains
-
pages_domains
-
authorized_users
-
authorized_users
-
project_authorizations
-
project_authorizations
...
...
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