pipedream 0.1.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.cody/buildspec.yml +9 -0
- data/.cody/project.rb +4 -0
- data/.gitignore +16 -11
- data/.gitmodules +9 -0
- data/.rspec +1 -1
- data/CHANGELOG.md +34 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +112 -0
- data/Guardfile +19 -0
- data/LICENSE.txt +18 -17
- data/README.md +55 -21
- data/Rakefile +10 -2
- data/exe/pipe +14 -0
- data/exe/pipedream +14 -0
- data/lib/pipedream/autoloader.rb +21 -0
- data/lib/pipedream/aws_services/helpers.rb +71 -0
- data/lib/pipedream/aws_services.rb +20 -0
- data/lib/pipedream/build.rb +13 -0
- data/lib/pipedream/cli.rb +60 -0
- data/lib/pipedream/command.rb +82 -0
- data/lib/pipedream/completer/script.rb +6 -0
- data/lib/pipedream/completer/script.sh +10 -0
- data/lib/pipedream/completer.rb +159 -0
- data/lib/pipedream/core.rb +63 -0
- data/lib/pipedream/create.rb +12 -0
- data/lib/pipedream/delete.rb +27 -0
- data/lib/pipedream/deploy.rb +40 -0
- data/lib/pipedream/dsl/pipeline/approve.rb +34 -0
- data/lib/pipedream/dsl/pipeline/codebuild.rb +57 -0
- data/lib/pipedream/dsl/pipeline/github.rb +42 -0
- data/lib/pipedream/dsl/pipeline.rb +37 -0
- data/lib/pipedream/dsl/role.rb +50 -0
- data/lib/pipedream/dsl/schedule.rb +30 -0
- data/lib/pipedream/dsl/sns.rb +15 -0
- data/lib/pipedream/dsl/ssm.rb +22 -0
- data/lib/pipedream/dsl/webhook.rb +27 -0
- data/lib/pipedream/evaluate.rb +47 -0
- data/lib/pipedream/help/completion.md +22 -0
- data/lib/pipedream/help/completion_script.md +3 -0
- data/lib/pipedream/help/deploy.md +54 -0
- data/lib/pipedream/help/start.md +20 -0
- data/lib/pipedream/help.rb +9 -0
- data/lib/pipedream/init.rb +68 -0
- data/lib/pipedream/pipeline/s3_bucket.rb +88 -0
- data/lib/pipedream/pipeline.rb +61 -0
- data/lib/pipedream/role.rb +181 -0
- data/lib/pipedream/schedule.rb +99 -0
- data/lib/pipedream/sequence.rb +66 -0
- data/lib/pipedream/setting.rb +82 -0
- data/lib/pipedream/sns.rb +43 -0
- data/lib/pipedream/stack.rb +95 -0
- data/lib/pipedream/start.rb +84 -0
- data/lib/pipedream/update.rb +12 -0
- data/lib/pipedream/version.rb +1 -1
- data/lib/pipedream/webhook.rb +60 -0
- data/lib/pipedream.rb +18 -1
- data/lib/template/.pipedream/pipeline.rb.tt +40 -0
- data/lib/template/.pipedream/schedule.rb +3 -0
- data/lib/template/.pipedream/settings.yml +9 -0
- data/lib/template/.pipedream/sns.rb +14 -0
- data/pipedream.gemspec +25 -14
- data/vendor/aws_data/CHANGELOG.md +7 -0
- data/vendor/aws_data/Gemfile +4 -0
- data/vendor/aws_data/Gemfile.lock +48 -0
- data/vendor/aws_data/LICENSE.txt +21 -0
- data/vendor/aws_data/README.md +42 -0
- data/vendor/aws_data/Rakefile +6 -0
- data/vendor/aws_data/aws_data.gemspec +30 -0
- data/{bin → vendor/aws_data/bin}/console +1 -1
- data/{bin → vendor/aws_data/bin}/setup +0 -0
- data/vendor/aws_data/lib/aws_data/version.rb +3 -0
- data/vendor/aws_data/lib/aws_data.rb +91 -0
- data/vendor/aws_data/spec/aws_data_spec.rb +5 -0
- data/vendor/aws_data/spec/spec_helper.rb +14 -0
- data/vendor/cfn-status/Gemfile +4 -0
- data/vendor/cfn-status/Gemfile.lock +49 -0
- data/vendor/cfn-status/LICENSE.txt +21 -0
- data/vendor/cfn-status/README.md +56 -0
- data/vendor/cfn-status/Rakefile +6 -0
- data/vendor/cfn-status/bin/console +14 -0
- data/vendor/cfn-status/bin/setup +8 -0
- data/vendor/cfn-status/cfn-status.gemspec +30 -0
- data/vendor/cfn-status/lib/cfn/aws_service.rb +56 -0
- data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
- data/vendor/cfn-status/lib/cfn/status.rb +220 -0
- data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/vendor/cfn-status/spec/spec_helper.rb +14 -0
- data/vendor/cfn_camelizer/CHANGELOG.md +10 -0
- data/vendor/cfn_camelizer/Gemfile +4 -0
- data/vendor/cfn_camelizer/LICENSE.txt +21 -0
- data/vendor/cfn_camelizer/README.md +40 -0
- data/vendor/cfn_camelizer/Rakefile +6 -0
- data/vendor/cfn_camelizer/bin/console +14 -0
- data/vendor/cfn_camelizer/bin/setup +8 -0
- data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
- data/vendor/cfn_camelizer/lib/camelizer.yml +27 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +92 -0
- data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +79 -0
- data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
- metadata +295 -23
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5b217e3b797c3eac2f721a6637b1997e218222a6d316417c620e05145c1bfe6
|
4
|
+
data.tar.gz: '094476da993744df62614378996cc12481c911f6e39dc8a89a1baeee4030475d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55404fd9abf77988a759c6b8d51a0b9dd64299ec12a03cda6836900b7cba5c11937fcd359bbeb14dd335b7fe4b30b77dfed9cd471669f5c7d376eb8e1f4055c5
|
7
|
+
data.tar.gz: f40b5c333e86b9b662f7863ef803dddd6737c7896931930305ebe638eff0643666737ff4f0001acf3d69f481cd0ac949be6df05f312dc884a621066d1057c653
|
data/.cody/buildspec.yml
ADDED
data/.cody/project.rb
ADDED
data/.gitignore
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
/
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
_yardoc
|
7
|
+
coverage
|
8
|
+
doc/
|
9
|
+
InstalledFiles
|
10
|
+
lib/bundler/man
|
11
|
+
pkg
|
12
|
+
rdoc
|
13
|
+
spec/reports
|
14
|
+
test/tmp
|
15
|
+
test/version_tmp
|
16
|
+
tmp
|
data/.gitmodules
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
[submodule "vendor/cfn-status"]
|
2
|
+
path = vendor/cfn-status
|
3
|
+
url = https://github.com/tongueroo/cfn-status
|
4
|
+
[submodule "vendor/cfn_camelizer"]
|
5
|
+
path = vendor/cfn_camelizer
|
6
|
+
url = https://github.com/tongueroo/cfn_camelizer
|
7
|
+
[submodule "vendor/aws_data"]
|
8
|
+
path = vendor/aws_data
|
9
|
+
url = https://github.com/tongueroo/aws_data
|
data/.rspec
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
|
+
|
6
|
+
## [0.4.0]
|
7
|
+
- rename to pipedream
|
8
|
+
|
9
|
+
## [0.3.3]
|
10
|
+
- allow no settings.yml file
|
11
|
+
|
12
|
+
## [0.3.2]
|
13
|
+
- update vendor/aws_data
|
14
|
+
|
15
|
+
## [0.3.1]
|
16
|
+
- fix gem dependencies in vendor
|
17
|
+
|
18
|
+
## [0.3.0]
|
19
|
+
- update docs and cli help
|
20
|
+
|
21
|
+
## [0.2.1]
|
22
|
+
- fix different branch check
|
23
|
+
|
24
|
+
## [0.2.0]
|
25
|
+
- DSL: pipeline, role, schedule, webhook, sns
|
26
|
+
- pipe deploy -b branch
|
27
|
+
- pipe start -b branch
|
28
|
+
- pipe cli commands: init deploy, start, delete
|
29
|
+
- ssm support
|
30
|
+
- codebuild\_prefix and codebuild\_suffix support
|
31
|
+
- auto-create s3 bucket for artifacts
|
32
|
+
|
33
|
+
## [0.1.0]
|
34
|
+
- Initial release.
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pipedream (0.3.3)
|
5
|
+
activesupport
|
6
|
+
aws-sdk-cloudformation
|
7
|
+
aws-sdk-codepipeline
|
8
|
+
aws-sdk-s3
|
9
|
+
aws-sdk-ssm
|
10
|
+
cfn_camelizer
|
11
|
+
memoist
|
12
|
+
rainbow
|
13
|
+
render_me_pretty
|
14
|
+
thor
|
15
|
+
zeitwerk
|
16
|
+
|
17
|
+
GEM
|
18
|
+
remote: https://rubygems.org/
|
19
|
+
specs:
|
20
|
+
activesupport (6.0.0)
|
21
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
|
+
i18n (>= 0.7, < 2)
|
23
|
+
minitest (~> 5.1)
|
24
|
+
tzinfo (~> 1.1)
|
25
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
26
|
+
aws-eventstream (1.0.3)
|
27
|
+
aws-partitions (1.220.0)
|
28
|
+
aws-sdk-cloudformation (1.25.0)
|
29
|
+
aws-sdk-core (~> 3, >= 3.61.1)
|
30
|
+
aws-sigv4 (~> 1.1)
|
31
|
+
aws-sdk-codepipeline (1.25.0)
|
32
|
+
aws-sdk-core (~> 3, >= 3.61.1)
|
33
|
+
aws-sigv4 (~> 1.1)
|
34
|
+
aws-sdk-core (3.68.0)
|
35
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
36
|
+
aws-partitions (~> 1.0)
|
37
|
+
aws-sigv4 (~> 1.1)
|
38
|
+
jmespath (~> 1.0)
|
39
|
+
aws-sdk-kms (1.24.0)
|
40
|
+
aws-sdk-core (~> 3, >= 3.61.1)
|
41
|
+
aws-sigv4 (~> 1.1)
|
42
|
+
aws-sdk-s3 (1.48.0)
|
43
|
+
aws-sdk-core (~> 3, >= 3.61.1)
|
44
|
+
aws-sdk-kms (~> 1)
|
45
|
+
aws-sigv4 (~> 1.1)
|
46
|
+
aws-sdk-ssm (1.56.0)
|
47
|
+
aws-sdk-core (~> 3, >= 3.61.1)
|
48
|
+
aws-sigv4 (~> 1.1)
|
49
|
+
aws-sigv4 (1.1.0)
|
50
|
+
aws-eventstream (~> 1.0, >= 1.0.2)
|
51
|
+
byebug (11.0.1)
|
52
|
+
cfn_camelizer (0.4.0)
|
53
|
+
activesupport
|
54
|
+
memoist
|
55
|
+
rainbow
|
56
|
+
cli_markdown (0.1.0)
|
57
|
+
codeclimate-test-reporter (1.0.9)
|
58
|
+
simplecov (<= 0.13)
|
59
|
+
concurrent-ruby (1.1.5)
|
60
|
+
diff-lcs (1.3)
|
61
|
+
docile (1.1.5)
|
62
|
+
i18n (1.6.0)
|
63
|
+
concurrent-ruby (~> 1.0)
|
64
|
+
jmespath (1.4.0)
|
65
|
+
json (2.2.0)
|
66
|
+
memoist (0.16.0)
|
67
|
+
minitest (5.12.2)
|
68
|
+
rainbow (3.0.0)
|
69
|
+
rake (13.0.0)
|
70
|
+
render_me_pretty (0.8.3)
|
71
|
+
activesupport
|
72
|
+
rainbow
|
73
|
+
tilt
|
74
|
+
rspec (3.8.0)
|
75
|
+
rspec-core (~> 3.8.0)
|
76
|
+
rspec-expectations (~> 3.8.0)
|
77
|
+
rspec-mocks (~> 3.8.0)
|
78
|
+
rspec-core (3.8.2)
|
79
|
+
rspec-support (~> 3.8.0)
|
80
|
+
rspec-expectations (3.8.4)
|
81
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
+
rspec-support (~> 3.8.0)
|
83
|
+
rspec-mocks (3.8.1)
|
84
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
+
rspec-support (~> 3.8.0)
|
86
|
+
rspec-support (3.8.2)
|
87
|
+
simplecov (0.13.0)
|
88
|
+
docile (~> 1.1.0)
|
89
|
+
json (>= 1.8, < 3)
|
90
|
+
simplecov-html (~> 0.10.0)
|
91
|
+
simplecov-html (0.10.2)
|
92
|
+
thor (0.20.3)
|
93
|
+
thread_safe (0.3.6)
|
94
|
+
tilt (2.0.10)
|
95
|
+
tzinfo (1.2.5)
|
96
|
+
thread_safe (~> 0.1)
|
97
|
+
zeitwerk (2.1.10)
|
98
|
+
|
99
|
+
PLATFORMS
|
100
|
+
ruby
|
101
|
+
|
102
|
+
DEPENDENCIES
|
103
|
+
bundler
|
104
|
+
byebug
|
105
|
+
cli_markdown
|
106
|
+
codeclimate-test-reporter
|
107
|
+
pipedream!
|
108
|
+
rake
|
109
|
+
rspec
|
110
|
+
|
111
|
+
BUNDLED WITH
|
112
|
+
2.0.2
|
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
guard "bundler", cmd: "bundle" do
|
2
|
+
watch("Gemfile")
|
3
|
+
watch(/^.+\.gemspec/)
|
4
|
+
end
|
5
|
+
|
6
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
7
|
+
require "guard/rspec/dsl"
|
8
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
9
|
+
|
10
|
+
# RSpec files
|
11
|
+
rspec = dsl.rspec
|
12
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
13
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
14
|
+
watch(rspec.spec_files)
|
15
|
+
|
16
|
+
# Ruby files
|
17
|
+
ruby = dsl.ruby
|
18
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
19
|
+
end
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
1
|
Copyright (c) 2019 Tung Nguyen
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
11
12
|
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
all copies or substantial portions of the Software.
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
14
15
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
THE SOFTWARE.
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,39 +1,73 @@
|
|
1
|
-
#
|
1
|
+
# Pipedreamline
|
2
2
|
|
3
|
-
|
3
|
+

