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
Léo-Paul Géneau
gitlab-ce
Commits
30176977
Commit
30176977
authored
Sep 16, 2017
by
bokebilly
Committed by
Kamil Trzcinski
Sep 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add warning message if domain or cluster are not configured
parent
4c6c1059
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
12 deletions
+47
-12
app/helpers/auto_devops_helper.rb
app/helpers/auto_devops_helper.rb
+20
-1
app/models/project_auto_devops.rb
app/models/project_auto_devops.rb
+4
-0
app/views/projects/pipelines_settings/_show.html.haml
app/views/projects/pipelines_settings/_show.html.haml
+10
-9
app/views/projects/settings/ci_cd/show.html.haml
app/views/projects/settings/ci_cd/show.html.haml
+1
-1
changelogs/unreleased/37894-handle-if-auto-devops-domain-is-not-set.yml
...eleased/37894-handle-if-auto-devops-domain-is-not-set.yml
+5
-0
spec/models/project_auto_devops_spec.rb
spec/models/project_auto_devops_spec.rb
+7
-1
No files found.
app/helpers/auto_devops_helper.rb
View file @
30176977
...
...
@@ -5,6 +5,25 @@ module AutoDevopsHelper
can?
(
current_user
,
:admin_pipeline
,
project
)
&&
project
.
has_auto_devops_implicitly_disabled?
&&
!
project
.
repository
.
gitlab_ci_yml
&&
project
.
ci_services
.
active
.
none?
!
project
.
ci_service
end
def
auto_devops_warning_message
(
project
)
missing_domain
=
!
project
.
auto_devops
&
.
has_domain?
missing_service
=
!
project
.
kubernetes_service
&
.
active?
if
missing_service
params
=
{
kubernetes:
link_to
(
'Kubernetes service'
,
edit_project_service_path
(
project
,
'kubernetes'
))
}
if
missing_domain
_
(
'Auto Review Apps and Auto Deploy need a domain name and the %s to work correctly.'
)
%
params
else
_
(
'Auto Review Apps and Auto Deploy need the %s to work correctly.'
)
%
params
end
elsif
missing_domain
_
(
'Auto Review Apps and Auto Deploy need a domain name to work correctly.'
)
end
end
end
app/models/project_auto_devops.rb
View file @
30176977
...
...
@@ -6,6 +6,10 @@ class ProjectAutoDevops < ActiveRecord::Base
validates
:domain
,
allow_blank:
true
,
hostname:
{
allow_numeric_hostname:
true
}
def
has_domain?
domain
.
present?
end
def
variables
variables
=
[]
variables
<<
{
key:
'AUTO_DEVOPS_DOMAIN'
,
value:
domain
,
public:
true
}
if
domain
.
present?
...
...
app/views/projects/pipelines_settings/_show.html.haml
View file @
30176977
...
...
@@ -3,11 +3,14 @@
=
form_for
@project
,
url:
project_pipelines_settings_path
(
@project
)
do
|
f
|
%fieldset
.builds-feature
.form-group
%p
Pipelines need to have Auto DevOps enabled or have a .gitlab-ci.yml configured before you can begin using Continuous Integration and Delivery.
%h5
Auto DevOps (Beta)
%p
Auto DevOps will automatically build, test, and deploy your application based on a predefined Contin
i
ous Integration and Delivery configuration.
Auto DevOps will automatically build, test, and deploy your application based on a predefined Contin
u
ous Integration and Delivery configuration.
=
link_to
'Learn more about Auto DevOps'
,
help_page_path
(
'topics/autodevops/index.md'
)
-
message
=
auto_devops_warning_message
(
@project
)
-
if
message
%p
.settings-message.text-center
=
message
.
html_safe
=
f
.
fields_for
:auto_devops_attributes
,
@auto_devops
do
|
form
|
.radio
=
form
.
label
:enabled_true
do
...
...
@@ -15,26 +18,24 @@
%strong
Enable Auto DevOps
%br
%span
.descr
The Auto DevOps pipeline configuration will be used when there is no .gitlab-ci.yml
in the project.
The Auto DevOps pipeline configuration will be used when there is no
<code>
.gitlab-ci.yml
</code>
in the project.
.radio
=
form
.
label
:enabled_false
do
=
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.
A
n explicit
<code>
.gitlab-ci.yml
</code>
needs to be specified before you can begin using Continious Integration and Delivery.
.radio
=
form
.
label
:enabled_nil
do
=
form
.
radio_button
:enabled
,
''
%strong
Instance default (status:
#{
current_application_settings
.
auto_devops_enabled?
}
)
%strong
Instance default (
#{
current_application_settings
.
auto_devops_enabled?
?
'enabled'
:
'disabled'
}
)
%br
%span
.descr
Follow the instance default to either have Auto DevOps enabled or disabled when there is no project specific
.gitlab-ci.yml file specified
.
Follow the instance default to either have Auto DevOps enabled or disabled when there is no project specific
<code>
.gitlab-ci.yml
</code>
.
%br
%p
Define a domain used by Auto DevOps to deploy towards, this is required for deploys to succeed
.
You need to specify a domain if you want to use Auto Review Apps and Auto Deploy stages
.
=
form
.
text_field
:domain
,
class:
'form-control'
,
placeholder:
'domain.com'
%hr
...
...
app/views/projects/settings/ci_cd/show.html.haml
View file @
30176977
...
...
@@ -13,7 +13,7 @@
%button
.btn.js-settings-toggle
=
expanded
?
'Collapse'
:
'Expand'
%p
Update your CI/CD configuration
, like job timeout
.
Update your CI/CD configuration
. You need a CI/CD configuration file or Auto DevOps enabled in order to use pipelines
.
.settings-content.no-animate
{
class:
(
'expanded'
if
expanded
)
}
=
render
'projects/pipelines_settings/show'
...
...
changelogs/unreleased/37894-handle-if-auto-devops-domain-is-not-set.yml
0 → 100644
View file @
30176977
---
title
:
Handle if Auto DevOps domain is not set in project settings
merge_request
:
author
:
type
:
added
spec/models/project_auto_devops_spec.rb
View file @
30176977
...
...
@@ -8,7 +8,13 @@ describe ProjectAutoDevops do
it
{
is_expected
.
to
respond_to
(
:created_at
)
}
it
{
is_expected
.
to
respond_to
(
:updated_at
)
}
describe
'variables'
do
describe
'#has_domain?'
do
let
(
:auto_devops
)
{
build_stubbed
(
:project_auto_devops
,
project:
project
,
domain:
'domain.com'
)
}
it
{
is_expected
.
to
have_domain
}
end
describe
'#variables'
do
let
(
:auto_devops
)
{
build_stubbed
(
:project_auto_devops
,
project:
project
,
domain:
domain
)
}
context
'when domain is defined'
do
...
...
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