Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #105 from square/jeversmann/no_notes
Browse files Browse the repository at this point in the history
Remove git notes
  • Loading branch information
robolson committed Jul 16, 2014
2 parents 29e680c + bb7b892 commit 965ee06
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 32 deletions.
5 changes: 2 additions & 3 deletions app/controllers/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions app/jobs/build_state_update_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions app/models/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions app/models/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions app/views/repositories/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20140715225910_remove_notes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveNotes < ActiveRecord::Migration
def change
remove_column :repositories, :on_success_note, :string
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions lib/build_strategies/development_build_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 0 additions & 8 deletions lib/build_strategies/production_build_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions lib/build_strategies/test_build_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion spec/controllers/repositories_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 965ee06

Please sign in to comment.