diff options
author | Rydkin Maxim <maks.rydkin@gmail.com> | 2017-02-20 01:17:24 +0300 |
---|---|---|
committer | Rydkin Maxim <maks.rydkin@gmail.com> | 2017-04-04 21:11:24 +0300 |
commit | c81ef3041e50411166620a99e6ac80f9dc97d86e (patch) | |
tree | 783a8d8fd59b62a21b218722bcc765143b4a00c9 /db | |
parent | 0a4b853f2ceb0ad6c7394d1056f9139e53b38688 (diff) | |
download | gitlab-ce-c81ef3041e50411166620a99e6ac80f9dc97d86e.tar.gz |
add auto-cancel for pending pipelines on branch, if they are not HEAD
fix changelog MR reference
add non-HEAD builds finder and add `created` pipelines to scope
add spec for auto-cancel non-HEAD pipelines and refactor create_pipeline_service_spec
more refactoring for spec
adds option for auto-cancel into CI/CD settings
fix spec to new configuration
fix rubocop
fix schema.rb
fix schema.rb
replace Gitlab 9.0 with 9.1 in doc
change wording on pipeline settings
added auto_canceled_by field as identifier of autocancel subject
remove unnecessary index
replace service with retry_lock
replace auto_cancel_pending_pipelines boolean setting with integer (and enum in model)
fix schema.rb
fix schema.rb
remove projekt attribute and clean up spec
clean up spec withcouple of shared examples
added spec for "It does not cancel current pipeline" scenario
add some specs to auto-cancel
add spec for another branch pipelines
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb | 33 | ||||
-rw-r--r-- | db/migrate/20170312114329_add_auto_canceled_by_to_pipeline.rb | 29 | ||||
-rw-r--r-- | db/schema.rb | 6 |
3 files changed, 66 insertions, 2 deletions
diff --git a/db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb b/db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb new file mode 100644 index 00000000000..48ee9268dea --- /dev/null +++ b/db/migrate/20170305180853_add_auto_cancel_pending_pipelines_to_project.rb @@ -0,0 +1,33 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddAutoCancelPendingPipelinesToProject < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + # DOWNTIME_REASON = 'Creating column with default value' + + # When using the methods "add_concurrent_index" or "add_column_with_default" + # you must disable the use of transactions as these methods can not run in an + # existing transaction. When using "add_concurrent_index" make sure that this + # method is the _only_ method called in the migration, any other changes + # should go in a separate migration. This ensures that upon failure _only_ the + # index creation fails and can be retried or reverted easily. + # + # To disable transactions uncomment the following line and remove these + # comments: + disable_ddl_transaction! + + def up + add_column_with_default(:projects, :auto_cancel_pending_pipelines, :integer, default: 0) + end + + def down + remove_column(:projects, :auto_cancel_pending_pipelines) + end +end diff --git a/db/migrate/20170312114329_add_auto_canceled_by_to_pipeline.rb b/db/migrate/20170312114329_add_auto_canceled_by_to_pipeline.rb new file mode 100644 index 00000000000..344b83fa253 --- /dev/null +++ b/db/migrate/20170312114329_add_auto_canceled_by_to_pipeline.rb @@ -0,0 +1,29 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddAutoCanceledByToPipeline < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + # DOWNTIME_REASON = '' + + # When using the methods "add_concurrent_index" or "add_column_with_default" + # you must disable the use of transactions as these methods can not run in an + # existing transaction. When using "add_concurrent_index" make sure that this + # method is the _only_ method called in the migration, any other changes + # should go in a separate migration. This ensures that upon failure _only_ the + # index creation fails and can be retried or reverted easily. + # + # To disable transactions uncomment the following line and remove these + # comments: + # disable_ddl_transaction! + + def change + add_column :ci_commits, :auto_canceled_by, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index ccf18d07179..3ec5b08ac40 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -251,6 +251,7 @@ ActiveRecord::Schema.define(version: 20170402231018) do t.integer "duration" t.integer "user_id" t.integer "lock_version" + t.integer "auto_canceled_by" end add_index "ci_pipelines", ["project_id", "ref", "status"], name: "index_ci_pipelines_on_project_id_and_ref_and_status", using: :btree @@ -687,8 +688,8 @@ ActiveRecord::Schema.define(version: 20170402231018) do t.string "avatar" t.boolean "share_with_group_lock", default: false t.integer "visibility_level", default: 20, null: false - t.boolean "request_access_enabled", default: false, null: false t.datetime "deleted_at" + t.boolean "request_access_enabled", default: false, null: false t.text "description_html" t.boolean "lfs_enabled" t.integer "parent_id" @@ -920,6 +921,7 @@ ActiveRecord::Schema.define(version: 20170402231018) do t.text "description_html" t.boolean "only_allow_merge_if_all_discussions_are_resolved" t.boolean "printing_merge_request_link_enabled", default: true, null: false + t.integer "auto_cancel_pending_pipelines", default: 0, null: false end add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree @@ -1239,9 +1241,9 @@ ActiveRecord::Schema.define(version: 20170402231018) do t.boolean "hide_project_limit", default: false t.string "unlock_token" t.datetime "otp_grace_period_started_at" + t.string "incoming_email_token" t.boolean "ldap_email", default: false, null: false t.boolean "external", default: false - t.string "incoming_email_token" t.string "organization" t.boolean "authorized_projects_populated" t.boolean "ghost" |