iapi-idlc-sdk-pfm 1.0.4
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 +7 -0
- data/.gitignore +16 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/.yardopts +3 -0
- data/Gemfile +6 -0
- data/Jenkinsfile +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/pfm +8 -0
- data/docs/GettingStarted.md +299 -0
- data/iapi-idlc-sdk-pfm.gemspec +50 -0
- data/lib/iapi-idlc-sdk-pfm/builtin_commands.rb +12 -0
- data/lib/iapi-idlc-sdk-pfm/cli.rb +150 -0
- data/lib/iapi-idlc-sdk-pfm/command/apply.rb +86 -0
- data/lib/iapi-idlc-sdk-pfm/command/base.rb +255 -0
- data/lib/iapi-idlc-sdk-pfm/command/build.rb +121 -0
- data/lib/iapi-idlc-sdk-pfm/command/configure.rb +41 -0
- data/lib/iapi-idlc-sdk-pfm/command/destroy.rb +77 -0
- data/lib/iapi-idlc-sdk-pfm/command/exec.rb +24 -0
- data/lib/iapi-idlc-sdk-pfm/command/format.rb +64 -0
- data/lib/iapi-idlc-sdk-pfm/command/generate.rb +83 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/base.rb +50 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/server_build.rb +58 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/Berksfile +3 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/build_cookbook/.kitchen.yml +21 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/build_cookbook/README.md +146 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +8 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/chefignore +107 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +9 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/cookbook_readmes/README.md +54 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/delivery-config.json +12 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/delivery-project.toml +36 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/gitignore +21 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/README.md +24 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +27 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +7 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb +6 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +8 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/data_bags/README.md +56 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/data_bags/example/example_item.json +4 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/dot-chef-repo.txt +6 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/environments/README.md +9 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/environments/example.json +13 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/policies/README.md +24 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/roles/README.md +9 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/repo/roles/example.json +13 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/spec_helper.rb +2 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/files/default/spec_helper_policyfile.rb +2 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/metadata.rb +7 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb +89 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/attribute.rb +12 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/build_cookbook.rb +182 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/cookbook.rb +144 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/cookbook_file.rb +24 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/lwrp.rb +23 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/policyfile.rb +8 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/recipe.rb +51 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/repo.rb +67 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/template.rb +32 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/LICENSE.all_rights.erb +3 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/LICENSE.apachev2.erb +201 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/LICENSE.gplv2.erb +339 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/LICENSE.gplv3.erb +674 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/LICENSE.mit.erb +21 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/Policyfile.rb.erb +25 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/README.md.erb +4 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/attribute.rb.erb +0 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +7 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +10 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/build_cookbook/recipe.rb.erb +8 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/cookbook_file.erb +0 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +18 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/kitchen.yml.erb +26 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +33 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/metadata.rb.erb +20 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/provider.rb.erb +0 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/recipe.rb.erb +5 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/recipe_spec.rb.erb +22 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/repo/gitignore.erb +128 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/resource.rb.erb +0 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/templates/default/template.erb +0 -0
- data/lib/iapi-idlc-sdk-pfm/command/generator_commands.rb +34 -0
- data/lib/iapi-idlc-sdk-pfm/command/package.rb +118 -0
- data/lib/iapi-idlc-sdk-pfm/command/plan.rb +96 -0
- data/lib/iapi-idlc-sdk-pfm/command/templates/app/files/config/client.rb.template +9 -0
- data/lib/iapi-idlc-sdk-pfm/command/templates/app/files/config/init.ps1.userdata +16 -0
- data/lib/iapi-idlc-sdk-pfm/command/templates/base/files/config/client.rb.template +9 -0
- data/lib/iapi-idlc-sdk-pfm/command/templates/base/files/config/init.ps1.userdata +219 -0
- data/lib/iapi-idlc-sdk-pfm/command/validate.rb +85 -0
- data/lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb +65 -0
- data/lib/iapi-idlc-sdk-pfm/command/validator_commands/infrastructure.rb +46 -0
- data/lib/iapi-idlc-sdk-pfm/command/validator_commands/server_build.rb +135 -0
- data/lib/iapi-idlc-sdk-pfm/command/validator_commands.rb +32 -0
- data/lib/iapi-idlc-sdk-pfm/commands_map.rb +61 -0
- data/lib/iapi-idlc-sdk-pfm/generator.rb +52 -0
- data/lib/iapi-idlc-sdk-pfm/helpers.rb +49 -0
- data/lib/iapi-idlc-sdk-pfm/settings.rb +205 -0
- data/lib/iapi-idlc-sdk-pfm/validator.rb +52 -0
- data/lib/iapi-idlc-sdk-pfm/version.rb +4 -0
- data/lib/iapi-idlc-sdk-pfm.rb +27 -0
- metadata +442 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) <%= year %> <%= copyright_holder %>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Policyfile.rb - Describe how you want Chef to build your system.
|
2
|
+
#
|
3
|
+
# For more information on the Policyfile feature, visit
|
4
|
+
# https://docs.chef.io/policyfile.html
|
5
|
+
|
6
|
+
# A name that describes what the system you're building with Chef does.
|
7
|
+
name "<%= policy_name %>"
|
8
|
+
|
9
|
+
<% if include_chef_repo_source %>
|
10
|
+
# This lets you source cookbooks from your chef-repo.
|
11
|
+
default_source :chef_repo, "../"
|
12
|
+
|
13
|
+
<% end -%>
|
14
|
+
# Where to find external cookbooks:
|
15
|
+
default_source :supermarket
|
16
|
+
|
17
|
+
# run_list: chef-client will run these recipes in the order specified.
|
18
|
+
run_list "<%= policy_run_list %>"
|
19
|
+
|
20
|
+
# Specify a custom source for a single cookbook:
|
21
|
+
<% if policy_local_cookbook.nil? %>
|
22
|
+
# cookbook "example_cookbook", path: "../cookbooks/example_cookbook"
|
23
|
+
<% else %>
|
24
|
+
cookbook "<%= cookbook_name %>", path: "."
|
25
|
+
<% end %>
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
name 'build_cookbook'
|
2
|
+
maintainer '<%= copyright_holder %>'
|
3
|
+
maintainer_email '<%= email %>'
|
4
|
+
license '<%= license %>'
|
5
|
+
version '0.1.0'
|
6
|
+
chef_version '>= 12.1' if respond_to?(:chef_version)
|
7
|
+
<% if build_cookbook_parent_is_cookbook -%>
|
8
|
+
|
9
|
+
depends 'delivery-truck'
|
10
|
+
<% end -%>
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# # encoding: utf-8
|
2
|
+
|
3
|
+
# Inspec test for recipe <%= cookbook_name %>::<%= recipe_name %>
|
4
|
+
|
5
|
+
# The Inspec reference, with examples and extensive documentation, can be
|
6
|
+
# found at http://inspec.io/docs/reference/resources/
|
7
|
+
|
8
|
+
unless os.windows?
|
9
|
+
# This is an example test, replace with your own test.
|
10
|
+
describe user('root'), :skip do
|
11
|
+
it { should exist }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# This is an example test, replace it with your own test.
|
16
|
+
describe port(80), :skip do
|
17
|
+
it { should_not be_listening }
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
driver:
|
3
|
+
name: vagrant
|
4
|
+
|
5
|
+
provisioner:
|
6
|
+
name: chef_zero
|
7
|
+
# You may wish to disable always updating cookbooks in CI or other testing environments.
|
8
|
+
# For example:
|
9
|
+
# always_update_cookbooks: <%%= !ENV['CI'] %>
|
10
|
+
always_update_cookbooks: true
|
11
|
+
|
12
|
+
verifier:
|
13
|
+
name: inspec
|
14
|
+
|
15
|
+
platforms:
|
16
|
+
- name: ubuntu-16.04
|
17
|
+
- name: centos-7.3
|
18
|
+
|
19
|
+
suites:
|
20
|
+
- name: default
|
21
|
+
run_list:
|
22
|
+
- recipe[<%= cookbook_name %>::default]
|
23
|
+
verifier:
|
24
|
+
inspec_tests:
|
25
|
+
- test/smoke/default
|
26
|
+
attributes:
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
driver:
|
3
|
+
name: vagrant
|
4
|
+
|
5
|
+
## The forwarded_port port feature lets you connect to ports on the VM guest via
|
6
|
+
## localhost on the host.
|
7
|
+
## see also: https://docs.vagrantup.com/v2/networking/forwarded_ports.html
|
8
|
+
|
9
|
+
# network:
|
10
|
+
# - ["forwarded_port", {guest: 80, host: 8080}]
|
11
|
+
|
12
|
+
provisioner:
|
13
|
+
name: policyfile_zero
|
14
|
+
|
15
|
+
## require_chef_omnibus specifies a specific chef version to install. You can
|
16
|
+
## also set this to `true` to always use the latest version.
|
17
|
+
## see also: https://docs.chef.io/config_yml_kitchen.html
|
18
|
+
|
19
|
+
# require_chef_omnibus: 12.8.1
|
20
|
+
|
21
|
+
verifier:
|
22
|
+
name: inspec
|
23
|
+
|
24
|
+
platforms:
|
25
|
+
- name: ubuntu-16.04
|
26
|
+
- name: centos-7.3
|
27
|
+
|
28
|
+
suites:
|
29
|
+
- name: default
|
30
|
+
verifier:
|
31
|
+
inspec_tests:
|
32
|
+
- test/smoke/default
|
33
|
+
attributes:
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name '<%= cookbook_name %>'
|
2
|
+
maintainer '<%= copyright_holder %>'
|
3
|
+
maintainer_email '<%= email %>'
|
4
|
+
license '<%= @spdx_license %>'
|
5
|
+
description 'Installs/Configures <%= cookbook_name %>'
|
6
|
+
long_description 'Installs/Configures <%= cookbook_name %>'
|
7
|
+
version '0.1.0'
|
8
|
+
chef_version '>= 12.1' if respond_to?(:chef_version)
|
9
|
+
|
10
|
+
# The `issues_url` points to the location where issues for this cookbook are
|
11
|
+
# tracked. A `View Issues` link will be displayed on this cookbook's page when
|
12
|
+
# uploaded to a Supermarket.
|
13
|
+
#
|
14
|
+
# issues_url 'https://github.com/<insert_org_here>/<%= cookbook_name %>/issues'
|
15
|
+
|
16
|
+
# The `source_url` points to the development reposiory for this cookbook. A
|
17
|
+
# `View Source` link will be displayed on this cookbook's page when uploaded to
|
18
|
+
# a Supermarket.
|
19
|
+
#
|
20
|
+
# source_url 'https://github.com/<insert_org_here>/<%= cookbook_name %>'
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: <%= cookbook_name %>
|
3
|
+
# Spec:: default
|
4
|
+
#
|
5
|
+
<%= license_description('#') %>
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
|
9
|
+
describe '<%= cookbook_name %>::<%= recipe_name %>' do
|
10
|
+
context 'When all attributes are default, on an Ubuntu 16.04' do
|
11
|
+
let(:chef_run) do
|
12
|
+
# for a complete list of available platforms and versions see:
|
13
|
+
# https://github.com/customink/fauxhai/blob/master/PLATFORMS.md
|
14
|
+
runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
|
15
|
+
runner.converge(described_recipe)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'converges successfully' do
|
19
|
+
expect { chef_run }.to_not raise_error
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
## Below are example of common git excludes.
|
2
|
+
## Please note that /cookbooks folder is ignored. This allows users to
|
3
|
+
## clone individual cookbooks into the /cookbook folder of the chef repo
|
4
|
+
## and work on them in parallel. This pattern also allows for chef-workstation
|
5
|
+
## pattern, where base repo also builds out a dynamic chef workstation.
|
6
|
+
## Examples of workstation cookbooks:
|
7
|
+
## https://github.com/mwrock/chef_workstation
|
8
|
+
## https://github.com/Nordstrom/chefdk_bootstrap
|
9
|
+
|
10
|
+
|
11
|
+
## Ignore Chef related files and secrets
|
12
|
+
.chef
|
13
|
+
.chef/*.pem
|
14
|
+
.chef/encrypted_data_bag_secret
|
15
|
+
<%- if policy_only -%>
|
16
|
+
cookbooks/**
|
17
|
+
!cookbooks/README.md
|
18
|
+
<%- end -%>
|
19
|
+
|
20
|
+
## Ignore Chef-Zero files
|
21
|
+
clients
|
22
|
+
nodes
|
23
|
+
|
24
|
+
# ## OS junk files
|
25
|
+
# [Tt]humbs.db
|
26
|
+
# *.DS_Store
|
27
|
+
|
28
|
+
# ## Example of the workstation pattern.
|
29
|
+
# !/cookbooks/chef_workstation/files/default/bundler/Gemfile
|
30
|
+
# !/cookbooks/chef_workstation/files/default/bundler/Gemfile.lock
|
31
|
+
# cookbooks/*
|
32
|
+
# !cookbooks/chef_workstation
|
33
|
+
|
34
|
+
# ##Chef
|
35
|
+
# .kitchen/
|
36
|
+
# .vagrant
|
37
|
+
# nodes
|
38
|
+
# metadata.json
|
39
|
+
|
40
|
+
# ##ruby
|
41
|
+
# *.gem
|
42
|
+
# Gemfile
|
43
|
+
# Gemfile.lock
|
44
|
+
.rake_test_cache
|
45
|
+
|
46
|
+
# ## Rails Heroku and other bits to ignore
|
47
|
+
# *.log
|
48
|
+
# *.sqlite3
|
49
|
+
# db/*.sqlite3
|
50
|
+
# .bundle
|
51
|
+
# log/*
|
52
|
+
# tmp/*
|
53
|
+
# public/system/*
|
54
|
+
|
55
|
+
# ##nodejs
|
56
|
+
# node_modules
|
57
|
+
|
58
|
+
# # Nuget (exclude all exes except for the one in the global build folder)
|
59
|
+
# nuget.exe
|
60
|
+
# !build/nuget/nuget.exe
|
61
|
+
# *.nupkg
|
62
|
+
# # NuGet packages (based on default naming convention)
|
63
|
+
# [Bb]uild/[Pp]ackages/
|
64
|
+
|
65
|
+
# # Build System # common build output folders
|
66
|
+
# build-common/
|
67
|
+
# output/
|
68
|
+
|
69
|
+
# ## Probably not a good idea to be keeing VM inages in source control
|
70
|
+
# *.vhd
|
71
|
+
# *.vhdx
|
72
|
+
|
73
|
+
# ## Pester Test summary
|
74
|
+
# Test.xml
|
75
|
+
|
76
|
+
# ##Webstorm files
|
77
|
+
# *.idea
|
78
|
+
# .idea
|
79
|
+
# .idea/
|
80
|
+
|
81
|
+
# ##Mono (or something?) files
|
82
|
+
# *.pidb
|
83
|
+
# *.userprefs
|
84
|
+
|
85
|
+
# ## Visual Studio files
|
86
|
+
# *.docstates
|
87
|
+
# *.[Oo]bj
|
88
|
+
# *.dat
|
89
|
+
# *.crc
|
90
|
+
# *.dbmdl
|
91
|
+
# *.pdb
|
92
|
+
# *.user
|
93
|
+
# *.aps
|
94
|
+
# *.pch
|
95
|
+
# *.vspscc
|
96
|
+
# *.vssscc
|
97
|
+
# *_i.c
|
98
|
+
# *_p.c
|
99
|
+
# *.ncb
|
100
|
+
# *.suo
|
101
|
+
# *.tlb
|
102
|
+
# *.tlh
|
103
|
+
# *.bak
|
104
|
+
# *.[Cc]ache
|
105
|
+
# *.ilk
|
106
|
+
# *.log
|
107
|
+
# *.lib
|
108
|
+
# *.sbr
|
109
|
+
# *.schemaview
|
110
|
+
# ipch/
|
111
|
+
# [Oo]bj/
|
112
|
+
# [Bb]in/*
|
113
|
+
# [Dd]ebug*/
|
114
|
+
# [Rr]elease*/
|
115
|
+
# Ankh.NoLoad
|
116
|
+
|
117
|
+
# ##Tooling
|
118
|
+
# _ReSharper*/
|
119
|
+
# *.[Rr]e[Ss]harper
|
120
|
+
# [Tt]est[Rr]esult*
|
121
|
+
# .[Jj]ust[Cc]ode
|
122
|
+
# *ncrunch*
|
123
|
+
|
124
|
+
# ##Subversion files
|
125
|
+
# .svn
|
126
|
+
|
127
|
+
# ## Office Temp Files
|
128
|
+
# ~$*
|
File without changes
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'mixlib/cli'
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'pathname'
|
4
|
+
require 'iapi-idlc-sdk-pfm/command/base'
|
5
|
+
require 'iapi-idlc-sdk-pfm/generator'
|
6
|
+
|
7
|
+
module Pfm
|
8
|
+
module Command
|
9
|
+
# ## SharedGeneratorOptions
|
10
|
+
#
|
11
|
+
# These CLI options are shared amongst the generator commands
|
12
|
+
module SharedGeneratorOptions
|
13
|
+
include Mixlib::CLI
|
14
|
+
|
15
|
+
# You really want these to have default values, as
|
16
|
+
# they will likely be used all over the place.
|
17
|
+
# option :verbose,
|
18
|
+
# short: '-V',
|
19
|
+
# long: '--verbose',
|
20
|
+
# description: 'Show detailed output from the generator',
|
21
|
+
# boolean: true,
|
22
|
+
# default: false
|
23
|
+
end
|
24
|
+
|
25
|
+
# ## GeneratorCommands
|
26
|
+
#
|
27
|
+
# This module is the namespace for all subcommands of `pfm generate`
|
28
|
+
module GeneratorCommands
|
29
|
+
def self.build(class_name, params)
|
30
|
+
const_get(class_name).new(params)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'iapi-idlc-sdk-pfm/command/base'
|
2
|
+
require 'mixlib/shellout'
|
3
|
+
require 'aws-sdk-s3'
|
4
|
+
require 'json'
|
5
|
+
require 'colorize'
|
6
|
+
|
7
|
+
module Pfm
|
8
|
+
module Command
|
9
|
+
class Package < Base
|
10
|
+
banner 'Usage: pfm package [options]'
|
11
|
+
|
12
|
+
option :application_name,
|
13
|
+
long: '--application-name NAME',
|
14
|
+
description: 'Application Name',
|
15
|
+
default: ''
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
super
|
19
|
+
@params_valid = true
|
20
|
+
@errors = []
|
21
|
+
end
|
22
|
+
|
23
|
+
def run(params)
|
24
|
+
@params = params
|
25
|
+
read_and_validate_params
|
26
|
+
|
27
|
+
if params_valid?
|
28
|
+
package
|
29
|
+
# @workspace.cleanup causing bundler issues
|
30
|
+
0
|
31
|
+
else
|
32
|
+
@errors.each { |error| err("Error: #{error}") }
|
33
|
+
parse_options(params)
|
34
|
+
msg(opt_parser)
|
35
|
+
1
|
36
|
+
end
|
37
|
+
rescue DeploymentFailure => e
|
38
|
+
err("ERROR: #{e.message}\n")
|
39
|
+
1
|
40
|
+
end
|
41
|
+
|
42
|
+
def package
|
43
|
+
raise InvalidRepository, 'This doesn\'t look like a valid infrastructure repository' unless File.directory? "#{inf_base_dir}/tf"
|
44
|
+
|
45
|
+
# tag git repo with version number.
|
46
|
+
begin
|
47
|
+
system("git tag -am 'v#{REPO_VERSION}' v#{REPO_VERSION} &>/dev/null") || raise
|
48
|
+
msg("Tagged v#{REPO_VERSION}".colorize(:green))
|
49
|
+
rescue
|
50
|
+
msg("Tag v#{REPO_VERSION} has already been created... skipping.".colorize(:green))
|
51
|
+
end
|
52
|
+
|
53
|
+
begin
|
54
|
+
system('git push --follow-tags &>/dev/null') || raise
|
55
|
+
msg('Pushed git tags.'.colorize(:green))
|
56
|
+
rescue
|
57
|
+
err('Failed to push tags.'.colorize(:red))
|
58
|
+
end
|
59
|
+
|
60
|
+
workspace = Idlc::Workspace.new
|
61
|
+
|
62
|
+
workspace.flatten("#{inf_base_dir}/tf", 'tf')
|
63
|
+
workspace.add('lib/')
|
64
|
+
workspace.add('.pfm/config') if File.exist? '.pfm/config'
|
65
|
+
workspace.add('backend.tf') if File.exist? 'backend.tf'
|
66
|
+
workspace.add('infraspec.yml') if File.exist? 'infraspec.yml'
|
67
|
+
|
68
|
+
package_name = "#{@config[:application_name]}.#{REPO_VERSION}.infra.zip"
|
69
|
+
dest_zip = "./.pfm/#{package_name}"
|
70
|
+
FileUtils.rm_rf(dest_zip) if File.exist? dest_zip
|
71
|
+
Idlc::Workspace.zip_folder(workspace.tmp_dir, dest_zip)
|
72
|
+
msg("packaged to #{dest_zip}".colorize(:green))
|
73
|
+
|
74
|
+
# upload to s3
|
75
|
+
s3 = Aws::S3::Resource.new(region: SETTINGS['AWS_REGION'])
|
76
|
+
bucket_name = Idlc::SERVICES[SETTINGS['AWS_REGION']]['build']['publish_bucket']
|
77
|
+
|
78
|
+
obj = s3.bucket(bucket_name).object(package_name)
|
79
|
+
obj.upload_file(dest_zip)
|
80
|
+
msg('Pushed package to S3.'.colorize(:green))
|
81
|
+
|
82
|
+
# register with Orchestrate Build
|
83
|
+
raise InvalidRepository, 'Missing configuration.schema.json file in root.' unless File.exist? 'configuration.schema.json'
|
84
|
+
client = Idlc::AWSRestClient.new()
|
85
|
+
|
86
|
+
request = {
|
87
|
+
service: 'build',
|
88
|
+
method: 'PUT',
|
89
|
+
path: '/builds',
|
90
|
+
body: {
|
91
|
+
application_name: @config[:application_name],
|
92
|
+
revision: REPO_VERSION,
|
93
|
+
artifact_path: "s3://#{bucket_name}/#{package_name}",
|
94
|
+
configuration_schema: JSON.parse(File.read('configuration.schema.json'))
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
response = client.fetch(request.to_json)
|
99
|
+
msg("Registered #{@config[:application_name]} #{REPO_VERSION} with Orchestrate.".colorize(:green))
|
100
|
+
end
|
101
|
+
|
102
|
+
def read_and_validate_params
|
103
|
+
arguments = parse_options(@params)
|
104
|
+
|
105
|
+
case arguments.size
|
106
|
+
when 0
|
107
|
+
@params_valid = true
|
108
|
+
else
|
109
|
+
@params_valid = false
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def params_valid?
|
114
|
+
@params_valid
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'iapi-idlc-sdk-pfm/command/base'
|
2
|
+
require 'mixlib/shellout'
|
3
|
+
|
4
|
+
module Pfm
|
5
|
+
module Command
|
6
|
+
class Plan < Base
|
7
|
+
banner 'Usage: pfm plan [options]'
|
8
|
+
|
9
|
+
option :app_release,
|
10
|
+
short: '-a VERSION',
|
11
|
+
long: '--app-release VERSION',
|
12
|
+
description: 'Application Version Number to Deploy',
|
13
|
+
default: ''
|
14
|
+
|
15
|
+
option :server_build,
|
16
|
+
short: '-b NUMBER',
|
17
|
+
long: '--server-build NUMBER',
|
18
|
+
description: 'Server Build Number to Deploy',
|
19
|
+
default: ENV['SERVER_BUILD']
|
20
|
+
|
21
|
+
option :landscape,
|
22
|
+
short: '-l',
|
23
|
+
long: '--landscape',
|
24
|
+
description: 'Format the output with the terraform_landscape gem',
|
25
|
+
boolean: true,
|
26
|
+
default: false
|
27
|
+
|
28
|
+
option :config_file,
|
29
|
+
short: '-c FILE',
|
30
|
+
long: '--config-file FILE',
|
31
|
+
description: 'Optional environment metadata file',
|
32
|
+
default: nil
|
33
|
+
|
34
|
+
option :working_dir,
|
35
|
+
short: '-d DIR',
|
36
|
+
long: '--dir DIR',
|
37
|
+
description: 'Optional directory of infrastructure configuration to use',
|
38
|
+
default: ''
|
39
|
+
|
40
|
+
def initialize
|
41
|
+
super
|
42
|
+
@params_valid = true
|
43
|
+
@errors = []
|
44
|
+
end
|
45
|
+
|
46
|
+
def run(params)
|
47
|
+
@params = params
|
48
|
+
read_and_validate_params
|
49
|
+
|
50
|
+
if params_valid?
|
51
|
+
if (@config[:config_file])
|
52
|
+
deploy_setupv2
|
53
|
+
plan(@config[:working_dir])
|
54
|
+
else
|
55
|
+
deploy_setup
|
56
|
+
plan(@workspace.tmp_dir)
|
57
|
+
end
|
58
|
+
# @workspace.cleanup causing bundler issues
|
59
|
+
0
|
60
|
+
else
|
61
|
+
@errors.each { |error| err("Error: #{error}") }
|
62
|
+
parse_options(params)
|
63
|
+
msg(opt_parser)
|
64
|
+
1
|
65
|
+
end
|
66
|
+
rescue DeploymentFailure => e
|
67
|
+
err("ERROR: #{e.message}\n")
|
68
|
+
1
|
69
|
+
end
|
70
|
+
|
71
|
+
def plan(dir)
|
72
|
+
begin
|
73
|
+
Terraform::Binary.plan(dir.to_s) unless @config[:landscape]
|
74
|
+
Terraform::Binary.plan("#{dir} | landscape") if @config[:landscape]
|
75
|
+
rescue
|
76
|
+
raise DeploymentFailure, 'Finished with errors'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def read_and_validate_params
|
81
|
+
arguments = parse_options(@params)
|
82
|
+
|
83
|
+
case arguments.size
|
84
|
+
when 0
|
85
|
+
@params_valid = true
|
86
|
+
else
|
87
|
+
@params_valid = false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def params_valid?
|
92
|
+
@params_valid
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<powershell>
|
2
|
+
$logfile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Logs\\packer-build-userdata.log"
|
3
|
+
# Allow script execution
|
4
|
+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
|
5
|
+
#PS Remoting and & winrm.cmd basic config
|
6
|
+
Enable-PSRemoting -Force -SkipNetworkProfileCheck
|
7
|
+
& winrm.cmd set winrm/config '@{MaxTimeoutms="1800000"}' >> $logfile
|
8
|
+
& winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile
|
9
|
+
& winrm.cmd set winrm/config/winrs '@{MaxShellsPerUser="50"}' >> $logfile
|
10
|
+
#Server settings - support username/password login
|
11
|
+
& winrm.cmd set winrm/config/service/auth '@{Basic="true"}' >> $logfile
|
12
|
+
& winrm.cmd set winrm/config/service '@{AllowUnencrypted="true"}' >> $logfile
|
13
|
+
& winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile
|
14
|
+
#Firewall Config
|
15
|
+
& netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any >> $logfile
|
16
|
+
</powershell>
|