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
40a3b467
Commit
40a3b467
authored
Feb 26, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the Ci::Build `*_store` column
parent
e43d7d2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
21 deletions
+27
-21
app/models/ci/build.rb
app/models/ci/build.rb
+4
-0
db/migrate/20180222152310_port_object_storage_to_ce.rb
db/migrate/20180222152310_port_object_storage_to_ce.rb
+21
-21
db/schema.rb
db/schema.rb
+2
-0
No files found.
app/models/ci/build.rb
View file @
40a3b467
...
...
@@ -3,6 +3,7 @@ module Ci
prepend
ArtifactMigratable
include
TokenAuthenticatable
include
AfterCommitQueue
include
ObjectStorage
::
BackgroundMove
include
Presentable
include
Importable
...
...
@@ -41,10 +42,13 @@ module Ci
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
scope
:with_artifacts
,
->
()
do
where
(
'(artifacts_file IS NOT NULL AND artifacts_file <> ?) OR EXISTS (?)'
,
''
,
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id'
))
end
scope
:with_artifacts_stored_locally
,
->
{
with_artifacts
.
where
(
artifacts_file_store:
[
nil
,
LegacyArtifactUploader
::
Store
::
LOCAL
])
}
scope
:with_artifacts_not_expired
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at IS NULL OR artifacts_expire_at > ?'
,
Time
.
now
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:with_artifacts_stored_locally
,
->
()
{
with_artifacts
.
where
(
artifacts_file_store:
[
nil
,
LegacyArtifactUploader
::
Store
::
LOCAL
])
}
...
...
db/migrate/20180222152310_port_object_storage_to_ce.rb
View file @
40a3b467
...
...
@@ -7,31 +7,31 @@ class PortObjectStorageToCe < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
def
up
unless
column_exists?
(
:ci_job_artifacts
,
:file_store
)
add_column
(
:ci_job_artifacts
,
:file_store
,
:integer
)
end
unless
column_exists?
(
:lfs_objects
,
:file_store
)
add_column
(
:lfs_objects
,
:file_store
,
:integer
)
end
def
add_column_idempotent
(
table
,
column
,
*
defs
)
return
if
column_exists?
(
table
,
column
)
unless
column_exists?
(
:uploads
,
:store
)
add_column
(
:uploads
,
:store
,
:integer
)
end
add_column
(
table
,
column
,
*
defs
)
end
def
down
if
column_exists?
(
:ci_job_artifacts
,
:file_store
)
remove_column
(
:ci_job_artifacts
,
:file_store
)
end
def
remove_column_idempotent
(
table
,
column
)
return
unless
column_exists?
(
table
,
column
)
remove_column
(
table
,
column
)
end
if
column_exists?
(
:lfs_objects
,
:file_store
)
remove_column
(
:lfs_objects
,
:file_store
)
end
def
up
add_column_idempotent
(
:ci_job_artifacts
,
:file_store
,
:integer
)
add_column_idempotent
(
:ci_builds
,
:artifacts_file_store
,
:integer
)
add_column_idempotent
(
:ci_builds
,
:artifacts_metadata_store
,
:integer
)
add_column_idempotent
(
:lfs_objects
,
:file_store
,
:integer
)
add_column_idempotent
(
:uploads
,
:store
,
:integer
)
end
if
column_exists?
(
:uploads
,
:store
)
remove_column
(
:uploads
,
:store
)
end
def
down
remove_column_idempotent
(
:ci_job_artifacts
,
:file_store
)
remove_column_idempotent
(
:ci_builds
,
:artifacts_file_store
)
remove_column_idempotent
(
:ci_builds
,
:artifacts_metadata_store
)
remove_column_idempotent
(
:lfs_objects
,
:file_store
)
remove_column_idempotent
(
:uploads
,
:store
)
end
end
db/schema.rb
View file @
40a3b467
...
...
@@ -294,6 +294,8 @@ ActiveRecord::Schema.define(version: 20180222152310) do
t
.
integer
"artifacts_metadata_store"
,
default:
1
,
null:
false
t
.
boolean
"protected"
t
.
integer
"failure_reason"
t
.
integer
"artifacts_file_store"
t
.
integer
"artifacts_metadata_store"
end
add_index
"ci_builds"
,
[
"artifacts_expire_at"
],
name:
"index_ci_builds_on_artifacts_expire_at"
,
where:
"(artifacts_file <> ''::text)"
,
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