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
4131ed2b
Commit
4131ed2b
authored
Apr 07, 2017
by
Shinya Maeda
Committed by
Kamil Trzcinski
Apr 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
before_create :set_project. Now TriggerSchedule saves project from parent
parent
ea8574fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/models/ci/trigger_schedule.rb
app/models/ci/trigger_schedule.rb
+5
-1
spec/factories/ci/trigger_schedules.rb
spec/factories/ci/trigger_schedules.rb
+0
-4
No files found.
app/models/ci/trigger_schedule.rb
View file @
4131ed2b
...
...
@@ -15,11 +15,15 @@ module Ci
validates
:cron_timezone
,
cron_timezone:
true
,
presence:
{
unless: :importing?
}
validates
:ref
,
presence:
{
unless: :importing?
}
before_create
:set_project
before_save
:set_next_run_at
def
set_project
self
.
project
=
trigger
.
project
end
def
set_next_run_at
self
.
next_run_at
=
Gitlab
::
Ci
::
CronParser
.
new
(
cron
,
cron_timezone
).
next_time_from
(
Time
.
now
)
self
.
project
=
trigger
.
project
end
def
schedule_next_run!
...
...
spec/factories/ci/trigger_schedules.rb
View file @
4131ed2b
...
...
@@ -4,10 +4,6 @@ FactoryGirl.define do
cron
'0 1 * * *'
cron_timezone
Gitlab
::
Ci
::
CronParser
::
VALID_SYNTAX_SAMPLE_TIME_ZONE
after
(
:build
)
do
|
trigger_schedule
,
evaluator
|
trigger_schedule
.
update!
(
project:
trigger_schedule
.
trigger
.
project
)
end
trait
:nightly
do
cron
'0 1 * * *'
cron_timezone
Gitlab
::
Ci
::
CronParser
::
VALID_SYNTAX_SAMPLE_TIME_ZONE
...
...
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