diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 9545a6e3ab9..e2663f50dd1 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -19,6 +19,8 @@ module Ci after_save :keep_around_commits + delegate :stages, to: :statuses + # ref can't be HEAD or SHA, can only be branch/tag name scope :latest_successful_for, ->(ref = default_branch) do where(ref: ref).success.order(id: :desc).limit(1) diff --git a/db/schema.rb b/db/schema.rb index 6c85e1e9dba..5b901b17265 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -895,6 +895,7 @@ ActiveRecord::Schema.define(version: 20160810142633) do t.string "category", default: "common", null: false t.boolean "default", default: false t.boolean "wiki_page_events", default: true + t.boolean "pipeline_events", default: false, null: false end add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree @@ -1098,6 +1099,7 @@ ActiveRecord::Schema.define(version: 20160810142633) do t.boolean "build_events", default: false, null: false t.boolean "wiki_page_events", default: false, null: false t.string "token" + t.boolean "pipeline_events", default: false, null: false end add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree diff --git a/lib/gitlab/data_builder/pipeline_data_builder.rb b/lib/gitlab/data_builder/pipeline_data_builder.rb index a4c770b630f..3dc4d50fcde 100644 --- a/lib/gitlab/data_builder/pipeline_data_builder.rb +++ b/lib/gitlab/data_builder/pipeline_data_builder.rb @@ -15,9 +15,6 @@ module Gitlab end def hook_attrs(pipeline) - first_pending_build = pipeline.builds.first_pending - config_processor = pipeline.config_processor unless pipeline.skip_ci? - { id: pipeline.id, ref: pipeline.ref, @@ -25,8 +22,7 @@ module Gitlab sha: pipeline.sha, before_sha: pipeline.before_sha, status: pipeline.status, - stage: first_pending_build.try(:stage), - stages: config_processor.try(:stages), + stages: pipeline.stages, created_at: pipeline.created_at, finished_at: pipeline.finished_at, duration: pipeline.duration