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
80ef2c5b
Commit
80ef2c5b
authored
Apr 12, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug migrating CI job artifact registry entries to a separate table
parent
7716b5df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
ee/changelogs/unreleased/5646-bad-job-artifact-registry-migration.yml
...s/unreleased/5646-bad-job-artifact-registry-migration.yml
+5
-0
ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb
...22062741_migrate_ci_job_artifacts_to_separate_registry.rb
+4
-1
ee/spec/migrations/geo/migrate_ci_job_artifacts_to_separate_registry_spec.rb
...geo/migrate_ci_job_artifacts_to_separate_registry_spec.rb
+2
-0
No files found.
ee/changelogs/unreleased/5646-bad-job-artifact-registry-migration.yml
0 → 100644
View file @
80ef2c5b
---
title
:
Fix a bug migrating CI job artifact registry entries to a separate table
merge_request
:
5345
author
:
type
:
fixed
ee/db/geo/migrate/20180322062741_migrate_ci_job_artifacts_to_separate_registry.rb
View file @
80ef2c5b
...
@@ -25,7 +25,10 @@ class MigrateCiJobArtifactsToSeparateRegistry < ActiveRecord::Migration
...
@@ -25,7 +25,10 @@ class MigrateCiJobArtifactsToSeparateRegistry < ActiveRecord::Migration
$BODY$
$BODY$
BEGIN
BEGIN
IF (TG_OP = 'UPDATE') THEN
IF (TG_OP = 'UPDATE') THEN
UPDATE job_artifact_registry SET (retry_at, bytes, retry_count, success, sha256) = (NEW.retry_at, NEW.bytes, NEW.retry_count, NEW.success, NEW.sha256);
UPDATE job_artifact_registry
SET (retry_at, bytes, retry_count, success, sha256) =
(NEW.retry_at, NEW.bytes, NEW.retry_count, NEW.success, NEW.sha256)
WHERE artifact_id = NEW.file_id;
ELSEIF (TG_OP = 'INSERT') THEN
ELSEIF (TG_OP = 'INSERT') THEN
INSERT INTO job_artifact_registry (created_at, retry_at, artifact_id, bytes, retry_count, success, sha256)
INSERT INTO job_artifact_registry (created_at, retry_at, artifact_id, bytes, retry_count, success, sha256)
VALUES (NEW.created_at, NEW.retry_at, NEW.file_id, NEW.bytes, NEW.retry_count, NEW.success, NEW.sha256);
VALUES (NEW.created_at, NEW.retry_at, NEW.file_id, NEW.bytes, NEW.retry_count, NEW.success, NEW.sha256);
...
...
ee/spec/migrations/geo/migrate_ci_job_artifacts_to_separate_registry_spec.rb
View file @
80ef2c5b
...
@@ -47,6 +47,8 @@ describe MigrateCiJobArtifactsToSeparateRegistry, :geo, :migration do
...
@@ -47,6 +47,8 @@ describe MigrateCiJobArtifactsToSeparateRegistry, :geo, :migration do
entry
.
update_attributes
(
success:
false
,
bytes:
10240
,
sha256:
'10'
*
64
)
entry
.
update_attributes
(
success:
false
,
bytes:
10240
,
sha256:
'10'
*
64
)
expect
(
job_artifact_registry
.
where
(
artifact_id:
1
,
success:
false
,
bytes:
10240
,
sha256:
'10'
*
64
).
count
).
to
eq
(
1
)
expect
(
job_artifact_registry
.
where
(
artifact_id:
1
,
success:
false
,
bytes:
10240
,
sha256:
'10'
*
64
).
count
).
to
eq
(
1
)
# Ensure that *only* the correct job artifact is updated
expect
(
job_artifact_registry
.
find_by
(
artifact_id:
2
).
bytes
).
to
eq
(
2048
)
end
end
it
'creates a new artifact using the next ID'
do
it
'creates a new artifact using the next ID'
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