summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-30 12:07:31 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-07 15:08:15 +0200
commit84d9789d57edf1c09b8a63bbd4f455c9ee437aa7 (patch)
treea5be9811590e3e32dc58fad18e9d48498becec6f /lib
parent4fa822ae9d1a985c7cd9d5a63eae3a623fb16f50 (diff)
downloadgitlab-ce-84d9789d57edf1c09b8a63bbd4f455c9ee437aa7.tar.gz
Sanitize id value passed to async background migration
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/background_migration/migrate_build_stage_id_reference.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb b/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
index c8669ca3272..d1d0a968588 100644
--- a/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
+++ b/lib/gitlab/background_migration/migrate_build_stage_id_reference.rb
@@ -2,15 +2,13 @@ module Gitlab
module BackgroundMigration
class MigrateBuildStageIdReference
def perform(id)
- raise ArgumentError unless id.present?
-
sql = <<-SQL.strip_heredoc
UPDATE "ci_builds"
SET "stage_id" =
(SELECT id FROM ci_stages
WHERE ci_stages.pipeline_id = ci_builds.commit_id
AND ci_stages.name = ci_builds.stage)
- WHERE "ci_builds"."id" = #{id}
+ WHERE "ci_builds"."id" = #{id.to_i}
AND "ci_builds"."stage_id" IS NULL
SQL