diff --git a/.gitignore b/.gitignore index 7072f9ed5..32ae77841 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ Gemfile.lock .coverage +coverage .dpl setuptools*.zip google_appengine_*.zip diff --git a/README.md b/README.md index 8d4c5a551..ac8a71fe9 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Dpl supports the following providers: * [Azure Web Apps](#azure-web-apps) * [Bintray](#bintray) * [BitBalloon](#bitballoon) +* [Bluemix Cloud Foundry](#bluemix-cloud-foundry) * [Boxfuse](#boxfuse) * [Catalyze](#catalyze) * [Chef Supermarket](#chef-supermarket) @@ -910,3 +911,19 @@ In order to use this provider, please make sure you have the [App Engine Admin A #### Example: dpl --provider=surge --project= --domain= +### Bluemix Cloud Foundry: + +#### Options: + +* **username**: Bluemix username. +* **password**: Bluemix password. +* **organization**: Bluemix target organization. +* **space**: Bluemix target space +* **region**: Bluemix region [ng, eu-gb, au-syd]. Optional, default US region (ng). +* **api**: Bluemix api URL. Optional for Bluemix dedicated. Explicit **api** setting precedence over **region** setting. +* **manifest**: Path to manifest file. Optional. +* **skip_ssl_validation**: Skip ssl validation. Optional. + +#### Examples: + + dpl --provider=bluemixcf --username= --password= --organization= --region= --space= --skip-ssl-validation diff --git a/lib/dpl/provider.rb b/lib/dpl/provider.rb index 3ad1ea663..78e81dead 100644 --- a/lib/dpl/provider.rb +++ b/lib/dpl/provider.rb @@ -6,47 +6,48 @@ module DPL class Provider include FileUtils - autoload :Anynines, 'dpl/provider/anynines' - autoload :Appfog, 'dpl/provider/appfog' - autoload :Atlas, 'dpl/provider/atlas' - autoload :AzureWebApps, 'dpl/provider/azure_webapps' - autoload :Bintray, 'dpl/provider/bintray' - autoload :BitBalloon, 'dpl/provider/bitballoon' - autoload :Boxfuse, 'dpl/provider/boxfuse' - autoload :Catalyze, 'dpl/provider/catalyze' - autoload :ChefSupermarket, 'dpl/provider/chef_supermarket' - autoload :Cloud66, 'dpl/provider/cloud66' - autoload :CloudFiles, 'dpl/provider/cloud_files' - autoload :CloudFoundry, 'dpl/provider/cloud_foundry' - autoload :CodeDeploy, 'dpl/provider/code_deploy' - autoload :Deis, 'dpl/provider/deis' - autoload :Divshot, 'dpl/provider/divshot' - autoload :ElasticBeanstalk, 'dpl/provider/elastic_beanstalk' - autoload :EngineYard, 'dpl/provider/engine_yard' - autoload :Firebase, 'dpl/provider/firebase' - autoload :GAE, 'dpl/provider/gae' - autoload :GCS, 'dpl/provider/gcs' - autoload :Hackage, 'dpl/provider/hackage' - autoload :Heroku, 'dpl/provider/heroku' - autoload :Lambda, 'dpl/provider/lambda' - autoload :Launchpad, 'dpl/provider/launchpad' - autoload :Modulus, 'dpl/provider/modulus' - autoload :Nodejitsu, 'dpl/provider/nodejitsu' - autoload :NPM, 'dpl/provider/npm' - autoload :Openshift, 'dpl/provider/openshift' - autoload :OpsWorks, 'dpl/provider/ops_works' - autoload :Packagecloud, 'dpl/provider/packagecloud' - autoload :Pages, 'dpl/provider/pages' - autoload :PuppetForge, 'dpl/provider/puppet_forge' - autoload :PyPI, 'dpl/provider/pypi' - autoload :Releases, 'dpl/provider/releases' - autoload :RubyGems, 'dpl/provider/rubygems' - autoload :S3, 'dpl/provider/s3' - autoload :Scalingo, 'dpl/provider/scalingo' - autoload :Script, 'dpl/provider/script' - autoload :Surge, 'dpl/provider/surge' - autoload :TestFairy, 'dpl/provider/testfairy' - autoload :Transifex, 'dpl/provider/transifex' + autoload :Anynines, 'dpl/provider/anynines' + autoload :Appfog, 'dpl/provider/appfog' + autoload :Atlas, 'dpl/provider/atlas' + autoload :AzureWebApps, 'dpl/provider/azure_webapps' + autoload :Bintray, 'dpl/provider/bintray' + autoload :BitBalloon, 'dpl/provider/bitballoon' + autoload :BluemixCloudFoundry, 'dpl/provider/bluemix_cloud_foundry' + autoload :Boxfuse, 'dpl/provider/boxfuse' + autoload :Catalyze, 'dpl/provider/catalyze' + autoload :ChefSupermarket, 'dpl/provider/chef_supermarket' + autoload :Cloud66, 'dpl/provider/cloud66' + autoload :CloudFiles, 'dpl/provider/cloud_files' + autoload :CloudFoundry, 'dpl/provider/cloud_foundry' + autoload :CodeDeploy, 'dpl/provider/code_deploy' + autoload :Deis, 'dpl/provider/deis' + autoload :Divshot, 'dpl/provider/divshot' + autoload :ElasticBeanstalk, 'dpl/provider/elastic_beanstalk' + autoload :EngineYard, 'dpl/provider/engine_yard' + autoload :Firebase, 'dpl/provider/firebase' + autoload :GAE, 'dpl/provider/gae' + autoload :GCS, 'dpl/provider/gcs' + autoload :Hackage, 'dpl/provider/hackage' + autoload :Heroku, 'dpl/provider/heroku' + autoload :Lambda, 'dpl/provider/lambda' + autoload :Launchpad, 'dpl/provider/launchpad' + autoload :Modulus, 'dpl/provider/modulus' + autoload :Nodejitsu, 'dpl/provider/nodejitsu' + autoload :NPM, 'dpl/provider/npm' + autoload :Openshift, 'dpl/provider/openshift' + autoload :OpsWorks, 'dpl/provider/ops_works' + autoload :Packagecloud, 'dpl/provider/packagecloud' + autoload :Pages, 'dpl/provider/pages' + autoload :PuppetForge, 'dpl/provider/puppet_forge' + autoload :PyPI, 'dpl/provider/pypi' + autoload :Releases, 'dpl/provider/releases' + autoload :RubyGems, 'dpl/provider/rubygems' + autoload :S3, 'dpl/provider/s3' + autoload :Scalingo, 'dpl/provider/scalingo' + autoload :Script, 'dpl/provider/script' + autoload :Surge, 'dpl/provider/surge' + autoload :TestFairy, 'dpl/provider/testfairy' + autoload :Transifex, 'dpl/provider/transifex' def self.new(context, options) diff --git a/lib/dpl/provider/bluemix_cloud_foundry.rb b/lib/dpl/provider/bluemix_cloud_foundry.rb new file mode 100644 index 000000000..5d34ebe5b --- /dev/null +++ b/lib/dpl/provider/bluemix_cloud_foundry.rb @@ -0,0 +1,22 @@ +module DPL + class Provider + class BluemixCloudFoundry < CloudFoundry + + REGIONS = Hash.new {"api.ng.bluemix.net"}.update( + "eu-gb" => "api.eu-gb.bluemix.net", + "au-syd" => "api.au-syd.bluemix.net" + ) + + def set_api + region = options[:region] || "ng" + options[:api] = options[:api] || REGIONS[region] + end + + def check_auth + set_api + super + end + + end + end +end diff --git a/spec/provider/bluemixcloudfoundry_spec.rb b/spec/provider/bluemixcloudfoundry_spec.rb new file mode 100644 index 000000000..856ad22c5 --- /dev/null +++ b/spec/provider/bluemixcloudfoundry_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' +require 'dpl/provider/bluemix_cloud_foundry' + +describe DPL::Provider::BluemixCloudFoundry do + subject :provider do + described_class.new(DummyContext.new, region: 'eu-gb', username: 'Moonpie', + password: 'myexceptionallyaveragepassword', + organization: 'myotherorg', + space: 'inner', + manifest: 'worker-manifest.yml', + skip_ssl_validation: true) + end + + describe "#check_auth" do + example do + expect(provider.context).to receive(:shell).with('wget \'https://cli.run.pivotal.io/stable?release=linux64-binary&source=github\' -qO cf-linux-amd64.tgz && tar -zxvf cf-linux-amd64.tgz && rm cf-linux-amd64.tgz') + expect(provider.context).to receive(:shell).with('./cf api api.eu-gb.bluemix.net --skip-ssl-validation') + expect(provider.context).to receive(:shell).with('./cf login -u Moonpie -p myexceptionallyaveragepassword -o myotherorg -s inner') + provider.check_auth + end + end + +end