Skip to content

Commit

Permalink
Merge pull request #550 from adamkingit/master
Browse files Browse the repository at this point in the history
Add Bluemix deploy provider
  • Loading branch information
BanzaiMan authored Jan 23, 2017
2 parents 98bdba7 + 6318619 commit 27c9c41
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Gemfile.lock
.coverage
coverage
.dpl
setuptools*.zip
google_appengine_*.zip
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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=<project-path> --domain=<domain-name>

### 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=<username> --password=<password> --organization=<organization> --region=<region> --space=<space> --skip-ssl-validation
83 changes: 42 additions & 41 deletions lib/dpl/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions lib/dpl/provider/bluemix_cloud_foundry.rb
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions spec/provider/bluemixcloudfoundry_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 27c9c41

Please sign in to comment.