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
a67aff6d
Commit
a67aff6d
authored
Apr 04, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Import/Export Setting for trigger_schedule. Remove ref validation.
parent
97cc6777
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
22 deletions
+11
-22
app/models/ci/trigger_schedule.rb
app/models/ci/trigger_schedule.rb
+5
-4
app/validators/ref_validator.rb
app/validators/ref_validator.rb
+0
-10
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+2
-1
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+1
-0
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+2
-0
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+1
-0
spec/models/ci/trigger_schedule_spec.rb
spec/models/ci/trigger_schedule_spec.rb
+0
-7
No files found.
app/models/ci/trigger_schedule.rb
View file @
a67aff6d
module
Ci
class
TriggerSchedule
<
ActiveRecord
::
Base
extend
Ci
::
Model
include
Importable
acts_as_paranoid
...
...
@@ -9,10 +10,10 @@ module Ci
delegate
:ref
,
to: :trigger
validates
:trigger
,
presence:
true
validates
:cron
,
cron:
true
,
presence:
true
validates
:cron_time_zone
,
presence:
true
validates
:ref
,
ref:
true
,
presence:
true
validates
:trigger
,
presence:
{
unless: :importing?
}
validates
:cron
,
cron:
true
,
presence:
{
unless: :importing?
}
validates
:cron_time_zone
,
presence:
{
unless: :importing?
}
validates
:ref
,
presence:
{
unless: :importing?
}
# validate :check_cron_frequency
after_create
:schedule_next_run!
...
...
app/validators/ref_validator.rb
deleted
100644 → 0
View file @
97cc6777
# RefValidator
#
# Custom validator for Ref.
class
RefValidator
<
ActiveModel
::
EachValidator
def
validate_each
(
record
,
attribute
,
value
)
unless
record
.
project
.
repository
.
branch_exists?
(
value
)
record
.
errors
.
add
(
attribute
,
" does not exist"
)
end
end
end
lib/gitlab/import_export/import_export.yml
View file @
a67aff6d
...
...
@@ -39,7 +39,8 @@ project_tree:
-
:author
-
:events
-
:statuses
-
:triggers
# TODO: Need to confirm
-
triggers
:
-
:trigger_schedule
-
:deploy_keys
-
:services
-
:hooks
...
...
lib/gitlab/import_export/relation_factory.rb
View file @
a67aff6d
...
...
@@ -5,6 +5,7 @@ module Gitlab
pipelines:
'Ci::Pipeline'
,
statuses:
'commit_status'
,
triggers:
'Ci::Trigger'
,
trigger_schedule:
'Ci::TriggerSchedule'
,
builds:
'Ci::Build'
,
hooks:
'ProjectHook'
,
merge_access_levels:
'ProtectedBranch::MergeAccessLevel'
,
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
a67aff6d
...
...
@@ -100,6 +100,8 @@ triggers:
-
trigger_requests
-
owner
-
trigger_schedule
trigger_schedule
:
-
trigger
deploy_keys
:
-
user
-
deploy_keys_projects
...
...
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
a67aff6d
...
...
@@ -249,6 +249,7 @@ Ci::TriggerSchedule:
-
created_at
-
updated_at
-
cron
-
cron_time_zone
-
next_run_at
DeployKey
:
-
id
...
...
spec/models/ci/trigger_schedule_spec.rb
View file @
a67aff6d
...
...
@@ -5,13 +5,6 @@ describe Ci::TriggerSchedule, models: true do
it
{
is_expected
.
to
belong_to
(
:trigger
)
}
it
{
is_expected
.
to
respond_to
:ref
}
it
'should validate ref existence'
do
trigger_schedule
=
create
(
:ci_trigger_schedule
,
:cron_nightly_build
)
trigger_schedule
.
trigger
.
ref
=
'invalid-ref'
trigger_schedule
.
valid?
expect
(
trigger_schedule
.
errors
[
:ref
].
first
).
to
include
(
'does not exist'
)
end
describe
'#schedule_next_run!'
do
let
(
:trigger_schedule
)
{
create
(
:ci_trigger_schedule
,
:cron_nightly_build
,
next_run_at:
nil
)
}
...
...
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