Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
Update concourse polling url, since the API changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregg Van Hove and Robert Neumann committed Aug 5, 2015
1 parent 600494c commit 29c1406
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 8 deletions.
3 changes: 2 additions & 1 deletion app/controllers/projects_controller.rb
Expand Up @@ -135,6 +135,7 @@ def project_params
tracker_online tracker_project_id travis_github_account
travis_repository type verify_ssl webhooks_enabled
circleci_username circleci_project_name circleci_auth_token travis_pro_token
concourse_base_url concourse_job_name ci_base_url ci_build_identifier ci_auth_token))
concourse_base_url concourse_job_name ci_base_url ci_build_identifier ci_auth_token
concourse_pipeline_name))
end
end
10 changes: 7 additions & 3 deletions app/models/concourse_project.rb
@@ -1,14 +1,18 @@
class ConcourseProject < Project

validates_presence_of :ci_build_identifier, :ci_base_url
validates_presence_of :ci_build_identifier, :ci_base_url, :concourse_pipeline_name

alias_attribute :build_status_url, :feed_url

def feed_url
"#{ci_base_url}/api/v1/jobs/#{ci_build_identifier}/builds"
"#{ci_base_url}/api/v1/pipelines/#{concourse_pipeline_name}/jobs/#{ci_build_identifier}/builds"
end

def fetch_payload
ConcoursePayload.new("#{ci_base_url}/jobs/#{ci_build_identifier}/builds")
ConcoursePayload.new(feed_url)
end

def self.project_specific_attributes
['concourse_pipeline_name', 'ci_build_identifier', 'ci_base_url']
end
end
2 changes: 2 additions & 0 deletions config/project-meta.yml
Expand Up @@ -21,6 +21,8 @@ labels:
codeship_project: "Project ID"
ci_auth_token:
tddium_project: "Tddium Authentication Token"
concourse_pipeline_name:
concourse_project: "Pipeline Name"

tooltips:
ci_auth_token:
Expand Down
@@ -0,0 +1,5 @@
class AddConcoursePipelineNameToProjects < ActiveRecord::Migration
def change
add_column :projects, :concourse_pipeline_name, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150515205647) do
ActiveRecord::Schema.define(version: 20150805184958) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -154,6 +154,7 @@
t.string "ci_base_url"
t.string "ci_build_identifier"
t.string "ci_auth_token"
t.string "concourse_pipeline_name"
end

add_index "projects", ["aggregate_project_id"], name: "index_projects_on_aggregate_project_id", using: :btree
Expand Down
1 change: 1 addition & 0 deletions spec/factories/projects.rb
Expand Up @@ -70,6 +70,7 @@

factory :concourse_project do
name
concourse_pipeline_name 'concourse-pipeline'
ci_build_identifier 'concourse-project'
ci_base_url 'http://concourse.example.com:8080'
end
Expand Down
5 changes: 3 additions & 2 deletions spec/models/concourse_project_spec.rb
Expand Up @@ -5,16 +5,17 @@

describe 'validations' do
it { is_expected.to validate_presence_of :ci_base_url }
it { is_expected.to validate_presence_of :concourse_pipeline_name }
it { is_expected.to validate_presence_of :ci_build_identifier }
end

describe 'accessors' do
describe '#feed_url' do
it { expect(subject.feed_url).to eq('http://concourse.example.com:8080/api/v1/jobs/concourse-project/builds') }
it { expect(subject.feed_url).to eq('http://concourse.example.com:8080/api/v1/pipelines/concourse-pipeline/jobs/concourse-project/builds') }
end

describe '#build_status_url' do
it { expect(subject.build_status_url).to eq('http://concourse.example.com:8080/api/v1/jobs/concourse-project/builds') }
it { expect(subject.build_status_url).to eq('http://concourse.example.com:8080/api/v1/pipelines/concourse-pipeline/jobs/concourse-project/builds') }
end

describe '#ci_build_identifier' do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/project_spec.rb
Expand Up @@ -511,7 +511,7 @@
context "when a ConcourseProject" do
let(:project_class) { ConcourseProject }

it { is_expected.to match_array(['ci_base_url', 'ci_build_identifier']) }
it { is_expected.to match_array(['ci_base_url', 'ci_build_identifier', 'concourse_pipeline_name']) }
end

context "when a CircleCiProject" do
Expand Down

0 comments on commit 29c1406

Please sign in to comment.