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
Boxiang Sun
gitlab-ce
Commits
cfd839d6
Commit
cfd839d6
authored
Feb 15, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests and disallow 0 to make it consistent with .gitlab-ci.yml
parent
602f3b84
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
4 deletions
+17
-4
app/models/application_setting.rb
app/models/application_setting.rb
+9
-3
lib/api/entities.rb
lib/api/entities.rb
+1
-0
lib/api/settings.rb
lib/api/settings.rb
+1
-1
spec/models/application_setting_spec.rb
spec/models/application_setting_spec.rb
+6
-0
No files found.
app/models/application_setting.rb
View file @
cfd839d6
...
@@ -306,9 +306,15 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -306,9 +306,15 @@ class ApplicationSetting < ActiveRecord::Base
end
end
def
check_default_artifacts_expire_in
def
check_default_artifacts_expire_in
ChronicDuration
.
parse
(
default_artifacts_expire_in
)
if
return
true
unless
default_artifacts_expire_in
default_artifacts_expire_in
if
ChronicDuration
.
parse
(
default_artifacts_expire_in
).
nil?
errors
.
add
(
:default_artifacts_expire_in
,
"can't be 0. Leave it blank for unlimited"
)
false
else
true
true
end
rescue
ChronicDuration
::
DurationParseError
=>
e
rescue
ChronicDuration
::
DurationParseError
=>
e
errors
.
add
(
:default_artifacts_expire_in
,
":
#{
e
.
message
}
"
)
errors
.
add
(
:default_artifacts_expire_in
,
":
#{
e
.
message
}
"
)
false
false
...
...
lib/api/entities.rb
View file @
cfd839d6
...
@@ -559,6 +559,7 @@ module API
...
@@ -559,6 +559,7 @@ module API
expose
:default_project_visibility
expose
:default_project_visibility
expose
:default_snippet_visibility
expose
:default_snippet_visibility
expose
:default_group_visibility
expose
:default_group_visibility
expose
:default_artifacts_expire_in
expose
:domain_whitelist
expose
:domain_whitelist
expose
:domain_blacklist_enabled
expose
:domain_blacklist_enabled
expose
:domain_blacklist
expose
:domain_blacklist
...
...
lib/api/settings.rb
View file @
cfd839d6
...
@@ -57,7 +57,7 @@ module API
...
@@ -57,7 +57,7 @@ module API
requires
:shared_runners_text
,
type:
String
,
desc:
'Shared runners text '
requires
:shared_runners_text
,
type:
String
,
desc:
'Shared runners text '
end
end
optional
:max_artifacts_size
,
type:
Integer
,
desc:
"Set the maximum file size for each job's artifacts"
optional
:max_artifacts_size
,
type:
Integer
,
desc:
"Set the maximum file size for each job's artifacts"
optional
:default_artifacts_expire_in
,
type:
Integer
,
desc:
"Set the default expiration time for each job's artifacts"
optional
:default_artifacts_expire_in
,
type:
String
,
desc:
"Set the default expiration time for each job's artifacts"
optional
:max_pages_size
,
type:
Integer
,
desc:
'Maximum size of pages in MB'
optional
:max_pages_size
,
type:
Integer
,
desc:
'Maximum size of pages in MB'
optional
:container_registry_token_expire_delay
,
type:
Integer
,
desc:
'Authorization token duration (minutes)'
optional
:container_registry_token_expire_delay
,
type:
Integer
,
desc:
'Authorization token duration (minutes)'
optional
:metrics_enabled
,
type:
Boolean
,
desc:
'Enable the InfluxDB metrics'
optional
:metrics_enabled
,
type:
Boolean
,
desc:
'Enable the InfluxDB metrics'
...
...
spec/models/application_setting_spec.rb
View file @
cfd839d6
...
@@ -36,6 +36,12 @@ describe ApplicationSetting, models: true do
...
@@ -36,6 +36,12 @@ describe ApplicationSetting, models: true do
expect
(
setting
).
to
be_invalid
expect
(
setting
).
to
be_invalid
end
end
it
'does not allow 0'
do
setting
.
update
(
default_artifacts_expire_in:
'0'
)
expect
(
setting
).
to
be_invalid
end
it
'sets the value if it is valid'
do
it
'sets the value if it is valid'
do
setting
.
update
(
default_artifacts_expire_in:
'30 days'
)
setting
.
update
(
default_artifacts_expire_in:
'30 days'
)
...
...
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