Skip to content

Commit

Permalink
Merge branch 'master' into ci-ebs_retry_options
Browse files Browse the repository at this point in the history
  • Loading branch information
iriberri committed Mar 21, 2019
2 parents b6942ed + c2b8680 commit f105d05
Show file tree
Hide file tree
Showing 35 changed files with 264 additions and 245 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Expand Up @@ -3,8 +3,7 @@ rvm:
- "2.2.9"
- "2.3.6"
- "2.4"
- "2.5.0"
- "2.5"
- "2.5.3"

jobs:
include:
Expand All @@ -29,7 +28,6 @@ jobs:
repo: travis-ci/dpl
if: branch = master AND NOT type IN (pull_request)
allow_failures:
- rvm: "2.5"

env:
global:
Expand All @@ -55,4 +53,3 @@ before_script:

script:
- rake

56 changes: 31 additions & 25 deletions README.md
Expand Up @@ -18,12 +18,12 @@ Dpl supports the following providers:
* [BitBalloon](#bitballoon)
* [Bluemix Cloud Foundry](#bluemix-cloud-foundry)
* [Boxfuse](#boxfuse)
* [cargo](#cargo)
* [Catalyze](#catalyze)
* [Chef Supermarket](#chef-supermarket)
* [Cloud 66](#cloud-66)
* [Cloud Foundry](#cloud-foundry)
* [Deis](#deis)
* [Divshot.io](#divshotio)
* [Engine Yard](#engine-yard)
* [Firebase](#firebase)
* [Github Pages](#github-pages)
Expand All @@ -35,7 +35,6 @@ Dpl supports the following providers:
* [Heroku](#heroku)
* [Lambda](#lambda)
* [Launchpad](#launchpad)
* [Modulus](#modulus)
* [Nodejitsu](#nodejitsu)
* [NPM](#npm)
* [OpenShift](#openshift)
Expand All @@ -46,6 +45,7 @@ Dpl supports the following providers:
* [RubyGems](#rubygems)
* [Scalingo](#scalingo)
* [Script](#script)
* [Snap](#snap)
* [Surge.sh](#surgesh)
* [TestFairy](#testfairy)

Expand Down Expand Up @@ -220,18 +220,6 @@ For authentication you can also use Travis CI secure environment variable:
#### Examples:
dpl --provider=nodejitsu --username=<username> --api-key=<api-key>


### Modulus

#### Options:

* **api-key** Modulus Authentication Token
* **project-name** Modulus Project to Deploy

#### Example:
dpl --provider=modulus --api-key=<api-key> --project-name=<project-name>


### Engine Yard:

#### Options:
Expand Down Expand Up @@ -420,6 +408,7 @@ For example: `--endpoint=https://nyc3.digitaloceanspaces.com`
* **password**: anynines password.
* **organization**: anynines target organization.
* **space**: anynines target space
* **app_name**: Application name. Optional.

#### Examples:

Expand Down Expand Up @@ -471,17 +460,6 @@ You first need to create an [Atlas account](https://atlas.hashicorp.com/account/

dpl --provider=AzureWebApps --username=depluser --password=deplp@ss --site=dplsite --slot=dplsite-test --verbose

### Divshot.io:

#### Options:

* **api-key**: Divshot.io API key
* **environment**: Which environment (development, staging, production) to deploy to

#### Examples:

dpl --provider=divshot --api-key=<api-key> --environment=<environment>

### Cloud Foundry:

#### Options:
Expand All @@ -491,13 +469,24 @@ You first need to create an [Atlas account](https://atlas.hashicorp.com/account/
* **organization**: Cloud Foundry target organization.
* **api**: Cloud Foundry api URL
* **space**: Cloud Foundry target space
* **app_name**: Application name. Optional.
* **manifest**: Path to manifest file. Optional.
* **skip_ssl_validation**: Skip ssl validation. Optional.

#### Examples:

dpl --provider=cloudfoundry --username=<username> --password=<password> --organization=<organization> --api=<api> --space=<space> --skip-ssl-validation

### cargo:

#### Options:

* **token**: Your cargo registry API token, for crates.io generate at <https://crates.io/me>

#### Examples:

dpl --provider=cargo --token=<token>

### Rackspace Cloud Files:

#### Options:
Expand Down Expand Up @@ -917,6 +906,22 @@ In order to use this provider, please make sure you have the [App Engine Admin A



### Snap

Deploys built snaps to the [snap store](https://snapcraft.io/).

#### Options:

* **snap** Path (glob) of the snap to be pushed
* **channel** Optional. Channel into which the snap will be released (defaults to `edge`)
* **token** Optional. Login token for the store (generate with `snapcraft export-login`). Falls back to the `$SNAP_TOKEN` environment variable

#### Examples:

dpl --provider=snap --token=<token> --snap=my.snap --channel=edge



### Surge.sh

#### Options:
Expand All @@ -943,6 +948,7 @@ In order to use this provider, please make sure you have the [App Engine Admin A
* **space**: Bluemix target space
* **region**: Bluemix region [ng, eu-gb, eu-de, au-syd]. Optional, default US region (ng).
* **api**: Bluemix api URL. Optional for Bluemix dedicated. Explicit **api** setting precedence over **region** setting.
* **app_name**: Application name. Optional.
* **manifest**: Path to manifest file. Optional.
* **skip_ssl_validation**: Skip ssl validation. Optional.

Expand Down
2 changes: 1 addition & 1 deletion dpl-divshot.gemspec → dpl-cargo.gemspec
@@ -1,3 +1,3 @@
require './gemspec_helper'

gemspec_for 'divshot'
gemspec_for 'cargo'
2 changes: 1 addition & 1 deletion dpl-cloud_files.gemspec
@@ -1,3 +1,3 @@
require './gemspec_helper'

gemspec_for 'cloud_files', [['net-ssh'], ['mime-types'], ['nokogiri'], ['fog-rackspace']]
gemspec_for 'cloud_files', [['nokogiri', '< 1.10'], ['fog-rackspace']]
3 changes: 0 additions & 3 deletions dpl-modulus.gemspec

This file was deleted.

4 changes: 2 additions & 2 deletions gemspec_helper.rb
Expand Up @@ -39,7 +39,7 @@ def gemspec_for(provider_name=nil, runtime_dependencies=[])

# set up files
if provider_name
s.files = `git ls-files`.split("\n").grep(Regexp.new provider_name.to_s)
s.files = `git ls-files`.split("\n").grep(Regexp.new provider_name.to_s) + ["lib/dpl/version.rb"]
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").grep(Regexp.new provider_name.to_s)
else
s.files = `git ls-files`.split("\n").reject {|f| f =~ Regexp.new("provider/")}
Expand All @@ -48,4 +48,4 @@ def gemspec_for(provider_name=nil, runtime_dependencies=[])
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }.grep(Regexp.new provider_name.to_s)

end
end
end
9 changes: 6 additions & 3 deletions lib/dpl/provider.rb
Expand Up @@ -25,8 +25,8 @@ class Provider
'CloudFiles' => 'cloud_files',
'CloudFoundry' => 'cloud_foundry',
'CodeDeploy' => 'code_deploy',
'Cargo' => 'cargo',
'Deis' => 'deis',
'Divshot' => 'divshot',
'ElasticBeanstalk' => 'elastic_beanstalk',
'EngineYard' => 'engine_yard',
'Firebase' => 'firebase',
Expand All @@ -37,7 +37,6 @@ class Provider
'Heroku' => 'heroku',
'Lambda' => 'lambda',
'Launchpad' => 'launchpad',
'Modulus' => 'modulus',
'Nodejitsu' => 'nodejitsu',
'NPM' => 'npm',
'Openshift' => 'openshift',
Expand Down Expand Up @@ -159,7 +158,11 @@ def self.class_of(filename)

def initialize(context, options)
@context, @options = context, options
context.env['GIT_HTTP_USER_AGENT'] = user_agent(git: `git --version`[/[\d\.]+/])
if options.key?(:needs_git_http_user_agent) && !options[:needs_git_http_user_agent]
context.env.delete 'GIT_HTTP_USER_AGENT'
else
context.env['GIT_HTTP_USER_AGENT'] = user_agent(git: `git --version`[/[\d\.]+/])
end
end

def user_agent(*strings)
Expand Down
8 changes: 6 additions & 2 deletions lib/dpl/provider/anynines.rb
Expand Up @@ -9,7 +9,7 @@ class Anynines < Provider
# from source.

def initial_go_tools_install
context.shell 'test x$TRAVIS_OS_NAME = "xlinux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
context.shell 'test $(uname) = "Linux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
end

def check_auth
Expand All @@ -29,7 +29,7 @@ def needs_key?
end

def push_app
error 'Failed to push app' unless context.shell("./cf push#{manifest}")
error 'Failed to push app' unless context.shell("./cf push#{app_name}#{manifest}")

ensure
context.shell "./cf logout"
Expand All @@ -41,6 +41,10 @@ def cleanup
def uncleanup
end

def app_name
options[:app_name].nil? ? "" : " '#{options[:app_name]}'"
end

def manifest
options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
end
Expand Down
15 changes: 5 additions & 10 deletions lib/dpl/provider/atlas.rb
Expand Up @@ -30,6 +30,10 @@ class Atlas < Provider

experimental 'Atlas'

def self.new(context, options)
super(context, options.merge!({needs_git_http_user_agent: false}))
end

def deploy
assert_app_present!
install_atlas_upload
Expand Down Expand Up @@ -60,9 +64,7 @@ def push_app
private

def install_atlas_upload
without_git_http_user_agent do
context.shell ATLAS_UPLOAD_INSTALL_SCRIPT
end
context.shell ATLAS_UPLOAD_INSTALL_SCRIPT
end

def assert_app_present!
Expand Down Expand Up @@ -96,13 +98,6 @@ def atlas_upload_args
def atlas_app
@atlas_app ||= options.fetch(:app).to_s
end

def without_git_http_user_agent(&block)
git_http_user_agent = ENV.delete("GIT_HTTP_USER_AGENT")
yield
ENV["GIT_HTTP_USER_AGENT"] = git_http_user_agent
end

end
end
end
8 changes: 6 additions & 2 deletions lib/dpl/provider/bluemix_cloud_foundry.rb
Expand Up @@ -16,7 +16,7 @@ class BluemixCloudFoundry < Provider
)

def initial_go_tools_install
context.shell 'test x$TRAVIS_OS_NAME = "xlinux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
context.shell 'test $(uname) = "Linux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
end

def check_auth
Expand All @@ -37,7 +37,7 @@ def needs_key?
end

def push_app
error 'Failed to push app' unless context.shell("./cf push#{manifest}")
error 'Failed to push app' unless context.shell("./cf push#{app_name}#{manifest}")

ensure
context.shell "./cf logout"
Expand All @@ -49,6 +49,10 @@ def cleanup
def uncleanup
end

def app_name
options[:app_name].nil? ? "" : " '#{options[:app_name]}'"
end

def manifest
options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
end
Expand Down
22 changes: 22 additions & 0 deletions lib/dpl/provider/cargo.rb
@@ -0,0 +1,22 @@
require 'json'
require 'uri'

module DPL
class Provider
class Cargo < Provider
def needs_key?
false
end

def check_auth
option(:token)
end

def push_app
if ! context.shell "cargo publish --token #{option(:token)}"
raise Error, "Publish failed"
end
end
end
end
end
8 changes: 6 additions & 2 deletions lib/dpl/provider/cloud_foundry.rb
Expand Up @@ -3,7 +3,7 @@ class Provider
class CloudFoundry < Provider

def initial_go_tools_install
context.shell 'test x$TRAVIS_OS_NAME = "xlinux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
context.shell 'test $(uname) = "Linux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz'
end

def check_auth
Expand All @@ -23,7 +23,7 @@ def needs_key?
end

def push_app
error 'Failed to push app' unless context.shell("./cf push#{manifest}")
error 'Failed to push app' unless context.shell("./cf push#{app_name}#{manifest}")

ensure
context.shell "./cf logout"
Expand All @@ -35,6 +35,10 @@ def cleanup
def uncleanup
end

def app_name
options[:app_name].nil? ? "" : " '#{options[:app_name]}'"
end

def manifest
options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
end
Expand Down
23 changes: 0 additions & 23 deletions lib/dpl/provider/divshot.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/dpl/provider/firebase.rb
@@ -1,7 +1,7 @@
module DPL
class Provider
class Firebase < Provider
npm_g 'firebase-tools@^3.0', 'firebase'
npm_g 'firebase-tools@^6.3', 'firebase'

def check_auth
raise Error, "must supply token option or FIREBASE_TOKEN environment variable" if !options[:token] && !context.env['FIREBASE_TOKEN']
Expand Down

0 comments on commit f105d05

Please sign in to comment.