diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-09-02 16:35:15 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-01-04 16:38:17 +0100 |
commit | 0103d5be960e620342c67436ddd64ca9e729d7a8 (patch) | |
tree | b4f2cdd4a5ef8f6c906d71c674cc5f13f791c889 /db | |
parent | b647ad96f6e7cd1e6ca078635bb1ea49ee7d589f (diff) | |
download | gitlab-ce-0103d5be960e620342c67436ddd64ca9e729d7a8.tar.gz |
Add config_options|variables to BuildMetadatakamil-refactor-ci-builds-v5
These are data columns that store runtime configuration
of build needed to execute it on runner and within pipeline.
The definition of this data is that once used, and when no longer
needed (due to retry capability) they can be freely removed.
They use `jsonb` on PostgreSQL, and `text` on MySQL (due to lacking
support for json datatype on old enough version).
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/14_pipelines.rb | 5 | ||||
-rw-r--r-- | db/migrate/20181219145521_add_options_to_build_metadata.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb index bdc0a2db7db..db043e39d2c 100644 --- a/db/fixtures/development/14_pipelines.rb +++ b/db/fixtures/development/14_pipelines.rb @@ -102,14 +102,15 @@ class Gitlab::Seeder::Pipelines [] end - def create_pipeline!(project, ref, commit) project.ci_pipelines.create!(sha: commit.id, ref: ref, source: :push) end def build_create!(pipeline, opts = {}) attributes = job_attributes(pipeline, opts) - .merge(commands: '$ build command') + + attributes[:options] ||= {} + attributes[:options][:script] = 'build command' Ci::Build.create!(attributes).tap do |build| # We need to set build trace and artifacts after saving a build diff --git a/db/migrate/20181219145521_add_options_to_build_metadata.rb b/db/migrate/20181219145521_add_options_to_build_metadata.rb new file mode 100644 index 00000000000..dc9569babc2 --- /dev/null +++ b/db/migrate/20181219145521_add_options_to_build_metadata.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddOptionsToBuildMetadata < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_builds_metadata, :config_options, :jsonb + add_column :ci_builds_metadata, :config_variables, :jsonb + end +end diff --git a/db/schema.rb b/db/schema.rb index 97daf8ee617..12e4ed6d627 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -374,6 +374,8 @@ ActiveRecord::Schema.define(version: 20190103140724) do t.integer "project_id", null: false t.integer "timeout" t.integer "timeout_source", default: 1, null: false + t.jsonb "config_options" + t.jsonb "config_variables" t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id", unique: true, using: :btree t.index ["project_id"], name: "index_ci_builds_metadata_on_project_id", using: :btree end |