travis_dpl_test 2.0.3.beta.4.ror

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +172 -0
  3. data/CODE_OF_CONDUCT.md +74 -0
  4. data/CONTRIBUTING.md +392 -0
  5. data/Gemfile +32 -0
  6. data/Gemfile.lock +611 -0
  7. data/LICENSE +19 -0
  8. data/README.md +2744 -0
  9. data/Rakefile +210 -0
  10. data/bin/dpl +11 -0
  11. data/config/transliterate.yml +733 -0
  12. data/dpl.gemspec +23 -0
  13. data/lib/dpl/assets/atlas/install +19 -0
  14. data/lib/dpl/assets/convox/install +11 -0
  15. data/lib/dpl/assets/dpl/README.erb.md +138 -0
  16. data/lib/dpl/assets/dpl/git_ssh +8 -0
  17. data/lib/dpl/assets/git/detect_private_key +8 -0
  18. data/lib/dpl/assets/hephy/filter_log +3 -0
  19. data/lib/dpl/assets/pypi/install +4 -0
  20. data/lib/dpl/assets/scalingo/install +6 -0
  21. data/lib/dpl/cli.rb +100 -0
  22. data/lib/dpl/ctx/bash.rb +549 -0
  23. data/lib/dpl/ctx/test.rb +255 -0
  24. data/lib/dpl/ctx.rb +4 -0
  25. data/lib/dpl/helper/assets.rb +38 -0
  26. data/lib/dpl/helper/cmd.rb +169 -0
  27. data/lib/dpl/helper/config_file.rb +49 -0
  28. data/lib/dpl/helper/cookbook_site_streaming_uploader.rb +249 -0
  29. data/lib/dpl/helper/env.rb +92 -0
  30. data/lib/dpl/helper/github.rb +22 -0
  31. data/lib/dpl/helper/interpolate.rb +160 -0
  32. data/lib/dpl/helper/memoize.rb +23 -0
  33. data/lib/dpl/helper/squiggle.rb +24 -0
  34. data/lib/dpl/helper/transliterate.rb +13 -0
  35. data/lib/dpl/helper/wrap.rb +11 -0
  36. data/lib/dpl/helper/zip.rb +71 -0
  37. data/lib/dpl/provider/dsl.rb +410 -0
  38. data/lib/dpl/provider/examples.rb +132 -0
  39. data/lib/dpl/provider/status.rb +61 -0
  40. data/lib/dpl/provider.rb +651 -0
  41. data/lib/dpl/providers/anynines.rb +71 -0
  42. data/lib/dpl/providers/azure_web_apps.rb +63 -0
  43. data/lib/dpl/providers/bintray.rb +324 -0
  44. data/lib/dpl/providers/bluemixcloudfoundry.rb +98 -0
  45. data/lib/dpl/providers/boxfuse.rb +52 -0
  46. data/lib/dpl/providers/cargo.rb +32 -0
  47. data/lib/dpl/providers/chef_supermarket.rb +132 -0
  48. data/lib/dpl/providers/cloud66.rb +46 -0
  49. data/lib/dpl/providers/cloudfiles.rb +62 -0
  50. data/lib/dpl/providers/cloudformation.rb +281 -0
  51. data/lib/dpl/providers/cloudfoundry.rb +89 -0
  52. data/lib/dpl/providers/codedeploy.rb +190 -0
  53. data/lib/dpl/providers/convox.rb +130 -0
  54. data/lib/dpl/providers/datica.rb +64 -0
  55. data/lib/dpl/providers/ecr.rb +129 -0
  56. data/lib/dpl/providers/elasticbeanstalk.rb +207 -0
  57. data/lib/dpl/providers/engineyard.rb +113 -0
  58. data/lib/dpl/providers/firebase.rb +45 -0
  59. data/lib/dpl/providers/flynn.rb +35 -0
  60. data/lib/dpl/providers/gae.rb +78 -0
  61. data/lib/dpl/providers/gcs.rb +132 -0
  62. data/lib/dpl/providers/git_push.rb +273 -0
  63. data/lib/dpl/providers/gleis.rb +74 -0
  64. data/lib/dpl/providers/hackage.rb +53 -0
  65. data/lib/dpl/providers/hephy.rb +107 -0
  66. data/lib/dpl/providers/heroku/api.rb +123 -0
  67. data/lib/dpl/providers/heroku/git.rb +54 -0
  68. data/lib/dpl/providers/heroku.rb +111 -0
  69. data/lib/dpl/providers/lambda.rb +211 -0
  70. data/lib/dpl/providers/launchpad.rb +80 -0
  71. data/lib/dpl/providers/netlify.rb +38 -0
  72. data/lib/dpl/providers/npm.rb +130 -0
  73. data/lib/dpl/providers/nuget.rb +41 -0
  74. data/lib/dpl/providers/openshift.rb +52 -0
  75. data/lib/dpl/providers/opsworks.rb +146 -0
  76. data/lib/dpl/providers/packagecloud.rb_ +194 -0
  77. data/lib/dpl/providers/pages/api.rb +106 -0
  78. data/lib/dpl/providers/pages/git.rb +262 -0
  79. data/lib/dpl/providers/pages.rb +18 -0
  80. data/lib/dpl/providers/puppetforge.rb +50 -0
  81. data/lib/dpl/providers/pypi.rb +125 -0
  82. data/lib/dpl/providers/releases.rb +234 -0
  83. data/lib/dpl/providers/rubygems.rb +97 -0
  84. data/lib/dpl/providers/s3.rb +251 -0
  85. data/lib/dpl/providers/scalingo.rb +69 -0
  86. data/lib/dpl/providers/script.rb +32 -0
  87. data/lib/dpl/providers/snap.rb +68 -0
  88. data/lib/dpl/providers/surge.rb +59 -0
  89. data/lib/dpl/providers/testfairy.rb +101 -0
  90. data/lib/dpl/providers/transifex.rb +72 -0
  91. data/lib/dpl/providers.rb +48 -0
  92. data/lib/dpl/string_ext.rb +23 -0
  93. data/lib/dpl/support/aws_sdk_patch.rb +26 -0
  94. data/lib/dpl/support/gems.rb +73 -0
  95. data/lib/dpl/support/gstore_patch.rb +8 -0
  96. data/lib/dpl/support/version.rb +84 -0
  97. data/lib/dpl/version.rb +5 -0
  98. data/lib/dpl.rb +23 -0
  99. data/status.json +237 -0
  100. metadata +161 -0
