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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +172 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +392 -0
- data/Gemfile +32 -0
- data/Gemfile.lock +611 -0
- data/LICENSE +19 -0
- data/README.md +2744 -0
- data/Rakefile +210 -0
- data/bin/dpl +11 -0
- data/config/transliterate.yml +733 -0
- data/dpl.gemspec +23 -0
- data/lib/dpl/assets/atlas/install +19 -0
- data/lib/dpl/assets/convox/install +11 -0
- data/lib/dpl/assets/dpl/README.erb.md +138 -0
- data/lib/dpl/assets/dpl/git_ssh +8 -0
- data/lib/dpl/assets/git/detect_private_key +8 -0
- data/lib/dpl/assets/hephy/filter_log +3 -0
- data/lib/dpl/assets/pypi/install +4 -0
- data/lib/dpl/assets/scalingo/install +6 -0
- data/lib/dpl/cli.rb +100 -0
- data/lib/dpl/ctx/bash.rb +549 -0
- data/lib/dpl/ctx/test.rb +255 -0
- data/lib/dpl/ctx.rb +4 -0
- data/lib/dpl/helper/assets.rb +38 -0
- data/lib/dpl/helper/cmd.rb +169 -0
- data/lib/dpl/helper/config_file.rb +49 -0
- data/lib/dpl/helper/cookbook_site_streaming_uploader.rb +249 -0
- data/lib/dpl/helper/env.rb +92 -0
- data/lib/dpl/helper/github.rb +22 -0
- data/lib/dpl/helper/interpolate.rb +160 -0
- data/lib/dpl/helper/memoize.rb +23 -0
- data/lib/dpl/helper/squiggle.rb +24 -0
- data/lib/dpl/helper/transliterate.rb +13 -0
- data/lib/dpl/helper/wrap.rb +11 -0
- data/lib/dpl/helper/zip.rb +71 -0
- data/lib/dpl/provider/dsl.rb +410 -0
- data/lib/dpl/provider/examples.rb +132 -0
- data/lib/dpl/provider/status.rb +61 -0
- data/lib/dpl/provider.rb +651 -0
- data/lib/dpl/providers/anynines.rb +71 -0
- data/lib/dpl/providers/azure_web_apps.rb +63 -0
- data/lib/dpl/providers/bintray.rb +324 -0
- data/lib/dpl/providers/bluemixcloudfoundry.rb +98 -0
- data/lib/dpl/providers/boxfuse.rb +52 -0
- data/lib/dpl/providers/cargo.rb +32 -0
- data/lib/dpl/providers/chef_supermarket.rb +132 -0
- data/lib/dpl/providers/cloud66.rb +46 -0
- data/lib/dpl/providers/cloudfiles.rb +62 -0
- data/lib/dpl/providers/cloudformation.rb +281 -0
- data/lib/dpl/providers/cloudfoundry.rb +89 -0
- data/lib/dpl/providers/codedeploy.rb +190 -0
- data/lib/dpl/providers/convox.rb +130 -0
- data/lib/dpl/providers/datica.rb +64 -0
- data/lib/dpl/providers/ecr.rb +129 -0
- data/lib/dpl/providers/elasticbeanstalk.rb +207 -0
- data/lib/dpl/providers/engineyard.rb +113 -0
- data/lib/dpl/providers/firebase.rb +45 -0
- data/lib/dpl/providers/flynn.rb +35 -0
- data/lib/dpl/providers/gae.rb +78 -0
- data/lib/dpl/providers/gcs.rb +132 -0
- data/lib/dpl/providers/git_push.rb +273 -0
- data/lib/dpl/providers/gleis.rb +74 -0
- data/lib/dpl/providers/hackage.rb +53 -0
- data/lib/dpl/providers/hephy.rb +107 -0
- data/lib/dpl/providers/heroku/api.rb +123 -0
- data/lib/dpl/providers/heroku/git.rb +54 -0
- data/lib/dpl/providers/heroku.rb +111 -0
- data/lib/dpl/providers/lambda.rb +211 -0
- data/lib/dpl/providers/launchpad.rb +80 -0
- data/lib/dpl/providers/netlify.rb +38 -0
- data/lib/dpl/providers/npm.rb +130 -0
- data/lib/dpl/providers/nuget.rb +41 -0
- data/lib/dpl/providers/openshift.rb +52 -0
- data/lib/dpl/providers/opsworks.rb +146 -0
- data/lib/dpl/providers/packagecloud.rb_ +194 -0
- data/lib/dpl/providers/pages/api.rb +106 -0
- data/lib/dpl/providers/pages/git.rb +262 -0
- data/lib/dpl/providers/pages.rb +18 -0
- data/lib/dpl/providers/puppetforge.rb +50 -0
- data/lib/dpl/providers/pypi.rb +125 -0
- data/lib/dpl/providers/releases.rb +234 -0
- data/lib/dpl/providers/rubygems.rb +97 -0
- data/lib/dpl/providers/s3.rb +251 -0
- data/lib/dpl/providers/scalingo.rb +69 -0
- data/lib/dpl/providers/script.rb +32 -0
- data/lib/dpl/providers/snap.rb +68 -0
- data/lib/dpl/providers/surge.rb +59 -0
- data/lib/dpl/providers/testfairy.rb +101 -0
- data/lib/dpl/providers/transifex.rb +72 -0
- data/lib/dpl/providers.rb +48 -0
- data/lib/dpl/string_ext.rb +23 -0
- data/lib/dpl/support/aws_sdk_patch.rb +26 -0
- data/lib/dpl/support/gems.rb +73 -0
- data/lib/dpl/support/gstore_patch.rb +8 -0
- data/lib/dpl/support/version.rb +84 -0
- data/lib/dpl/version.rb +5 -0
- data/lib/dpl.rb +23 -0
- data/status.json +237 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d08df3f0f3f3b81f2f9c520a77de0e0b38758b3a41486615034900319327dce4
|
4
|
+
data.tar.gz: ec81722675eb11831503f8b6bf95dd6ce1d4f75414d91d603c5af5a21e334bc2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 20e5e997be77c6d9b184537e0c06b3c3226df64fc7a639a4cb2e8fdf0a78a8e5ba946e1d88e17f34327426c19f7fbc03a27e5ba871971c626dfb32607e10ac88
|
7
|
+
data.tar.gz: 99a2d508c87c9e3b679f0696ebd123967dda59f2d9b1bf117eed213f60e6eaa851e2be111e2bb3fe77dc5d0912991eb47b1e17b164712c7596446eedc4fba192
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## dpl v2.0.3-beta.1 (2022-03-15)
|
4
|
+
|
5
|
+
* Deprecate support for Ruby 2.2
|
6
|
+
|
7
|
+
## dpl v2.0.2-beta.1 (2020-09-15)
|
8
|
+
|
9
|
+
* Add AWS ECR support
|
10
|
+
|
11
|
+
## dpl v2.0.1-beta.3 (unreleased)
|
12
|
+
|
13
|
+
* Change git_push to use the GitHub token's user name and email as the
|
14
|
+
committer name and email
|
15
|
+
|
16
|
+
## dpl v2.0.1-beta.2 (2020-01-27)
|
17
|
+
|
18
|
+
* Change codedeploy, lambda, and pages to safelist variables available for
|
19
|
+
interpolation on user facing options
|
20
|
+
|
21
|
+
## dpl v2.0.1-beta.1 (2020-01-27)
|
22
|
+
|
23
|
+
* No changes
|
24
|
+
|
25
|
+
## dpl v2.0.0-alpha.13 (2020-01-17)
|
26
|
+
|
27
|
+
* Add s3 `--glob`
|
28
|
+
|
29
|
+
## dpl v2.0.0-alpha.13 (2020-01-06)
|
30
|
+
|
31
|
+
* Bump Cl which now raises on arguments undeclared by the command
|
32
|
+
|
33
|
+
## dpl v2.0.0-alpha.12 (2020-01-06)
|
34
|
+
|
35
|
+
* Add npm `--run_script`, allowing one or many scripts from package.json to be run
|
36
|
+
* Add elasticbeanstalk `--wait_until_deployed_timeout`
|
37
|
+
* Update pages to pass one -m option per commit message line
|
38
|
+
* Fix releases to transliterate filenames in an attempt to mirror GitHub's behavior
|
39
|
+
|
40
|
+
## dpl v2.0.0-alpha.11 (2019-10-14)
|
41
|
+
|
42
|
+
* Fix pages: do not skip if new or only deleted files are present
|
43
|
+
|
44
|
+
## dpl v2.0.0-alpha.6 - v2.0.0-alpha.10 (2019-10-09)
|
45
|
+
|
46
|
+
* Add a Cloudformation provider
|
47
|
+
* Add a Convox provider
|
48
|
+
* Add a Gleis provider
|
49
|
+
* Remove the Atlas provider (service retired)
|
50
|
+
* Rescue `UnknownOption` and suggest known options on Ruby >= 2.4
|
51
|
+
* Allow options to be given as env vars on all providers
|
52
|
+
|
53
|
+
### Cargo
|
54
|
+
|
55
|
+
* Add `--allow_dirty` to allow publishing from a dirty Git working directory
|
56
|
+
|
57
|
+
### Cloudfoundry
|
58
|
+
|
59
|
+
* Default `--api` to `https://api.run.pivotal.io`
|
60
|
+
|
61
|
+
### Elasticbeanstalk
|
62
|
+
|
63
|
+
* Hornor `.gitignore` if `.ebignore` is not present
|
64
|
+
|
65
|
+
### GCS
|
66
|
+
|
67
|
+
* Add `--key_file` to allow using a service account key file
|
68
|
+
|
69
|
+
### NPM
|
70
|
+
|
71
|
+
* Allow publishing to GitHub Package Registry
|
72
|
+
* Add `--dry_run` to allow testing deployments
|
73
|
+
|
74
|
+
### Pages
|
75
|
+
|
76
|
+
* Do not commit or push unless the working dir is dirty on cloned repos
|
77
|
+
|
78
|
+
### Releases
|
79
|
+
|
80
|
+
* Make --file glob files by default, and default to `*`
|
81
|
+
|
82
|
+
## dpl v2.0.0-alpha.2 (2019-08-28)
|
83
|
+
|
84
|
+
* Add `--edge` as an internal flag in case `edge: true` was given in `.travis.yml`
|
85
|
+
|
86
|
+
## dpl v2.0.0-alpha.1 (2019-08-27)
|
87
|
+
|
88
|
+
* Default to not cleaning the git working directory, but accept `--cleanup` in order to clean up the git working directory.
|
89
|
+
* Support a maturity model using dev, alpha, beta, stable.
|
90
|
+
* Use Ruby's `DidYouMean` in order to suggest provider names if the given name is not valid.
|
91
|
+
* Use `~/.dpl` rather than `./.dpl` as a directory to store assets, and remove `~/.dpl` before the process terminates.
|
92
|
+
* Use the AWS SDK v3 for AWS providers.
|
93
|
+
* Fix git-ssh to work with non-standard ssh ports (used by all providers that rely on Git).
|
94
|
+
|
95
|
+
### bintray
|
96
|
+
|
97
|
+
* List files in the downloads list if specified in the descriptor file.
|
98
|
+
|
99
|
+
### chef-supermarket
|
100
|
+
|
101
|
+
* Read the cookbook name a given metadata.json or metadata.rb file if not given as `--name`.
|
102
|
+
* Use `--name` and `--category`, but keep `--cookbook_name` and `--cookbook_category` as deprecated aliases.
|
103
|
+
|
104
|
+
### cloudfoundry
|
105
|
+
|
106
|
+
* Accept `--v3` in order to use the `v3-push` command.
|
107
|
+
|
108
|
+
### codedeploy
|
109
|
+
|
110
|
+
* Accept `--file_exist_behavior` in order to specify how to handle files that already exist in a deployment target location.
|
111
|
+
|
112
|
+
### elasticbeanstalk
|
113
|
+
|
114
|
+
* Accept `--label` and `--description` in order to define these attributes.
|
115
|
+
* Remove non-printable unicode chars from the version description.
|
116
|
+
* Accept `--debug` in order to list files added to the zip archive.
|
117
|
+
* Honor `.ebignore` in order to exclude files from being added to the zip file.
|
118
|
+
|
119
|
+
### engineyard
|
120
|
+
|
121
|
+
* Use `ey-core` as CLI tooling.
|
122
|
+
|
123
|
+
### firebase
|
124
|
+
|
125
|
+
* Accept `--only` in order to restrict the resources to deploy.
|
126
|
+
* Accpet `--force` in order to delete functions missing from the current working directory.
|
127
|
+
* Add `node_modules/.bin` to the `PATH` in case users have `firebase` in that directory.
|
128
|
+
|
129
|
+
### gae
|
130
|
+
|
131
|
+
* Accept multiple values on on `--config`.
|
132
|
+
|
133
|
+
### hackage
|
134
|
+
|
135
|
+
* Accept `--publish` in order to publish a package.
|
136
|
+
|
137
|
+
### lambda
|
138
|
+
|
139
|
+
* Accept `--layers` to deploy function layers.
|
140
|
+
* Do not require a role and handler name when functions are only being updated.
|
141
|
+
* Use the correct handler name separators for dotnet, go, and java runtimes.
|
142
|
+
|
143
|
+
### npm
|
144
|
+
|
145
|
+
* Accept `--registry` in order to specify the target registry.
|
146
|
+
* Accept `--src` in order to specify a directory or tarball to publish.
|
147
|
+
* Accept `auth` as an `--auth_method` in order to force writing the token to `_auth` in `~/.npmrc`.
|
148
|
+
|
149
|
+
### pages
|
150
|
+
|
151
|
+
* Accept a `--deploy_key` as an alternative to the GitHub token (expects a path to a file).
|
152
|
+
* Accept a commit message on `--commit_message`, allow interpolating variables (e.g. as `$TRAVIS_BUILD_NUMBER`).
|
153
|
+
* Check if the target branch already exists and preserves git history by default. `--no-keep_history` can be passed in order to erase history on the target branch.
|
154
|
+
* Include symbolic links.
|
155
|
+
* Add an alternative strategy for deploying via GitHub's pages HTTP API
|
156
|
+
|
157
|
+
### pypi
|
158
|
+
|
159
|
+
* Accept `--no-remove_build_dir` in order to skip removing the build dir (`./dist`).
|
160
|
+
* Run `twine check dist/*` by default, and accept `--no-twine_check` for opting out.
|
161
|
+
|
162
|
+
### releases
|
163
|
+
|
164
|
+
* Accept a path to a file containing release notes on `--release_notes_file`.
|
165
|
+
* Use `--release_notes` for passing the release notes content, keep `--body` as a deprecated alias.
|
166
|
+
|
167
|
+
### s3
|
168
|
+
|
169
|
+
* Accept `--no-overwrite` in order to not overwrite existing files.
|
170
|
+
* Accept `--force_path_style` in order to use the bucket name on the path, rather than the subcomain
|
171
|
+
* Print out dots instead of filenames by default, and accept `--verbose` for printing out all filenames uploaded.
|
172
|
+
* Use `application/octet-stream` as a default content type if a content type cannot be determined.
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, other beliefs, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Being constructive and proportionate when criticizing
|
20
|
+
* Gracefully accepting constructive criticism
|
21
|
+
* Focusing on what is best for the community
|
22
|
+
* Showing empathy towards other community members
|
23
|
+
|
24
|
+
Examples of unacceptable behavior by participants include:
|
25
|
+
|
26
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
27
|
+
advances
|
28
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
29
|
+
* Public or private harassment
|
30
|
+
* Publishing others' private information, such as a physical or electronic
|
31
|
+
address, without explicit permission
|
32
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
33
|
+
professional setting
|
34
|
+
|
35
|
+
## Our Responsibilities
|
36
|
+
|
37
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
38
|
+
behavior and are expected to take appropriate and fair corrective action in
|
39
|
+
response to any instances of unacceptable behavior.
|
40
|
+
|
41
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
42
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
43
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
44
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
45
|
+
threatening, offensive, or harmful.
|
46
|
+
|
47
|
+
## Scope
|
48
|
+
|
49
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
50
|
+
when an individual is representing the project or its community. Examples of
|
51
|
+
representing a project or community include using an official project e-mail
|
52
|
+
address, posting via an official social media account, or acting as an appointed
|
53
|
+
representative at an online or offline event. Representation of a project may be
|
54
|
+
further defined and clarified by project maintainers.
|
55
|
+
|
56
|
+
## Enforcement
|
57
|
+
|
58
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
59
|
+
reported by contacting the project team at the following email address: conduct@travis-ci.org. All
|
60
|
+
complaints will be reviewed and investigated and will result in a response that
|
61
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
62
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
63
|
+
Further details of specific enforcement policies may be posted separately.
|
64
|
+
|
65
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
66
|
+
faith may face temporary or permanent repercussions as determined by other
|
67
|
+
members of the project's leadership.
|
68
|
+
|
69
|
+
## Attribution
|
70
|
+
|
71
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
72
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
73
|
+
|
74
|
+
[homepage]: https://www.contributor-covenant.org
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,392 @@
|
|
1
|
+
# Contributing to Dpl
|
2
|
+
|
3
|
+
## Table of Contents
|
4
|
+
|
5
|
+
* [Resources](#resources)
|
6
|
+
* [Navigating the Codebase](#navigating-the-codebase)
|
7
|
+
* [Lifecycle of the Deployment Process](#lifecycle-of-the-deployment-process)
|
8
|
+
* [Deployment Tooling](#deployment-tooling)
|
9
|
+
* [Runtime Dependencies](#runtime-dependencies)
|
10
|
+
* [Unit Tests](#unit-tests)
|
11
|
+
* [Runtime Dependency Installation Tests](#runtime-dependency-installation-tests)
|
12
|
+
* [Integration Tests](#integration-tests)
|
13
|
+
* [Testing Dpl Branches or Forks on Travis CI](#testing-dpl-branches-or-forks-on-travis-ci)
|
14
|
+
* [Code Conventions](#code-conventions)
|
15
|
+
* [Naming Conventions](#naming-conventions)
|
16
|
+
* [Updating the README](#updating-the-readme)
|
17
|
+
|
18
|
+
Dpl is a central component in Travis CI, and has been around for a long time.
|
19
|
+
|
20
|
+
This library always has been a community effort first. There probably is not a
|
21
|
+
single person in the world who is very familiar with all deployment providers
|
22
|
+
supported by Dpl.
|
23
|
+
|
24
|
+
*Thank you all for this!*
|
25
|
+
|
26
|
+
This document is for you if you are looking to contribute to dpl, be it by
|
27
|
+
adding a new deployment provider, fixing a bug, or adding a new feature.
|
28
|
+
|
29
|
+
Dpl has a [code of conduct](CODE_OF_CONDUCT.md), please follow it in all
|
30
|
+
interactions with the project.
|
31
|
+
|
32
|
+
Dpl is written in Ruby, and we assume that you familiarize yourself with our
|
33
|
+
documentation as much as needed.
|
34
|
+
|
35
|
+
## Resources
|
36
|
+
|
37
|
+
Hopefully helpful resources are:
|
38
|
+
|
39
|
+
* This [document](CONTRIBUTING.md)
|
40
|
+
* The [dpl README](README.md)
|
41
|
+
* The [dpl API docs](https://www.rubydoc.info/github/travis-ci/dpl) on rubydocs.info
|
42
|
+
* The [cl README](https://github.com/svenfuchs/cl/blob/master/README.md)
|
43
|
+
|
44
|
+
## Navigating the Codebase
|
45
|
+
|
46
|
+
All provider specific classes live in [dpl/providers](lib/dpl/providers).
|
47
|
+
These represent the CLI commands that are executed when the command line
|
48
|
+
executable `dpl` is run with a given provider name as the first argument.
|
49
|
+
|
50
|
+
Each provider is a subclass of `Dpl::Provider`, which is defined in
|
51
|
+
[dpl/provider.rb](lib/dpl/provider.rb). The provider base class itself
|
52
|
+
subclasses from `Cl::Cmd`, so it represents an executable sub command of the
|
53
|
+
main command `dpl`.
|
54
|
+
|
55
|
+
For instance, the command `dpl s3 --bucket bucket` instantiates and runs the
|
56
|
+
provider class [S3](lib/dpl/providers/s3.rb).
|
57
|
+
|
58
|
+
The class `Cl::Cmd` contributes the command line options parser, and its
|
59
|
+
class level DSL. Please see the [cl README](https://github.com/svenfuchs/cl/blob/master/README.md)
|
60
|
+
for this DSL, and the [S3 provider](/lib/dpl/provider/s3.rb)
|
61
|
+
for an example how dpl uses it.
|
62
|
+
|
63
|
+
The class `Dpl::Provider` adds, amongst other things, the order of stages
|
64
|
+
(methods) that make up the deployment process:
|
65
|
+
|
66
|
+
* `init`
|
67
|
+
* `install`
|
68
|
+
* `login`
|
69
|
+
* `setup`
|
70
|
+
* `validate`
|
71
|
+
* `prepare`
|
72
|
+
* `deploy`
|
73
|
+
* `finish`
|
74
|
+
|
75
|
+
Implementors of concrete provider classes may or may not choose to implement
|
76
|
+
any of these instance methods according to their needs, and semantics of their
|
77
|
+
tooling and service providers. Please refer to [Dpl::Provider](/lib/dpl/provider.rb)
|
78
|
+
for details.
|
79
|
+
|
80
|
+
The DSL that is used to declare features, dependencies, environment integration
|
81
|
+
etc. on the concrete provider classes is defined in the module
|
82
|
+
`Dpl::Provider::DSL`, in [dpl/provider/dsl](/lib/dpl/provider/dsl.rb).
|
83
|
+
|
84
|
+
Also of interest is [Dpl::Ctx::Bash](/lib/dpl/ctx/bash.rb),
|
85
|
+
the Bash execution context, that runs shell commands, installs dependencies
|
86
|
+
etc. (while the `Test` context class is used for testing in order to keep your
|
87
|
+
development machine clean and safe when you run tests locally).
|
88
|
+
|
89
|
+
```
|
90
|
+
lib
|
91
|
+
└── dpl
|
92
|
+
├── assets # Stores larger shell scripts
|
93
|
+
├── ctx
|
94
|
+
│ ├── bash.rb # Bash execution context
|
95
|
+
│ └── test.rb # Test execution context
|
96
|
+
├── provider.rb # Base class for all providers
|
97
|
+
├── provider
|
98
|
+
│ ├── dsl.rb # DSL for defining providers
|
99
|
+
│ └── example.rb # Generating example commands for help output
|
100
|
+
└── providers
|
101
|
+
├── anynines.rb # Concrete providers
|
102
|
+
├── atlas.rb
|
103
|
+
├── azure_webapps.rb
|
104
|
+
├── bintray.rb
|
105
|
+
├── bitballoon.rb
|
106
|
+
└── ⋮
|
107
|
+
```
|
108
|
+
|
109
|
+
## Lifecycle of the Deployment Process
|
110
|
+
|
111
|
+
When a provider class is instantiated and run it will go through a number
|
112
|
+
of stages that make up the deployment process.
|
113
|
+
|
114
|
+
These are documented in [dpl/provider.rb](/lib/dpl/provider.rb).
|
115
|
+
If you are adding a new deployment provider please familiarize yourself with
|
116
|
+
this lifecycle.
|
117
|
+
|
118
|
+
Feel free to pick and interpret these stages according to the needs and
|
119
|
+
semantics of the service provider you are adding. By no means do all of these
|
120
|
+
stages have to be filled in or implmented. The `Provider` base class checks for
|
121
|
+
these methods, and runs them, if present, so that implementors can choose
|
122
|
+
semantically fitting names for their providers.
|
123
|
+
|
124
|
+
## Deployment Tooling
|
125
|
+
|
126
|
+
If you are adding a new deployment provider please choose the tooling you are
|
127
|
+
going to use carefully.
|
128
|
+
|
129
|
+
Dpl is a long lived library, and it has outlived many tools that once were
|
130
|
+
supported, and no longer are. Thus tooling stability is a major concern for
|
131
|
+
this project.
|
132
|
+
|
133
|
+
Ideally use official CLI tooling supported by the company who's service
|
134
|
+
provider you are about to add. Often, such CLI tools can be installed via
|
135
|
+
standard package managers, or manually downloaded using `curl` and installed
|
136
|
+
with a few simple Bash commands.
|
137
|
+
|
138
|
+
Such CLI tooling is preferrable over Ruby gem runtime dependencies as they can
|
139
|
+
be executed in a child process, and won't introduce any dependency resolution
|
140
|
+
problems later on.
|
141
|
+
|
142
|
+
If no such CLI is available, or it does not look well supported, and your
|
143
|
+
provider implementation needs to talk to an external HTTP API then please consider
|
144
|
+
using [Net::HTTP](https://ruby-doc.org/stdlib-2.6.3/libdoc/net/http/rdoc/Net/HTTP.html)
|
145
|
+
from Ruby's standard library.
|
146
|
+
|
147
|
+
If you absolutely have to rely on a runtime Ruby gem dependency, such as a
|
148
|
+
provider client implementation, please only do so if the gem is supported by
|
149
|
+
the respective company officially. We may choose to reject including runtime
|
150
|
+
dependencies that do not look stable or widely supported.
|
151
|
+
|
152
|
+
## Runtime Dependencies
|
153
|
+
|
154
|
+
Runtime dependencies can be declared on the provider class using the
|
155
|
+
[DSL](lib/dpl/provider/dsl.rb).
|
156
|
+
|
157
|
+
In the case of APT, NPM, and Pip dependencies these will be installed via
|
158
|
+
shell commands at the beginning of the deployment process.
|
159
|
+
|
160
|
+
Ruby gem dependencies will be installed using Bundler's [inline API](https://github.com/bundler/bundler/blob/master/lib/bundler/inline.rb),
|
161
|
+
at the beginning of the deployment process, so they are available in the same
|
162
|
+
Ruby process from then on.
|
163
|
+
|
164
|
+
## Unit Tests
|
165
|
+
|
166
|
+
`Dpl` uses [RSpec](https://github.com/rspec) for tests. The specs reside in
|
167
|
+
`spec`, and each provider class has a corresponding file
|
168
|
+
`spec/dpl/providers/*_spec.rb` to hold tests.
|
169
|
+
|
170
|
+
Provider tests should be implemented on an input/output acceptance level, as
|
171
|
+
much as possible.
|
172
|
+
|
173
|
+
They use a [Ctx::Test](blob/masterlib/dpl/ctx/test.rb) execution context in
|
174
|
+
order to avoid running actual shell commands, or actually installing
|
175
|
+
dependencies at test time. There are custom [RSpec matchers](spec/support/matchers)
|
176
|
+
in place that help with making assertions against this execution context.
|
177
|
+
|
178
|
+
If your provider has to talk to an external HTTP API then ideally use
|
179
|
+
[Webmock](https://github.com/bblimke/webmock) to stub external requests. If by
|
180
|
+
any means possible try to avoid mocking or stubbing Ruby client classes (this
|
181
|
+
is not always possible, but should be considered).
|
182
|
+
|
183
|
+
### Running Unit Tests Locally
|
184
|
+
|
185
|
+
You can run the unit test suite locally as follows:
|
186
|
+
|
187
|
+
```
|
188
|
+
bundle install
|
189
|
+
bundle exec rspec
|
190
|
+
```
|
191
|
+
|
192
|
+
In order to execute tests only for a certain provider you can run:
|
193
|
+
|
194
|
+
```
|
195
|
+
bundle exec rspec spec/dpl/providers/[provider]_spec.rb
|
196
|
+
```
|
197
|
+
|
198
|
+
In order to execute a single test or group of tests add a line number like so:
|
199
|
+
|
200
|
+
```
|
201
|
+
bundle exec rspec spec/dpl/providers/[provider]_spec.rb:25
|
202
|
+
```
|
203
|
+
|
204
|
+
These tests can be run safely on any development machine, anywhere.
|
205
|
+
|
206
|
+
## Runtime Dependency Installation Tests
|
207
|
+
|
208
|
+
We additionally run tests that exercise runtime dependency installation on
|
209
|
+
Travis CI.
|
210
|
+
|
211
|
+
These live in [.travis/test_install](.travis/test_install). It is not
|
212
|
+
advisable to run these tests outside of an ephemeral VM or container that can
|
213
|
+
be safely discarded, as they are going to leave various artifacts around.
|
214
|
+
|
215
|
+
## Integration Tests
|
216
|
+
|
217
|
+
In order to ensure proper integration with the service providers supported
|
218
|
+
we also periodically run a test suite that exercises actual deployments to
|
219
|
+
these providers.
|
220
|
+
|
221
|
+
These tests live in [.travis/providers](/.travis/providers), and the are
|
222
|
+
triggered using the script [trigger](/.travis/trigger).
|
223
|
+
|
224
|
+
An integration test consists of:
|
225
|
+
|
226
|
+
* A setup script that creates an application (or artifact) to deploy (or
|
227
|
+
upload).
|
228
|
+
* A YAML config snippet that configures and triggers the deployment as part of
|
229
|
+
a build on Travis CI.
|
230
|
+
* A test script that tests if the deployment was successful.
|
231
|
+
|
232
|
+
For example:
|
233
|
+
|
234
|
+
* [github-pages/prepare](/.travis/providers/github-pages/prepare)
|
235
|
+
creates a minimal Git repository that serves an `index.html` on GitHub Pages in a temporary directory.
|
236
|
+
* [github-pages/travis.yml](/.travis/providers/github-pages/travis.yml)
|
237
|
+
configures the build to use Dpl 2.0 to deploy this repository to GitHub Pages.
|
238
|
+
* [github-pages/test](/.travis/providers/github-pages/test)
|
239
|
+
tests if the deployment was successful.
|
240
|
+
|
241
|
+
The tests can be run on Travis CI individually, or combined, by triggering a
|
242
|
+
build via our API, using the script [.travis/trigger](/.travis/trigger).
|
243
|
+
This takes a provider name as an argument, and requires a Travis CI API token.
|
244
|
+
|
245
|
+
For example, this triggers a build that executes the GitHub Pages test on
|
246
|
+
Travis CI:
|
247
|
+
|
248
|
+
```
|
249
|
+
.travis/trigger github-pages --token [token]
|
250
|
+
```
|
251
|
+
|
252
|
+
The token can also be set as an environment variable:
|
253
|
+
|
254
|
+
```
|
255
|
+
export TRAVIS_API_TOKEN=[token]
|
256
|
+
.travis/trigger github-pages
|
257
|
+
```
|
258
|
+
|
259
|
+
The `trigger` script accepts multiple provider names as arguments. If no
|
260
|
+
arguments are given then tests for all providers will be run.
|
261
|
+
|
262
|
+
### Integration Test Configuration
|
263
|
+
|
264
|
+
In the build config YAML snippet make sure to use the branch of your fork for the
|
265
|
+
deployment tooling, and allow the deployment to run on your branch:
|
266
|
+
|
267
|
+
```yaml
|
268
|
+
deploy:
|
269
|
+
- provider: [name]
|
270
|
+
edge:
|
271
|
+
source: [your-login]/dpl
|
272
|
+
branch: [your-branch]
|
273
|
+
on:
|
274
|
+
branch: [your-branch]
|
275
|
+
```
|
276
|
+
|
277
|
+
Ideally use credentials for an isolated account on the service you are deploying to.
|
278
|
+
This is generally good practice, and way you can hand things off to someone else.
|
279
|
+
|
280
|
+
In order to get things working encrypt the credentials against your fork, and
|
281
|
+
add them to the build config YAML snippet. If you are in the root directory
|
282
|
+
of your fork then this command should do the trick:
|
283
|
+
|
284
|
+
```
|
285
|
+
travis encrypt password=[password]
|
286
|
+
```
|
287
|
+
|
288
|
+
If you do not have the `travis` CLI installed you can install it using:
|
289
|
+
|
290
|
+
```
|
291
|
+
gem install travis
|
292
|
+
```
|
293
|
+
|
294
|
+
When you add encrypted credentials to the build config YAML snippet also add a comment
|
295
|
+
that allows others to identify the account used. E.g:
|
296
|
+
|
297
|
+
```yaml
|
298
|
+
deploy:
|
299
|
+
- provider: pages
|
300
|
+
github_token:
|
301
|
+
# personal access token with repo scope on the account [name]
|
302
|
+
secure: "[encrypted token]"
|
303
|
+
```
|
304
|
+
|
305
|
+
Open a pull request. In order for us to merge your test, and get it working on
|
306
|
+
our repository you will need to re-encrypt the credentials against
|
307
|
+
`travis-ci/dpl`, like so:
|
308
|
+
|
309
|
+
```
|
310
|
+
travis encrypt -r travis-ci/dpl password=[password]
|
311
|
+
```
|
312
|
+
|
313
|
+
Whatever minimal deployment you can get working is be a great contribution.
|
314
|
+
Even if for some reason it proves hard to test the deployment in an automated
|
315
|
+
fashion, but you have a successful deployment that can be verified manually,
|
316
|
+
please still open a pull request, and talk to us. Any test is better than no
|
317
|
+
test.
|
318
|
+
|
319
|
+
## Testing Dpl Branches or Forks on Travis CI
|
320
|
+
|
321
|
+
It is possible to test a new deployment provider or new functionality of dpl on
|
322
|
+
Travis CI. In order to do so, add proper configuration on the `edge` key to
|
323
|
+
your `.travis.yml` like so:
|
324
|
+
|
325
|
+
```yaml
|
326
|
+
deploy:
|
327
|
+
provider: [name]
|
328
|
+
edge:
|
329
|
+
source: [github-handle]/dpl
|
330
|
+
branch: [branch]
|
331
|
+
on:
|
332
|
+
branch: TEST_BRANCH # or all_branches: true
|
333
|
+
⋮ # rest of your provider's configuration
|
334
|
+
```
|
335
|
+
|
336
|
+
This builds the `dpl` gem on the Travis CI build environment from your
|
337
|
+
repository, on the given branch. Then it installs the gem built from this code
|
338
|
+
base, and uses it to run your deployment.
|
339
|
+
|
340
|
+
When submitting a pull request, please be sure to run at least one deployment
|
341
|
+
with the new configuration, and provide a link to the build in your pull
|
342
|
+
request.
|
343
|
+
|
344
|
+
## Code Conventions
|
345
|
+
|
346
|
+
Dpl does not follow any strict code styleguide.
|
347
|
+
|
348
|
+
Please take a look around other providers, and try to follow a similar code
|
349
|
+
style to what you find.
|
350
|
+
|
351
|
+
Try to use the [DSL](/lib/dpl/provider/dsl.rb) as much
|
352
|
+
as possible. It keeps the code declarative and readable, so that people not
|
353
|
+
familiar with Ruby or programming in general can still follow it, and make
|
354
|
+
sense of it.
|
355
|
+
|
356
|
+
If you find yourself trying to achieve something that should be, but is not
|
357
|
+
supported by the DSL please [open an issue](https://github.com/travis-ci/dpl/issues/new)
|
358
|
+
about it.
|
359
|
+
|
360
|
+
If you are rather unfamiliar with Ruby, and have trouble following our code
|
361
|
+
style then please submit your pull request anyway, or get in touch, so we can
|
362
|
+
help.
|
363
|
+
|
364
|
+
## Naming Conventions
|
365
|
+
|
366
|
+
Dpl uses constant names following Ruby naming conventions. I.e. constant
|
367
|
+
names use `CamelCase`, and they live in files named in `snake_case.rb`.
|
368
|
+
|
369
|
+
If you pick such names for a new provider please try to follow these
|
370
|
+
conventions.
|
371
|
+
|
372
|
+
Real world service provider or company names do not always translate to such
|
373
|
+
conventional Ruby names one-to-one. That is ok, they don't have to. These Ruby
|
374
|
+
constant names are representations of real world service and company names in
|
375
|
+
Ruby code.
|
376
|
+
|
377
|
+
Other Ruby libraries often (not always) follow a similar thinking. E.g.
|
378
|
+
even though Amazon Web Services brand name is `AWS` the module name
|
379
|
+
they chose in their [aws-sdk](https://github.com/aws/aws-sdk-ruby) is
|
380
|
+
`Aws`, not `AWS`.
|
381
|
+
|
382
|
+
## Updating the README
|
383
|
+
|
384
|
+
The [README](/README.md) is generated from a
|
385
|
+
[template](/lib/dpl/assets/dpl/README.erb.md).
|
386
|
+
|
387
|
+
In order to update the README please edit the template, and run:
|
388
|
+
|
389
|
+
```
|
390
|
+
gem install ffi-icu
|
391
|
+
bin/readme > README.md
|
392
|
+
```
|
data/Gemfile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH << 'lib'
|
4
|
+
require 'dpl/support/gems'
|
5
|
+
|
6
|
+
source 'https://rubygems.org'
|
7
|
+
ruby '>= 3'
|
8
|
+
|
9
|
+
gemspec name: 'travis_dpl_test'
|
10
|
+
gem 'cl', git: 'https://github.com/zgid123/cl'
|
11
|
+
gem 'packagecloud-ruby', git: 'https://github.com/flywirecorp/packagecloud-ruby'
|
12
|
+
# gem 'json_pure', '~> 2.6'
|
13
|
+
|
14
|
+
# gem 'regstry', path: '../../registry'
|
15
|
+
|
16
|
+
gems = Dpl::Support::Gems.new('lib/dpl/providers/**/*.rb')
|
17
|
+
gems.each do |name, version, opts|
|
18
|
+
gem name, version, opts
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test do
|
22
|
+
gem 'coveralls'
|
23
|
+
gem 'rspec'
|
24
|
+
gem 'webmock'
|
25
|
+
end
|
26
|
+
|
27
|
+
group :development, :test do
|
28
|
+
gem 'rubocop'
|
29
|
+
gem 'rubocop-performance'
|
30
|
+
gem 'rubocop-rspec'
|
31
|
+
gem 'simplecov-console'
|
32
|
+
end
|