Skip to content

Add ci_runner_versions table and index_ci_runners_on_version index

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR introduces the ci_runner_versions table which will contain all Runner versions in use from ci_runners.version, in order to support computed state such as the upgrade status of a given release. There will be an upcoming MR which will introduce a cron worker to periodically update the status column, as well as add/delete versions as necessary.

Part of GraphQL: Expose filter on GitLab Runner upgrade... (#358406 - closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Migrations

Migrate up
main: == 20220624081524 AddCiRunnerVersionsTable: migrating =========================
main: -- create_table(:ci_runner_versions, {:id=>false})
main:    -> 0.0034s
main: == 20220624081524 AddCiRunnerVersionsTable: migrated (0.0038s) ================

main: == 20220624090458 AddIndexOnRunnerVersion: migrating ==========================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- index_exists?(:ci_runners, :version, {:name=>"index_ci_runners_on_version", :algorithm=>:concurrently})
main:    -> 0.0040s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- add_index(:ci_runners, :version, {:name=>"index_ci_runners_on_version", :algorithm=>:concurrently})
main:    -> 0.0010s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20220624090458 AddIndexOnRunnerVersion: migrated (0.0091s) =================

ci: == 20220624062300 DeleteBackfillCiRunnerSemverMigration: migrating ============
ci: == 20220624062300 DeleteBackfillCiRunnerSemverMigration: migrated (0.0107s) ===

ci: == 20220624081524 AddCiRunnerVersionsTable: migrating =========================
ci: -- create_table(:ci_runner_versions, {:id=>false})
ci:    -> 0.0034s
ci: == 20220624081524 AddCiRunnerVersionsTable: migrated (0.0035s) ================

ci: == 20220624090458 AddIndexOnRunnerVersion: migrating ==========================
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- index_exists?(:ci_runners, :version, {:name=>"index_ci_runners_on_version", :algorithm=>:concurrently})
ci:    -> 0.0038s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- add_index(:ci_runners, :version, {:name=>"index_ci_runners_on_version", :algorithm=>:concurrently})
ci:    -> 0.0010s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0001s
ci: == 20220624090458 AddIndexOnRunnerVersion: migrated (0.0064s) =================
Migrate down
main: == 20220624090458 AddIndexOnRunnerVersion: reverting ==========================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- indexes(:ci_runners)
main:    -> 0.0089s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- remove_index(:ci_runners, {:algorithm=>:concurrently, :name=>"index_ci_runners_on_version"})
main:    -> 0.0020s
main: -- execute("RESET statement_timeout")
main:    -> 0.0001s
main: == 20220624090458 AddIndexOnRunnerVersion: reverted (0.0165s) =================

ci: == 20220624090458 AddIndexOnRunnerVersion: reverting ==========================
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- indexes(:ci_runners)
ci:    -> 0.0060s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- remove_index(:ci_runners, {:algorithm=>:concurrently, :name=>"index_ci_runners_on_version"})
ci:    -> 0.0016s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0001s
ci: == 20220624090458 AddIndexOnRunnerVersion: reverted (0.0120s) =================

main: == 20220624081524 AddCiRunnerVersionsTable: reverting =========================
main: -- drop_table(:ci_runner_versions, {:if_exists=>true})
main:    -> 0.0019s
main: == 20220624081524 AddCiRunnerVersionsTable: reverted (0.0025s) ================

ci: == 20220624081524 AddCiRunnerVersionsTable: reverting =========================
ci: -- drop_table(:ci_runner_versions, {:if_exists=>true})
ci:    -> 0.0014s
ci: == 20220624081524 AddCiRunnerVersionsTable: reverted (0.0020s) ================

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports