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
8f0a1484
Commit
8f0a1484
authored
Jan 22, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose instance AutoDevOps domain in Project
parent
57060295
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
app/models/project.rb
app/models/project.rb
+9
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+31
-5
No files found.
app/models/project.rb
View file @
8f0a1484
...
...
@@ -1604,7 +1604,15 @@ class Project < ActiveRecord::Base
def
auto_devops_variables
return
[]
unless
auto_devops_enabled?
auto_devops
&
.
variables
||
[]
variables
=
[]
if
current_application_settings
.
auto_devops_domain
.
present?
variables
<<
{
key:
'AUTO_DEVOPS_DOMAIN'
,
value:
current_application_settings
.
auto_devops_domain
,
public:
true
}
end
auto_devops
&
.
variables
||
variables
end
def
append_or_update_attribute
(
name
,
value
)
...
...
spec/models/project_spec.rb
View file @
8f0a1484
...
...
@@ -2976,18 +2976,40 @@ describe Project do
subject
{
project
.
auto_devops_variables
}
context
'when enabled in settings'
do
context
'when enabled in
instance
settings'
do
before
do
stub_application_setting
(
auto_devops_enabled:
true
)
end
context
'when domain is empty'
do
before
do
stub_application_setting
(
auto_devops_domain:
nil
)
end
it
'variables does not include AUTO_DEVOPS_DOMAIN'
do
is_expected
.
not_to
include
(
domain_variable
)
end
end
context
'when domain is configured'
do
before
do
stub_application_setting
(
auto_devops_domain:
'example.com'
)
end
it
'variables includes AUTO_DEVOPS_DOMAIN'
do
is_expected
.
to
include
(
domain_variable
)
end
end
end
context
'when explicitely enabled'
do
context
'when domain is empty'
do
before
do
create
(
:project_auto_devops
,
project:
project
,
domain:
nil
)
end
it
'variables
are empty
'
do
is_expected
.
to
be_empty
it
'variables
does not include AUTO_DEVOPS_DOMAIN
'
do
is_expected
.
not_to
include
(
domain_variable
)
end
end
...
...
@@ -2996,11 +3018,15 @@ describe Project do
create
(
:project_auto_devops
,
project:
project
,
domain:
'example.com'
)
end
it
"variables are not empty"
do
is_expected
.
not_to
be_empty
it
'variables includes AUTO_DEVOPS_DOMAIN'
do
is_expected
.
to
include
(
domain_variable
)
end
end
end
def
domain_variable
{
key:
'AUTO_DEVOPS_DOMAIN'
,
value:
'example.com'
,
public:
true
}
end
end
describe
'#latest_successful_builds_for'
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