kurgan 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/kurgan/component.rb +13 -8
- data/lib/kurgan/init.rb +11 -7
- data/lib/kurgan/templates/Jenkinsfile.tt +38 -8
- data/lib/kurgan/templates/README.md.tt +8 -4
- data/lib/kurgan/templates/cfndsl.rb.tt +3 -0
- data/lib/kurgan/templates/codebuild.yaml.tt +7 -1
- data/lib/kurgan/templates/gitignore.tt +1 -0
- data/lib/kurgan/templates/sns_topic.test.yaml.tt +6 -0
- data/lib/kurgan/templates/travis.yml.tt +10 -1
- data/lib/kurgan/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13e0829241c7cb5e338bf5bcd9f0e2dda93c762f3892866cc6af12663fb50a28
|
4
|
+
data.tar.gz: 227a2567eae45d9385aa385b634cb0089f04d47b7962150ec8bffa342209674b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1db730b78f85a5b800f9d6b493a80c6bff0c85dc691f7a15775896570b3304ef01083771b28995a66aa455d57759d2afcc23b6e661e7dcf7b5e4068237097df
|
7
|
+
data.tar.gz: eafc409b22f9b9397181ca69f0181c4d6bdac21923ea1dd7ae9da1c64c806e66f7b7e1fc1c42d577e87a798ea3a91f2286735e1deab8e373620d996cdacf6c45
|
data/Gemfile.lock
CHANGED
data/lib/kurgan/component.rb
CHANGED
@@ -3,6 +3,10 @@ require 'kurgan/init'
|
|
3
3
|
module Kurgan
|
4
4
|
class Component < Kurgan::Init
|
5
5
|
|
6
|
+
def set_type
|
7
|
+
@type = 'component'
|
8
|
+
end
|
9
|
+
|
6
10
|
def set_directory
|
7
11
|
@dir = ask "directory name ", default: "hl-component-#{name}"
|
8
12
|
empty_directory @dir
|
@@ -23,19 +27,20 @@ module Kurgan
|
|
23
27
|
template('templates/cfndsl.rb.tt', "#{@dir}/#{name}.cfndsl.rb")
|
24
28
|
end
|
25
29
|
|
26
|
-
def
|
27
|
-
if yes?("
|
28
|
-
|
30
|
+
def create_empty_test
|
31
|
+
if yes?("Setup sample test?")
|
32
|
+
empty_directory "#{@dir}/tests"
|
33
|
+
template('templates/sns_topic.test.yaml.tt', "#{@dir}/tests/sns_topic.test.yaml")
|
29
34
|
else
|
30
|
-
say "Skipping
|
35
|
+
say "Skipping tests", :yellow
|
31
36
|
end
|
32
37
|
end
|
33
38
|
|
34
|
-
def
|
35
|
-
if yes?("Use
|
36
|
-
copy_file "templates/
|
39
|
+
def copy_licence
|
40
|
+
if yes?("Use MIT license?")
|
41
|
+
copy_file "templates/MITLICENSE", "#{@dir}/LICENSE"
|
37
42
|
else
|
38
|
-
say "
|
43
|
+
say "Skipping license", :yellow
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
data/lib/kurgan/init.rb
CHANGED
@@ -7,12 +7,16 @@ module Kurgan
|
|
7
7
|
|
8
8
|
argument :name
|
9
9
|
|
10
|
-
class_option :
|
10
|
+
class_option :project, aliases: '-p', default: 'empty', enum: ['empty','vpc','ecs'], desc: "Create a pre-canned project"
|
11
11
|
|
12
12
|
def self.source_root
|
13
13
|
File.dirname(__FILE__)
|
14
14
|
end
|
15
15
|
|
16
|
+
def set_type
|
17
|
+
@type = 'project'
|
18
|
+
end
|
19
|
+
|
16
20
|
def set_directory
|
17
21
|
@dir = ask "directory name ", default: name
|
18
22
|
empty_directory @dir
|
@@ -23,11 +27,11 @@ module Kurgan
|
|
23
27
|
end
|
24
28
|
|
25
29
|
def set_template_parameters
|
26
|
-
@parameters = Kurgan::Projects.properties[options['
|
30
|
+
@parameters = Kurgan::Projects.properties[options['project'].to_sym][:parameters]
|
27
31
|
end
|
28
32
|
|
29
33
|
def set_template_components
|
30
|
-
@components = Kurgan::Projects.properties[options['
|
34
|
+
@components = Kurgan::Projects.properties[options['project'].to_sym][:components]
|
31
35
|
end
|
32
36
|
|
33
37
|
def create_cfhighlander_template
|
@@ -43,7 +47,7 @@ module Kurgan
|
|
43
47
|
if yes?("git init project?")
|
44
48
|
run "git init #{@dir}"
|
45
49
|
template 'templates/gitignore.tt', "#{@dir}/.gitignore"
|
46
|
-
template
|
50
|
+
template "templates/README.md.tt", "#{@dir}/README.md"
|
47
51
|
else
|
48
52
|
say "Skipping git init", :yellow
|
49
53
|
end
|
@@ -51,11 +55,11 @@ module Kurgan
|
|
51
55
|
|
52
56
|
def ci_init
|
53
57
|
if yes?("Setup a CI pipeline?")
|
54
|
-
|
55
|
-
case
|
58
|
+
ci = ask "CI flavour", limited_to: ['jenkins', 'travis', 'codebuild']
|
59
|
+
case ci
|
56
60
|
when 'jenkins'
|
57
61
|
template('templates/Jenkinsfile.tt', "#{@dir}/Jenkinsfile")
|
58
|
-
when 'travis
|
62
|
+
when 'travis'
|
59
63
|
template('templates/travis.yml.tt', "#{@dir}/.travis.yml")
|
60
64
|
when 'codebuild'
|
61
65
|
template('templates/codebuild.yaml.tt', "#{@dir}/.codebuild.yaml")
|
@@ -3,16 +3,42 @@ pipeline {
|
|
3
3
|
environment {
|
4
4
|
AWS_REGION = 'us-east-1'
|
5
5
|
PROJECT_NAME = '<%= @name %>'
|
6
|
+
VERSION = '0.1.0'
|
6
7
|
}
|
7
8
|
|
8
9
|
agent {
|
9
10
|
docker {
|
10
|
-
|
11
|
+
image 'theonestack/cfhighlander'
|
11
12
|
}
|
12
13
|
}
|
13
14
|
|
14
15
|
stages {
|
15
16
|
|
17
|
+
<%- if @type == 'component' -%>
|
18
|
+
stage('cftest') {
|
19
|
+
steps {
|
20
|
+
sh 'cfndsl -u'
|
21
|
+
sh "cfhighlander cftest -r xml"
|
22
|
+
}
|
23
|
+
post {
|
24
|
+
always {
|
25
|
+
junit 'reports/report.xml'
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
stage('cfn nag') {
|
31
|
+
agent {
|
32
|
+
docker {
|
33
|
+
image 'base2/cfn-nag'
|
34
|
+
reuseNode true
|
35
|
+
}
|
36
|
+
}
|
37
|
+
steps {
|
38
|
+
sh 'cfn_nag_scan -i out/tests'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
<%- elsif @type == 'project' -%>
|
16
42
|
stage('Compile and validate templates') {
|
17
43
|
steps {
|
18
44
|
sh 'cfndsl -u'
|
@@ -20,20 +46,24 @@ pipeline {
|
|
20
46
|
}
|
21
47
|
}
|
22
48
|
|
23
|
-
stage('
|
24
|
-
|
25
|
-
|
26
|
-
|
49
|
+
stage('cfn nag') {
|
50
|
+
agent {
|
51
|
+
docker {
|
52
|
+
image 'base2/cfn-nag'
|
53
|
+
reuseNode true
|
27
54
|
}
|
28
|
-
|
55
|
+
}
|
56
|
+
steps {
|
57
|
+
sh 'cfn_nag_scan -i out/yaml'
|
29
58
|
}
|
30
59
|
}
|
31
60
|
|
32
|
-
stage('
|
61
|
+
stage('Publish templates') {
|
33
62
|
steps {
|
34
|
-
|
63
|
+
sh "cfpublish ${env.PROJECT_NAME} --version ${env.VERSION}"
|
35
64
|
}
|
36
65
|
}
|
66
|
+
<%- end -%>
|
37
67
|
|
38
68
|
}
|
39
69
|
}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
# <%= name %> CfHighlander
|
2
|
-
---
|
1
|
+
# <%= name %> CfHighlander <%= @type %>
|
3
2
|
|
4
3
|
## Cfhighlander Setup
|
5
4
|
|
@@ -14,12 +13,16 @@ or via docker
|
|
14
13
|
```bash
|
15
14
|
docker pull theonestack/cfhighlander
|
16
15
|
```
|
16
|
+
<%- if @type == 'component' -%>
|
17
|
+
## Testing Components
|
17
18
|
|
18
|
-
|
19
|
+
Running the tests
|
19
20
|
|
20
21
|
```bash
|
21
|
-
|
22
|
+
cfhighlander cftest <%= name %>
|
22
23
|
```
|
24
|
+
<%- elsif @type == 'project' -%>
|
25
|
+
## Compiling the project
|
23
26
|
|
24
27
|
compiling with the vaildate fag to validate the templates
|
25
28
|
|
@@ -32,3 +35,4 @@ publish the templates to s3
|
|
32
35
|
```bash
|
33
36
|
cfpublish <%= name %> --version latest
|
34
37
|
```
|
38
|
+
<%- end -%>
|
@@ -7,7 +7,13 @@ env:
|
|
7
7
|
phases:
|
8
8
|
install:
|
9
9
|
commands:
|
10
|
-
- gem install cfhighlander
|
10
|
+
- gem install cfhighlander cfn-nag
|
11
11
|
build:
|
12
12
|
commands:
|
13
|
+
<%- if @type == 'component' -%>
|
14
|
+
- cfhighlander cftest
|
15
|
+
- cfn_nag_scan -i out/tests
|
16
|
+
<%- elsif @type == 'project' -%>
|
13
17
|
- cfcompile --validate
|
18
|
+
- cfn_nag_scan -i out/yaml
|
19
|
+
<%- end -%>
|
@@ -1,6 +1,15 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
3
|
- 2.5
|
4
|
+
install:
|
5
|
+
- gem install cfhighlander cfn-nag
|
6
|
+
before_script:
|
7
|
+
- cfndsl -u
|
8
|
+
<%- if @type == 'component' -%>
|
9
|
+
script:
|
10
|
+
- cfhighlander cftest
|
11
|
+
- cfn_nag_scan -i out/tests
|
12
|
+
<%- elsif @type == 'project' -%>
|
4
13
|
script:
|
5
14
|
- gem install cfhighlander
|
6
|
-
|
15
|
+
<%- end -%>
|
data/lib/kurgan/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kurgan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guslington
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/kurgan/templates/codebuild.yaml.tt
|
85
85
|
- lib/kurgan/templates/config.yaml.tt
|
86
86
|
- lib/kurgan/templates/gitignore.tt
|
87
|
+
- lib/kurgan/templates/sns_topic.test.yaml.tt
|
87
88
|
- lib/kurgan/templates/travis.yml.tt
|
88
89
|
- lib/kurgan/version.rb
|
89
90
|
homepage: http://iamkurgan.com
|