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
1d087e07
Commit
1d087e07
authored
Jul 11, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Freeze mutable constants in stages migration code
parent
6e9924a2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
6 deletions
+4
-6
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+1
-1
lib/gitlab/background_migration/migrate_stage_status.rb
lib/gitlab/background_migration/migrate_stage_status.rb
+1
-1
spec/migrations/migrate_stages_statuses_spec.rb
spec/migrations/migrate_stages_statuses_spec.rb
+2
-3
spec/models/commit_status_spec.rb
spec/models/commit_status_spec.rb
+0
-1
No files found.
app/models/concerns/has_status.rb
View file @
1d087e07
...
...
@@ -9,7 +9,7 @@ module HasStatus
COMPLETED_STATUSES
=
%w[success failed canceled skipped]
.
freeze
ORDERED_STATUSES
=
%w[failed pending running manual canceled success skipped created]
.
freeze
STATUSES_ENUM
=
{
created:
0
,
pending:
1
,
running:
2
,
success:
3
,
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
.
freeze
class_methods
do
def
enumerated_status!
...
...
lib/gitlab/background_migration/migrate_stage_status.rb
View file @
1d087e07
...
...
@@ -2,7 +2,7 @@ module Gitlab
module
BackgroundMigration
class
MigrateStageStatus
STATUSES
=
{
created:
0
,
pending:
1
,
running:
2
,
success:
3
,
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
.
freeze
class
Build
<
ActiveRecord
::
Base
self
.
table_name
=
'ci_builds'
...
...
spec/migrations/migrate_stages_statuses_spec.rb
View file @
1d087e07
...
...
@@ -8,7 +8,7 @@ describe MigrateStagesStatuses, :migration do
let
(
:projects
)
{
table
(
:projects
)
}
STATUSES
=
{
created:
0
,
pending:
1
,
running:
2
,
success:
3
,
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
failed:
4
,
canceled:
5
,
skipped:
6
,
manual:
7
}
.
freeze
before
do
stub_const
(
"
#{
described_class
.
name
}
::BATCH_SIZE"
,
2
)
...
...
@@ -59,9 +59,8 @@ describe MigrateStagesStatuses, :migration do
end
end
def
create_job
(
project
:,
pipeline
:,
stage
:,
status
:,
**
opts
)
stages
=
{
test:
1
,
build:
2
,
deploy:
3
}
stages
=
{
test:
1
,
build:
2
,
deploy:
3
}
jobs
.
create!
(
project_id:
project
,
commit_id:
pipeline
,
stage_idx:
stages
[
stage
.
to_sym
],
stage:
stage
,
...
...
spec/models/commit_status_spec.rb
View file @
1d087e07
...
...
@@ -419,7 +419,6 @@ describe CommitStatus, :models do
end
end
describe
'#locking_enabled?'
do
before
do
commit_status
.
lock_version
=
100
...
...
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