|
4
|
+
[](http://badge.fury.io/rb/pipedream)
|
4
5
|
|
5
|
-
|
6
|
+
Pipe Dream provides a DSL to make it easy create a CodePipeline pipeline.
|
6
7
|
|
7
|
-
|
8
|
+
Pipe Dream installs `pipedream` and `pipe` executables. Both of them do the same thing, `pipe` is just shorter to type.
|
8
9
|
|
9
|
-
|
10
|
+
The documentation site is at: [pipedream.run](https://pipedream.run/)
|
10
11
|
|
11
|
-
|
12
|
-
gem 'pipedream'
|
13
|
-
```
|
12
|
+
## Quick Start
|
14
13
|
|
15
|
-
|
14
|
+
pipe init
|
15
|
+
pipe deploy
|
16
|
+
pipe start
|
17
|
+
pipe delete
|
16
18
|
|
17
|
-
|
19
|
+
## Init and Structure
|
18
20
|
|
19
|
-
|
21
|
+
First, run `pipe init` to generate a starter `.pipedream` folder structure.
|
20
22
|
|
21
|
-
$
|
23
|
+
$ tree .pipedream
|
24
|
+
.pipedream
|
25
|
+
├── pipeline.rb
|
26
|
+
└── schedule.rb
|
22
27
|
|
23
|
-
|
28
|
+
File | Description
|
29
|
+
--- | ---
|
30
|
+
pipeline.rb | The CodePipeline pipeline written as a DSL. This is required. Here are the [Pipeline DSL docs](https://pipedream.run/docs/dsl/pipeline/)
|
31
|
+
schedule.rb | A CloudWatch scheduled event written as a DSL. Here are the [schedule.rb docs](https://pipedream.run/docs/dsl/schedule/)
|
24
32
|
|
25
|
-
|
33
|
+
## DSL
|
26
34
|
|
27
|
-
|
35
|
+
.pipedream/pipeline.rb:
|
28
36
|
|
29
|
-
|
37
|
+
```ruby
|
38
|
+
stage "Source" do
|
39
|
+
github(
|
40
|
+
source: "tongueroo/demo-ufo",
|
41
|
+
auth_token: ssm("/github/user/token")
|
42
|
+
)
|
43
|
+
end
|
44
|
+
stage "DeployStacks" do
|
45
|
+
codebuild "demo1" # action declaration
|
46
|
+
codebuild "demo2", "demo3" # will run in parallel
|
47
|
+
codebuild "demo4" # action declaration
|
48
|
+
end
|
49
|
+
```
|
30
50
|
|
31
|
-
|
51
|
+
More [DSL docs](https://pipedream.run/docs/dsl/)
|
32
52
|
|
33
|
-
##
|
53
|
+
## Installation
|
34
54
|
|
35
|
-
|
55
|
+
Add this line to your application's Gemfile:
|
56
|
+
|
57
|
+
gem "pipedream"
|
58
|
+
|
59
|
+
And then execute:
|
60
|
+
|
61
|
+
bundle
|
36
62
|
|
37
|
-
|
63
|
+
Or install it yourself as:
|
64
|
+
|
65
|
+
gem install pipedream
|
66
|
+
|
67
|
+
## Contributing
|
38
68
|
|
39
|
-
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am "Add some feature"`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
|
4
|
+
task default: :spec
|
5
5
|
|
6
|
-
|
6
|
+
RSpec::Core::RakeTask.new
|
7
|
+
|
8
|
+
require_relative "lib/pipedream"
|
9
|
+
require "cli_markdown"
|
10
|
+
desc "Generates cli reference docs as markdown"
|
11
|
+
task :docs do
|
12
|
+
mkdir_p "docs/_includes"
|
13
|
+
CliMarkdown::Creator.create_all(cli_class: Pipedream::CLI, cli_name: "pipe")
|
14
|
+
end
|
data/exe/pipe
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Trap ^C
|
4
|
+
Signal.trap("INT") {
|
5
|
+
puts "\nCtrl-C detected. Exiting..."
|
6
|
+
sleep 0.1
|
7
|
+
exit
|
8
|
+
}
|
9
|
+
|
10
|
+
$:.unshift(File.expand_path("../../lib", __FILE__))
|
11
|
+
require "pipedream"
|
12
|
+
require "pipedream/cli"
|
13
|
+
|
14
|
+
Pipedream::CLI.start(ARGV)
|
data/exe/pipedream
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Trap ^C
|
4
|
+
Signal.trap("INT") {
|
5
|
+
puts "\nCtrl-C detected. Exiting..."
|
6
|
+
sleep 0.1
|
7
|
+
exit
|
8
|
+
}
|
9
|
+
|
10
|
+
$:.unshift(File.expand_path("../../lib", __FILE__))
|
11
|
+
require "pipedream"
|
12
|
+
require "pipedream/cli"
|
13
|
+
|
14
|
+
Pipedream::CLI.start(ARGV)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "zeitwerk"
|
2
|
+
|
3
|
+
module Pipedream
|
4
|
+
class Autoloader
|
5
|
+
class Inflector < Zeitwerk::Inflector
|
6
|
+
def camelize(basename, _abspath)
|
7
|
+
map = { cli: "CLI", version: "VERSION" }
|
8
|
+
map[basename.to_sym] || super
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def setup
|
14
|
+
loader = Zeitwerk::Loader.new
|
15
|
+
loader.inflector = Inflector.new
|
16
|
+
loader.push_dir(File.dirname(__dir__)) # lib
|
17
|
+
loader.setup
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Pipedream::AwsServices
|
2
|
+
module Helpers
|
3
|
+
def stack_exists?(stack_name)
|
4
|
+
return false if ENV['TEST']
|
5
|
+
|
6
|
+
exist = nil
|
7
|
+
begin
|
8
|
+
# When the stack does not exist an exception is raised. Example:
|
9
|
+
# Aws::CloudFormation::Errors::ValidationError: Stack with id blah does not exist
|
10
|
+
cfn.describe_stacks(stack_name: stack_name)
|
11
|
+
exist = true
|
12
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
13
|
+
if e.message =~ /does not exist/
|
14
|
+
exist = false
|
15
|
+
elsif e.message.include?("'stackName' failed to satisfy constraint")
|
16
|
+
# Example of e.message when describe_stack with invalid stack name
|
17
|
+
# "1 validation error detected: Value 'instance_and_route53' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*"
|
18
|
+
puts "Invalid stack name: #{stack_name}"
|
19
|
+
puts "Full error message: #{e.message}"
|
20
|
+
exit 1
|
21
|
+
else
|
22
|
+
raise # re-raise exception because unsure what other errors can happen
|
23
|
+
end
|
24
|
+
end
|
25
|
+
exist
|
26
|
+
end
|
27
|
+
|
28
|
+
def pipeline_name_convention(name_base)
|
29
|
+
items = [@pipeline_name, @options[:type], Pipedream.env_extra]
|
30
|
+
items.insert(2, Pipedream.env) if Pipedream.settings.dig(:stack_naming, :append_env)
|
31
|
+
items.reject(&:blank?).compact.join("-")
|
32
|
+
end
|
33
|
+
|
34
|
+
def inferred_pipeline_name
|
35
|
+
# Essentially the project's parent folder
|
36
|
+
File.basename(Dir.pwd).gsub('_','-').gsub(/\.+/,'-').gsub(/[^0-9a-zA-Z,-]/, '')
|
37
|
+
end
|
38
|
+
|
39
|
+
# Examples:
|
40
|
+
#
|
41
|
+
# myapp-ci-deploy # with Settings stack_naming append_env set to false.
|
42
|
+
# myapp-ci-deploy-development
|
43
|
+
# myapp-ci-deploy-development-2
|
44
|
+
#
|
45
|
+
def inferred_stack_name(pipeline_name)
|
46
|
+
items = [pipeline_name, @options[:type], Pipedream.env_extra, "pipe"]
|
47
|
+
items.insert(2, Pipedream.env) if Pipedream.settings.dig(:stack_naming, :append_env)
|
48
|
+
items.reject(&:blank?).compact.join("-")
|
49
|
+
end
|
50
|
+
|
51
|
+
def are_you_sure?(stack_name, action)
|
52
|
+
if @options[:sure]
|
53
|
+
sure = 'y'
|
54
|
+
else
|
55
|
+
message = case action
|
56
|
+
when :update
|
57
|
+
"Are you sure you want to want to update the #{stack_name.color(:green)} stack with the changes? (y/N)"
|
58
|
+
when :delete
|
59
|
+
"Are you sure you want to want to delete the #{stack_name.color(:green)} stack? (y/N)"
|
60
|
+
end
|
61
|
+
puts message
|
62
|
+
sure = $stdin.gets
|
63
|
+
end
|
64
|
+
|
65
|
+
unless sure =~ /^y/
|
66
|
+
puts "Whew! Exiting without running #{action}."
|
67
|
+
exit 0
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "aws-sdk-codepipeline"
|
2
|
+
require "aws-sdk-cloudformation"
|
3
|
+
|
4
|
+
module Pipedream
|
5
|
+
module AwsServices
|
6
|
+
include Helpers
|
7
|
+
|
8
|
+
def codepipeline
|
9
|
+
@codepipeline ||= Aws::CodePipeline::Client.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def cfn
|
13
|
+
@cfn ||= Aws::CloudFormation::Client.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def s3
|
17
|
+
@s3 ||= Aws::S3::Client.new
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Pipedream
|
2
|
+
class CLI < Command
|
3
|
+
class_option :verbose, type: :boolean
|
4
|
+
class_option :noop, type: :boolean
|
5
|
+
|
6
|
+
desc "init", "Initialize project with .codepipline files"
|
7
|
+
long_desc Help.text(:init)
|
8
|
+
Init.cli_options.each do |args|
|
9
|
+
option(*args)
|
10
|
+
end
|
11
|
+
register(Init, "init", "init", "Set up initial .codepipline files.")
|
12
|
+
|
13
|
+
common_options = Proc.new do
|
14
|
+
option :stack_name, desc: "Override the generated stack name. If you use this you must always specify it"
|
15
|
+
option :wait, type: :boolean, default: true, desc: "Wait for operation to complete"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "deploy PIPELINE_NAME", "Deploy pipeline."
|
19
|
+
long_desc Help.text(:deploy)
|
20
|
+
option :branch, aliases: "b", desc: "git branch" # important to default to nil
|
21
|
+
common_options.call
|
22
|
+
def deploy(pipeline_name=nil)
|
23
|
+
Deploy.new(options.merge(pipeline_name: pipeline_name)).run
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "start", "Start codebuild project."
|
27
|
+
long_desc Help.text(:start)
|
28
|
+
option :sure, desc: "Bypass are you sure prompt"
|
29
|
+
option :branch, aliases: "b", desc: "git branch" # important to default to nil
|
30
|
+
common_options.call
|
31
|
+
def start(pipeline_name=nil)
|
32
|
+
Start.new(options.merge(pipeline_name: pipeline_name)).run
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "delete", "Delete codebuild project."
|
36
|
+
long_desc Help.text(:delete)
|
37
|
+
option :sure, desc: "Bypass are you sure prompt"
|
38
|
+
common_options.call
|
39
|
+
def delete(pipeline_name=nil)
|
40
|
+
Delete.new(options.merge(pipeline_name: pipeline_name)).run
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "completion *PARAMS", "Prints words for auto-completion."
|
44
|
+
long_desc Help.text("completion")
|
45
|
+
def completion(*params)
|
46
|
+
Completer.new(CLI, *params).run
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "completion_script", "Generates a script that can be eval to setup auto-completion."
|
50
|
+
long_desc Help.text("completion_script")
|
51
|
+
def completion_script
|
52
|
+
Completer::Script.generate
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "version", "prints version"
|
56
|
+
def version
|
57
|
+
puts VERSION
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|