BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
23557433
Commit
23557433
authored
Jun 13, 2017
by
Timothy Andrew
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/fix-9-2-stable-conflicts-for-mr-11706' into 9-2-stable
parents
670d8df5
34655464
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
5 deletions
+47
-5
pipeline_schedule.rb
app/models/ci/pipeline_schedule.rb
+9
-5
_pipeline_schedule.html.haml
.../projects/pipeline_schedules/_pipeline_schedule.html.haml
+2
-0
32790-pipeline_schedules-pages-throwing-error-500.yml
...sed/32790-pipeline_schedules-pages-throwing-error-500.yml
+4
-0
pipeline_schedules_spec.rb
spec/features/projects/pipeline_schedules_spec.rb
+24
-0
pipeline_schedule_spec.rb
spec/models/ci/pipeline_schedule_spec.rb
+8
-0
No files found.
app/models/ci/pipeline_schedule.rb
View file @
23557433
...
@@ -10,9 +10,9 @@ module Ci
...
@@ -10,9 +10,9 @@ module Ci
has_one
:last_pipeline
,
->
{
order
(
id: :desc
)
},
class_name:
'Ci::Pipeline'
has_one
:last_pipeline
,
->
{
order
(
id: :desc
)
},
class_name:
'Ci::Pipeline'
has_many
:pipelines
has_many
:pipelines
validates
:cron
,
unless: :importing
_or_inactive?
,
cron:
true
,
presence:
{
unless: :importing_or_inactive
?
}
validates
:cron
,
unless: :importing
?
,
cron:
true
,
presence:
{
unless: :importing
?
}
validates
:cron_timezone
,
cron_timezone:
true
,
presence:
{
unless: :importing
_or_inactive
?
}
validates
:cron_timezone
,
cron_timezone:
true
,
presence:
{
unless: :importing?
}
validates
:ref
,
presence:
{
unless: :importing
_or_inactive
?
}
validates
:ref
,
presence:
{
unless: :importing?
}
validates
:description
,
presence:
true
validates
:description
,
presence:
true
before_save
:set_next_run_at
before_save
:set_next_run_at
...
@@ -28,8 +28,12 @@ module Ci
...
@@ -28,8 +28,12 @@ module Ci
!
active?
!
active?
end
end
def
importing_or_inactive?
def
deactivate!
importing?
||
inactive?
update_attribute
(
:active
,
false
)
end
def
runnable_by_owner?
Ability
.
allowed?
(
owner
,
:create_pipeline
,
project
)
end
end
def
set_next_run_at
def
set_next_run_at
...
...
app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml
View file @
23557433
...
@@ -4,7 +4,9 @@
...
@@ -4,7 +4,9 @@
=
pipeline_schedule
.
description
=
pipeline_schedule
.
description
%td
.branch-name-cell
%td
.branch-name-cell
=
icon
(
'code-fork'
)
=
icon
(
'code-fork'
)
-
if
pipeline_schedule
.
ref
=
link_to
pipeline_schedule
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
pipeline_schedule
.
ref
),
class:
"branch-name"
=
link_to
pipeline_schedule
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
pipeline_schedule
.
ref
),
class:
"branch-name"
%td
%td
-
if
pipeline_schedule
.
last_pipeline
-
if
pipeline_schedule
.
last_pipeline
.status-icon-container
{
class:
"ci-status-icon-#{pipeline_schedule.last_pipeline.status}"
}
.status-icon-container
{
class:
"ci-status-icon-#{pipeline_schedule.last_pipeline.status}"
}
...
...
changelogs/unreleased/32790-pipeline_schedules-pages-throwing-error-500.yml
0 → 100644
View file @
23557433
---
title
:
Fix pipeline_schedules pages throwing error 500
merge_request
:
11706
author
:
dosuken123
spec/features/projects/pipeline_schedules_spec.rb
View file @
23557433
...
@@ -66,6 +66,17 @@ feature 'Pipeline Schedules', :feature do
...
@@ -66,6 +66,17 @@ feature 'Pipeline Schedules', :feature do
expect
(
page
).
not_to
have_content
(
'pipeline schedule'
)
expect
(
page
).
not_to
have_content
(
'pipeline schedule'
)
end
end
end
end
context
'when ref is nil'
do
before
do
pipeline_schedule
.
update_attribute
(
:ref
,
nil
)
visit_pipelines_schedules
end
it
'shows a list of the pipeline schedules with empty ref column'
do
expect
(
first
(
'.branch-name-cell'
).
text
).
to
eq
(
''
)
end
end
end
end
describe
'POST /projects/pipeline_schedules/new'
,
js:
true
do
describe
'POST /projects/pipeline_schedules/new'
,
js:
true
do
...
@@ -109,6 +120,19 @@ feature 'Pipeline Schedules', :feature do
...
@@ -109,6 +120,19 @@ feature 'Pipeline Schedules', :feature do
expect
(
page
).
to
have_content
(
'my brand new description'
)
expect
(
page
).
to
have_content
(
'my brand new description'
)
end
end
context
'when ref is nil'
do
before
do
pipeline_schedule
.
update_attribute
(
:ref
,
nil
)
edit_pipeline_schedule
end
it
'shows the pipeline schedule with default ref'
do
page
.
within
(
'.git-revision-dropdown-toggle'
)
do
expect
(
first
(
'.dropdown-toggle-text'
).
text
).
to
eq
(
'master'
)
end
end
end
end
end
def
visit_new_pipeline_schedule
def
visit_new_pipeline_schedule
...
...
spec/models/ci/pipeline_schedule_spec.rb
View file @
23557433
...
@@ -25,6 +25,14 @@ describe Ci::PipelineSchedule, models: true do
...
@@ -25,6 +25,14 @@ describe Ci::PipelineSchedule, models: true do
expect
(
pipeline_schedule
).
not_to
be_valid
expect
(
pipeline_schedule
).
not_to
be_valid
end
end
context
'when active is false'
do
it
'does not allow nullified ref'
do
pipeline_schedule
=
build
(
:ci_pipeline_schedule
,
:inactive
,
ref:
nil
)
expect
(
pipeline_schedule
).
not_to
be_valid
end
end
end
end
describe
'#set_next_run_at'
do
describe
'#set_next_run_at'
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