balanced-cookbooks / balanced-ci

Internal configuration for the Jekins CI environment
4 stars 1 forks source link

How to override default command for a job? #7

Closed mjallday closed 10 years ago

mjallday commented 10 years ago

If the default command for the build job was fab build, how could I customize and override that?

I think it would be good if I could do

balanced_ci_pipeline 'balanced' do
  package_name 'balanced_service'
  test_db_user 'balanced'
  test_db_name 'balanced_test'
  test_db_host 'localhost'
  # override
  build_command 'make && make install'
end
coderanger commented 10 years ago

So this would just be a new attribute on the resource like attribute(:build_command, kind_of: String, default: 'fab build') and then down in the provider do new_resource.build_command.

mjallday commented 10 years ago

When you say resource do you mean the resource in balanced-ci or in the ci cookbook? As in #4 we ideally don't want to have to be explicit in everything we declare.

coderanger commented 10 years ago

In Chef::Resource::BalancedCIPipeline.

mjallday commented 10 years ago

class Chef

  class Resource::BalancedCiJob < Resource::CiJob
    attribute(:downstream_triggers, kind_of: Array, default: [])
    attribute(:downstream_joins, kind_of: Array, default: [])

    attribute(:xxx ,kind_of: string)

  end

  class Provider::BalancedCiJob < Provider::CiJob
  end
end

then

class Chef
  class Resource::BalancedCiPipeline < Resource
  end

  class Provider::BalancedCiPipeline < Provider
     def create_some_job
        balanced_ci_job 'name' do

        end
     end
  end
end

how to set attribute :xxx to default new_resource.xxx?