From bb7b892afb4d05ad073d0d833660e2dafa629c48 Mon Sep 17 00:00:00 2001 From: Joshua Eversmann Date: Tue, 15 Jul 2014 16:09:27 -0700 Subject: [PATCH] git notes no longer supported --- app/controllers/repositories_controller.rb | 5 ++--- app/jobs/build_state_update_job.rb | 3 --- app/models/build.rb | 4 ---- app/models/repository.rb | 4 ---- app/views/repositories/_form.html.haml | 3 --- db/migrate/20140715225910_remove_notes.rb | 5 +++++ db/schema.rb | 3 +-- lib/build_strategies/development_build_strategy.rb | 2 -- lib/build_strategies/production_build_strategy.rb | 8 -------- lib/build_strategies/test_build_strategy.rb | 2 -- spec/controllers/repositories_controller_spec.rb | 1 - 11 files changed, 8 insertions(+), 32 deletions(-) create mode 100644 db/migrate/20140715225910_remove_notes.rb diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 8935c3e97..1bd9c0546 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -101,9 +101,8 @@ def ensure_build(repository, branch, sha) def repository_params params.require(:repository). - permit(:url, :name, :test_command, :timeout, - :build_pull_requests, :run_ci, :on_green_update, - :on_success_note, :on_success_script, + permit(:url, :name, :test_command, :timeout, :build_pull_requests, + :run_ci, :on_green_update, :on_success_script, :send_build_failure_email, :allows_kochiku_merges) end end diff --git a/app/jobs/build_state_update_job.rb b/app/jobs/build_state_update_job.rb index 9aa222b08..eb02405ab 100644 --- a/app/jobs/build_state_update_job.rb +++ b/app/jobs/build_state_update_job.rb @@ -21,9 +21,6 @@ def perform end if build.succeeded? - if build.repository.has_on_success_note? - build.add_note! - end if build.on_success_script.present? && !build.on_success_script_log_file.present? BuildStrategy.run_success_script(build) end diff --git a/app/models/build.rb b/app/models/build.rb index 9c894c686..705907711 100644 --- a/app/models/build.rb +++ b/app/models/build.rb @@ -180,10 +180,6 @@ def promote! end end - def add_note! - BuildStrategy.add_note(ref, "ci-#{project.name}", repository) - end - def completed? TERMINAL_STATES.include?(state) end diff --git a/app/models/repository.rb b/app/models/repository.rb index 6950bc3ba..acbc9f22f 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -67,10 +67,6 @@ def has_on_success_script? on_success_script.to_s.strip.present? end - def has_on_success_note? - on_success_note.to_s.strip.present? - end - # Public: attempts to lookup a build for the commit under any of the # repository's projects. This is done as an optimization since the contents # of the commit are guaranteed to not have changed. diff --git a/app/views/repositories/_form.html.haml b/app/views/repositories/_form.html.haml index f7d1e2979..cbbe806e8 100644 --- a/app/views/repositories/_form.html.haml +++ b/app/views/repositories/_form.html.haml @@ -28,9 +28,6 @@ %div %label{:for => "on_green_update"} Update branches to last green commit: = f.text_field :on_green_update, {:id => "on_green_update", :placeholder => "Comma separated list of branches"} - %div - %label{:for => "on_success_note"} Add git note: - = f.text_field :on_success_note, {:id => "on_success_note", :placeholder => "ex. (ci=green)"} %div %label{:for => "on_success_script"} Run: = f.text_field :on_success_script, {:id => "on_success_script"} diff --git a/db/migrate/20140715225910_remove_notes.rb b/db/migrate/20140715225910_remove_notes.rb new file mode 100644 index 000000000..d7ecbeb7d --- /dev/null +++ b/db/migrate/20140715225910_remove_notes.rb @@ -0,0 +1,5 @@ +class RemoveNotes < ActiveRecord::Migration + def change + remove_column :repositories, :on_success_note, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 96617705c..e49a4e59f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140617214701) do +ActiveRecord::Schema.define(version: 20140715225910) do create_table "build_artifacts", force: true do |t| t.integer "build_attempt_id" @@ -90,7 +90,6 @@ t.boolean "send_build_failure_email", default: true, null: false t.string "on_success_script" t.integer "timeout", default: 40 - t.string "on_success_note" t.string "name", null: false t.boolean "allows_kochiku_merges", default: true t.string "host", null: false diff --git a/lib/build_strategies/development_build_strategy.rb b/lib/build_strategies/development_build_strategy.rb index ae77ca329..5ef7a5052 100644 --- a/lib/build_strategies/development_build_strategy.rb +++ b/lib/build_strategies/development_build_strategy.rb @@ -6,7 +6,5 @@ def merge_ref(ref) end def run_success_script(build) end - def add_note(build_ref, namespace, note) - end end end diff --git a/lib/build_strategies/production_build_strategy.rb b/lib/build_strategies/production_build_strategy.rb index b864b8f1e..e84c780b1 100644 --- a/lib/build_strategies/production_build_strategy.rb +++ b/lib/build_strategies/production_build_strategy.rb @@ -24,14 +24,6 @@ def promote_build(build) end end - def add_note(build_ref, namespace, repository) - GitRepo.inside_repo(repository) do - Cocaine::CommandLine.new("git", "fetch -f origin refs/notes/*:refs/notes/*").run - Cocaine::CommandLine.new("git", "notes --ref=#{namespace} add -f -m '#{repository.on_success_note}' #{build_ref}").run - Cocaine::CommandLine.new("git", "push -f origin refs/notes/#{namespace}").run - end - end - def run_success_script(build) GitRepo.inside_copy(build.repository, build.ref) do command = Cocaine::CommandLine.new(build.on_success_script, "", :expected_outcodes => 0..255) diff --git a/lib/build_strategies/test_build_strategy.rb b/lib/build_strategies/test_build_strategy.rb index ae77ca329..5ef7a5052 100644 --- a/lib/build_strategies/test_build_strategy.rb +++ b/lib/build_strategies/test_build_strategy.rb @@ -6,7 +6,5 @@ def merge_ref(ref) end def run_success_script(build) end - def add_note(build_ref, namespace, note) - end end end diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb index a74e0f97b..3bfc35085 100644 --- a/spec/controllers/repositories_controller_spec.rb +++ b/spec/controllers/repositories_controller_spec.rb @@ -123,7 +123,6 @@ :test_command, :on_green_update, :on_success_script, - :on_success_note, :name ].each do |attribute| it "should successfully update the #{attribute} attribute" do