data/dpl.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH << 'lib'
4
+
5
+ require 'dpl/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.version = Dpl::VERSION
9
+ s.name = 'travis_dpl_test'
10
+ s.authors = ['Konstantin Haase', 'Hiro Asari', 'Sven Fuchs']
11
+ s.email = ['konstantin@travis-ci.com', 'hiro@travis-ci.com', 'sven@travis-ci.com']
12
+ s.homepage = 'https://github.com/travis-ci/dpl'
13
+ s.summary = 'Dpl runs deployments at Travis CI'
14
+ s.description = 'Dpl (dee-pee-ell) is a tool made for continuous deployment, running deployments at Travis CI.'
15
+ s.license = 'MIT'
16
+ s.require_path = 'lib'
17
+ s.required_ruby_version = '>= 3'
18
+
19
+ s.executables = ['dpl']
20
+ s.files = Dir['{config/**/*,lib/**/*,[A-Z]*}']
21
+
22
+ s.add_development_dependency 'rake', '~> 13.0'
23
+ end
@@ -0,0 +1,19 @@
1
+ if ! command -v atlas-upload &>/dev/null ; then
2
+ mkdir -p $HOME/bin $HOME/gopath/src
3
+ export PATH="$HOME/bin:$PATH"
4
+
5
+ if ! command -v gimme &>/dev/null ; then
6
+ curl -sL -o $HOME/bin/gimme https://raw.githubusercontent.com/meatballhat/gimme/master/gimme
7
+ chmod +x $HOME/bin/gimme
8
+ fi
9
+
10
+ if [ -z $GOPATH ]; then
11
+ export GOPATH="$HOME/gopath"
12
+ else
13
+ export GOPATH="$HOME/gopath:$GOPATH"
14
+ fi
15
+ eval "$(gimme 1.6)" &> /dev/null
16
+
17
+ go get github.com/hashicorp/atlas-upload-cli
18
+ cp $HOME/gopath/bin/atlas-upload-cli $HOME/bin/atlas-upload
19
+ fi
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ if ! command -v convox &> /dev/null; then
4
+ echo "Downloading convox CLI"
5
+ mkdir -p $HOME/bin
6
+ export PATH="$HOME/bin:$PATH"
7
+ curl -sL -o $HOME/bin/convox %{install_url}
8
+ chmod +x $HOME/bin/convox
9
+ else
10
+ echo "Convox CLI exists. Skipping installation"
11
+ fi
@@ -0,0 +1,138 @@
1
+ # Dpl [![Build Status](https://travis-ci.com/travis-ci/dpl.svg?branch=master)](https://travis-ci.com/travis-ci/dpl) [![Code Climate](https://codeclimate.com/github/travis-ci/dpl.svg)](https://codeclimate.com/github/travis-ci/dpl) [![Coverage Status](https://coveralls.io/repos/travis-ci/dpl/badge.svg?branch=master&service=github&cache=2019-08-09_17:00)](https://coveralls.io/github/travis-ci/dpl?branch=master) [![Gem Version](https://img.shields.io/gem/v/dpl)](http://rubygems.org/gems/dpl) [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/travis-ci/dpl)
2
+
3
+ This version of the README documents dpl v2, the next major version of dpl.
4
+ The README for dpl v1, the version that is currently used in production on
5
+ Travis CI can be found [here](https://github.com/travis-ci/dpl/blob/v1/README.md).
6
+
7
+ Dpl is command line tool for deploying code, html, packages, or build artifacts
8
+ to various service providers.
9
+
10
+ It is tightly integrated into Travis CI's [deployment integration](https://docs.travis-ci.com/user/deployment),
11
+ but also used, and recommended by others, such as [GitLab](https://docs.gitlab.com/ee/ci/examples/deployment/).
12
+
13
+ It is maintained by Travis CI, largely community driven, and it has existed
14
+ since 2013. If you find support your preferred deployment target missing,
15
+ please do not hesitate to get in touch, and we'll help you [add it](#contributing-to-dpl).
16
+
17
+ ## Table of Contents
18
+
19
+ * [Requirements](#requirements)
20
+ * [Installation](#installation)
21
+ * [Usage](#usage)
22
+ * [Maturity Levels](#maturity-levels)
23
+ * [Supported Providers](#supported-providers)
24
+ * [Contributing to Dpl](#contributing-to-dpl)
25
+ * [Old Issues](#old-issues)
26
+ * [Code of Conduct](#code-of-conduct)
27
+ * [License](#license)
28
+ * [Credits](#credits)
29
+
30
+ ## Requirements
31
+
32
+ Dpl requires Ruby 2.3 or later.
33
+
34
+ Depending on the deployment target dpl might require additional runtimes (e.g.
35
+ Go, Node.js, or Python) to be installed. It also might require sudo access in
36
+ order to install a Debian package.
37
+
38
+ Dpl is generally optimized for usage on Linux systems.
39
+
40
+ ## Installation
41
+
42
+ This version of dpl is currently released as an `alpha` preview release. In
43
+ order to install it, add the `--pre` flag:
44
+
45
+ ```
46
+ gem install dpl --pre
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ Dpl is meant and optimized for usage in ephemeral build environments, such
52
+ as Travis CI, or any other CI/CD pipeline.
53
+
54
+ Dpl is integrated to Travis CI's build configuration and build script compilation
55
+ tooling, so all you need to do is add the proper configuration to your `.travis.yml`
56
+ file. Please refer to [the documentation](https://docs.travis-ci.com/user/deployment)
57
+ for details.
58
+
59
+ For usage outside of Travis CI dpl can be executed as follows. Please refer to
60
+ the respective [providers](#supported-providers) for details.
61
+
62
+ ```
63
+ dpl [provider] [options]
64
+ ```
65
+
66
+ Dpl can be used locally, e.g. on your development machine, but it might leave
67
+ artifacts that may alter the behaviour of your system. If you encounter this
68
+ behaviour and it presents a serious issue to you then please open an
69
+ [issue](https://github.com/travis-ci/dpl/issues/new).
70
+
71
+ ### Cleaning up the Git working directory
72
+
73
+ Dpl v1 has cleaned up the Git working directory by default, using `git stash
74
+ --all`. The default for this option has been changed in dpl v2, and users now
75
+ need to opt in to cleaning up any left over artifacts from the build process
76
+ by passing the option `--cleanup`.
77
+
78
+ The status of the working directory is relevant only to providers that package
79
+ and push it to the respective remote service (e.g. `heroku` when using the
80
+ `api` strategy, package registry providers, etc.). Most providers will either
81
+ push the latest Git commit, or pull code from a remote repository.
82
+
83
+ ## Maturity Levels
84
+
85
+ In order to communicate the current development status and maturity of dpl's
86
+ support for a particular service the respective provider is marked with one of
87
+ the following maturity levels, according to the given criteria:
88
+
89
+ * `dev` - the provider is in development (initial level)
90
+ * `alpha` - the provider is fully tested
91
+ * `beta` - the provider has been in alpha for at least a month, and successful real-world production deployments have been observed
92
+ * `stable` - the provider has been in beta for at least a month, and there are no open issues that qualify as critical (such as deployments failing, documented functionality broken, etc)
93
+
94
+ ## Supported Providers
95
+
96
+ Dpl supports the following providers:
97
+
98
+ <% providers.each do |key, name| -%>
99
+ * <%= "[#{name}](##{name.split(/\W+/).compact.join('-').downcase})" %>
100
+ <% end -%>
101
+
102
+ <% providers.each do |key, name|%>
103
+ ### <%= name %>
104
+
105
+ <%= header(key) %>
106
+
107
+ ```
108
+ <%= help(key) %>
109
+ ```
110
+
111
+ <%= footer(key) %>
112
+ <% end -%>
113
+
114
+ <%= File.read('./CONTRIBUTING.md').gsub(/^#/, '##') %>
115
+
116
+ ## Old Issues
117
+
118
+ If an issue has been left open and untouched for 90 days or more, we
119
+ automatically close them. We do this to ensure that new issues are more easily
120
+ noticeable, and that old issues that have been resolved or are no longer
121
+ relevant are closed. You can read more about this [here](https://blog.travis-ci.com/2018-03-09-closing-old-issues).
122
+
123
+ ## Code of Conduct
124
+
125
+ Please see [our code of conduct](CODE_OF_CONDUCT.md) for how to interact with
126
+ this project and its community.
127
+
128
+ ## License
129
+
130
+ Dpl is licensed under the [MIT License](https://github.com/travis-ci/dpl/blob/master/LICENSE).
131
+
132
+ ## Credits
133
+
134
+ This tool would not exist without your help.
135
+
136
+ A huge thank you goes out to all of our current and past [contributors](https://github.com/travis-ci/dpl/graphs/contributors):
137
+
138
+ <%= contributors %>
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ exec ssh \
3
+ -o CheckHostIP=no \
4
+ -o IdentitiesOnly=yes \
5
+ -o StrictHostKeychecking=no \
6
+ -o UserKnownHostsFile=/dev/null \
7
+ -i %s \
8
+ $@
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+
3
+ for file in $(git ls-files --cached); do
4
+ if cat $file | head -n 1 | grep 'BEGIN' | grep 'PRIVATE KEY' > /dev/null; then
5
+ echo "Commit rejected: private key detected in $file."
6
+ exit 1
7
+ fi
8
+ done
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ $@ 2>&1 | sed -E 's/\[[^ ]+ //'
3
+ exit ${PIPESTATUS[0]}
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ if [ -z ${VIRTUAL_ENV+x} ]; then export PIP_USER=yes; fi &&
3
+ wget -nv -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel &&
4
+ pip install --upgrade --ignore-installed %{setuptools_arg} %{twine_arg} %{wheel_arg}
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ curl --remote-name --location https://cli-dl.scalingo.io/release/scalingo_latest_linux_amd64.tar.gz && \
3
+ tar -zxvf scalingo_latest_linux_amd64.tar.gz && \
4
+ mv scalingo_*_linux_amd64/scalingo . && \
5
+ rm scalingo_latest_linux_amd64.tar.gz && \
6
+ rm -r scalingo_*_linux_amd64
data/lib/dpl/cli.rb ADDED
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cl'
4
+
5
+ module Dpl
6
+ class Cli < Cl
7
+ def self.new(ctx = nil, name = 'dpl')
8
+ ctx ||= Dpl::Ctx::Bash.new
9
+ super
10
+ end
11
+
12
+ def run(args)
13
+ super
14
+ rescue UnknownCmd => e
15
+ unknown_provider(e)
16
+ rescue UnknownOption => e
17
+ unknown_option(e)
18
+ rescue Cl::Error, Error => e
19
+ error(e)
20
+ end
21
+
22
+ def runner(args)
23
+ super(normalize(args))
24
+ end
25
+
26
+ def normalize(args)
27
+ args = unescape(args)
28
+ args = untaint(args)
29
+ args = with_cmd_opts(args, provider: 0, strategy: 1)
30
+ args = with_strategy_default(args, :strategy) # should be a generic dispatch feature in Cl
31
+ args
32
+ end
33
+
34
+ def unescape(args)
35
+ args.map { |arg| arg.gsub('\\n', "\n") }
36
+ end
37
+
38
+ # Tainting is being used for automatically obfuscating values for secure
39
+ # options, so we want to untaint all incoming args here.
40
+ def untaint(args)
41
+ args.map(&:dup).each(&:whitelist)
42
+ end
43
+
44
+ def with_cmd_opts(args, cmds)
45
+ cmds.inject(args) do |args, (cmd, pos)|
46
+ with_cmd_opt(args, cmd, pos)
47
+ end
48
+ end
49
+
50
+ def with_cmd_opt(args, cmd, pos)
51
+ return args unless opt = args.detect { |arg| arg.start_with?("--#{cmd}") }
52
+
53
+ ix = args.index(opt)
54
+ args.delete(opt)
55
+ value = opt.include?('=') ? opt.split('=').last : args.delete_at(ix)
56
+ args.insert(pos, value)
57
+ args
58
+ end
59
+
60
+ STRATEGIES = {
61
+ 'heroku' => 'api',
62
+ 'pages' => 'git'
63
+ }.freeze
64
+
65
+ def with_strategy_default(args, _cmd)
66
+ return args unless default = STRATEGIES[args.first]
67
+
68
+ args.insert(1, default) if args[1].nil? || args[1].to_s.start_with?('--')
69
+ args
70
+ end
71
+
72
+ def error(err)
73
+ msg = "\e[31m#{err.message}\e[0m"
74
+ msg = [msg, *err.backtrace].join("\n") if backtrace?(err)
75
+ abort msg
76
+ end
77
+
78
+ def backtrace?(err)
79
+ err.respond_to?(:backtrace?) && err.backtrace?
80
+ end
81
+
82
+ def unknown_provider(err)
83
+ msg = "\e[31m#{err.message}\e[0m"
84
+ msg << "\nDid you mean: #{err.suggestions.join(', ')}?" if err.suggestions.any?
85
+ abort msg
86
+ end
87
+
88
+ def unknown_option(err)
89
+ msg = "\e[31m#{err.message}\e[0m"
90
+ msg << "\nDid you mean: #{err.suggestions.join(', ')}?" if err.suggestions.any?
91
+ abort msg
92
+ end
93
+
94
+ def suggestions(name)
95
+ return [] unless defined?(DidYouMean)
96
+
97
+ DidYouMean::SpellChecker.new(dictionary: providers).correct(name)
98
+ end
99
+ end
100
+ end