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
f09dcbd9
Commit
f09dcbd9
authored
May 09, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make retried to be nullable
parent
f2a4420d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
14 deletions
+8
-14
app/models/commit_status.rb
app/models/commit_status.rb
+1
-1
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+1
-1
app/services/ci/retry_build_service.rb
app/services/ci/retry_build_service.rb
+2
-2
db/migrate/20170503004426_add_retried_to_ci_build.rb
db/migrate/20170503004426_add_retried_to_ci_build.rb
+2
-8
db/post_migrate/20170503004427_upate_retried_for_ci_build.rb
db/post_migrate/20170503004427_upate_retried_for_ci_build.rb
+1
-1
db/schema.rb
db/schema.rb
+1
-1
No files found.
app/models/commit_status.rb
View file @
f09dcbd9
...
...
@@ -31,7 +31,7 @@ class CommitStatus < ActiveRecord::Base
false
,
all_state_names
-
[
:failed
,
:canceled
,
:manual
])
end
scope
:latest
,
->
{
where
(
retried:
false
)
}
scope
:latest
,
->
{
where
(
retried:
[
false
,
nil
]
)
}
scope
:retried
,
->
{
where
(
retried:
true
)
}
scope
:ordered
,
->
{
order
(
:name
)
}
scope
:latest_ordered
,
->
{
latest
.
ordered
.
includes
(
project: :namespace
)
}
...
...
app/models/concerns/has_status.rb
View file @
f09dcbd9
...
...
@@ -22,7 +22,7 @@ module HasStatus
skipped
=
scope
.
skipped
.
select
(
'count(*)'
).
to_sql
canceled
=
scope
.
canceled
.
select
(
'count(*)'
).
to_sql
"(CASE
"(CASE
WHEN (
#{
builds
}
)=(
#{
skipped
}
) THEN 'skipped'
WHEN (
#{
builds
}
)=(
#{
success
}
) THEN 'success'
WHEN (
#{
builds
}
)=(
#{
created
}
) THEN 'created'
...
...
app/services/ci/retry_build_service.rb
View file @
f09dcbd9
...
...
@@ -30,8 +30,8 @@ module Ci
Ci
::
Build
.
transaction
do
# mark all other builds of that name as retried
build
.
pipeline
.
builds
.
where
(
name:
build
.
name
)
.
where
.
not
(
retried:
tru
e
)
build
.
pipeline
.
builds
.
latest
.
where
(
name:
build
.
nam
e
)
.
update_all
(
retried:
true
)
project
.
builds
.
create!
(
Hash
[
attributes
])
...
...
db/migrate/20170503004426_add_retried_to_ci_build.rb
View file @
f09dcbd9
...
...
@@ -3,13 +3,7 @@ class AddRetriedToCiBuild < ActiveRecord::Migration
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column_with_default
(
:ci_builds
,
:retried
,
:boolean
,
default:
false
)
end
def
down
remove_column
(
:ci_builds
,
:retried
)
def
change
add_column
(
:ci_builds
,
:retried
,
:boolean
)
end
end
db/post_migrate/20170503004427_upate_retried_for_ci_build.rb
View file @
f09dcbd9
...
...
@@ -20,7 +20,7 @@ class UpateRetriedForCiBuild < ActiveRecord::Migration
is_retried
=
Arel
.
sql
(
"((
#{
latest_id
}
) != ci_builds.id)"
)
update_column_in_batches
(
:ci_builds
,
:retried
,
is_retried
)
do
|
table
,
query
|
query
.
where
(
table
[
:retried
].
eq
(
false
))
query
.
where
(
table
[
:retried
].
eq
(
nil
))
end
end
...
...
db/schema.rb
View file @
f09dcbd9
...
...
@@ -232,7 +232,7 @@ ActiveRecord::Schema.define(version: 20170504102911) do
t
.
integer
"lock_version"
t
.
string
"coverage_regex"
t
.
integer
"auto_canceled_by_id"
t
.
boolean
"retried"
,
default:
false
,
null:
false
t
.
boolean
"retried"
end
add_index
"ci_builds"
,
[
"commit_id"
,
"stage_idx"
,
"created_at"
],
name:
"index_ci_builds_on_commit_id_and_stage_idx_and_created_at"
,
using: :btree
...
...
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