covalence 0.9.2 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -0
- data/README.md +0 -2
- data/lib/covalence.rb +2 -0
- data/lib/covalence/core/cli_wrappers/popen_wrapper.rb +1 -3
- data/lib/covalence/core/cli_wrappers/terraform_cli.rb +1 -1
- data/lib/covalence/core/entities/input.rb +4 -0
- data/lib/covalence/core/entities/stack.rb +6 -6
- data/lib/covalence/core/services/packer_stack_tasks.rb +25 -0
- data/lib/covalence/core/services/terraform_stack_tasks.rb +29 -0
- data/lib/covalence/environment_tasks.rb +12 -0
- data/lib/covalence/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e903fa8c44b45782f8ed35bcf35cc2f6b3097987a3b591df8a4d64fee2668cb
|
4
|
+
data.tar.gz: a73c98132b3bfc7ed501af2f8394c2ed91e5fb9e0dd58ee15f10521cd77f702c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f76aa5ca172ade473803119a386f7e07779b9a69d6e5d5ae1cfbeb4410d327b0e0b4af07b6569c51bd4c125ec93aa0f58bb2650afe0f634fc300a7eff0fc8d8e
|
7
|
+
data.tar.gz: 16efeb2013c66258bfa0c15c5bffb9a06fdc764b8ea41afb06f5b0c6e7f58c7ee35a1d166f1eefb1d86969676997f0cd78acc6a255c40361cd00ce1c8f355049
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
## 0.9.8 (Jun 10, 2020)
|
2
|
+
IMPROVEMENTS:
|
3
|
+
- Updated all gems to the latest in the Gemfile.lock.
|
4
|
+
|
5
|
+
BACKWARDS INCOMPATIBILITIES:
|
6
|
+
- Issue [#90](https://github.com/unifio/covalence/issues/90) Removed prefixout dependency from covalence. Directory prefix will no longer be displayed in output. Directory is already output prior to execution.
|
7
|
+
|
8
|
+
FIXES:
|
9
|
+
- [activesupport](https://github.com/advisories/GHSA-2p68-f74v-9wc6) upgraded activesupport to version 5.2.4.3 or later.
|
10
|
+
- [nokogiri](https://github.com/advisories/GHSA-7553-jr98-vx47) Upgrade nokogiri to version 1.10.8 or later.
|
11
|
+
|
12
|
+
## 0.9.7 (Sep 14, 2019)
|
13
|
+
|
14
|
+
IMPROVEMENTS:
|
15
|
+
- Issue [#88](https://github.com/unifio/covalence/issues/88) Add input processing to packer stacks. Allows for shell interpolation processing on inputs for packer stacks.
|
16
|
+
- Can use the shell interpolation in the template to generate AWS assume role temporary keys to populate template. This allows for role assumption since role assumption is not supported from `~/.aws/config` attributes.
|
17
|
+
|
18
|
+
## 0.9.6 (Sep 9, 2019)
|
19
|
+
|
20
|
+
IMPROVEMENTS:
|
21
|
+
- Issue [#86](https://github.com/unifio/covalence/issues/86) Add ability to export stacks to a stack_exports directory.
|
22
|
+
|
23
|
+
|
24
|
+
## 0.9.4 (Aug 30, 2019)
|
25
|
+
|
26
|
+
FIXES:
|
27
|
+
- Issue [#82](https://github.com/unifio/covalence/issues/82) Introduced in v0.9.2 that prevented terraform cli from being cappable of downloading updated plugins/providers.
|
28
|
+
|
29
|
+
|
1
30
|
## 0.9.2 (Aug 11, 2019)
|
2
31
|
|
3
32
|
BACKWARDS INCOMPATIBILITIES:
|
data/README.md
CHANGED
@@ -106,7 +106,6 @@ $ bin/covalence spec
|
|
106
106
|
```
|
107
107
|
|
108
108
|
To run the Rspec test locally without container, you will need to install the following:
|
109
|
-
* prefixout -- https://github.com/WhistleLabs/prefixout
|
110
109
|
* sops -- https://github.com/mozilla/sops
|
111
110
|
|
112
111
|
### UAT
|
@@ -502,7 +501,6 @@ You will probably need the following packages installed locally
|
|
502
501
|
- Terraform
|
503
502
|
- Packer
|
504
503
|
- Sops
|
505
|
-
- [prefixout](https://github.com/unifio/prefixout/releases)
|
506
504
|
|
507
505
|
Execute the following to build the gem:
|
508
506
|
|
data/lib/covalence.rb
CHANGED
@@ -17,6 +17,7 @@ module Covalence
|
|
17
17
|
# TODO: could use better naming
|
18
18
|
PACKER = File.absolute_path(File.join(WORKSPACE, (ENV['COVALENCE_PACKER_DIR'] || '.')))
|
19
19
|
TERRAFORM = File.absolute_path(File.join(WORKSPACE, (ENV['COVALENCE_TERRAFORM_DIR'] || '.')))
|
20
|
+
STACK_EXPORT = File.absolute_path(File.join(WORKSPACE, (ENV['COVALENCE_STACK_EXPORT_DIR'] || './stack-exports')))
|
20
21
|
TEST_ENVS = (ENV['COVALENCE_TEST_ENVS'] || "").split(',')
|
21
22
|
# Reserved namespace including default ci and spec
|
22
23
|
RESERVED_NS = [(ENV['COVALENCE_RESERVED_NAMESPACE'] || "").split(','), 'ci', 'spec', 'sops']
|
@@ -24,6 +25,7 @@ module Covalence
|
|
24
25
|
TERRAFORM_CMD = ENV['TERRAFORM_CMD'] || "terraform"
|
25
26
|
TERRAFORM_VERSION = ENV['TERRAFORM_VERSION'] || `#{TERRAFORM_CMD} version`.split("\n", 2)[0].gsub('Terraform v','')
|
26
27
|
TERRAFORM_PLUGIN_CACHE = File.absolute_path("#{ENV['TF_PLUGIN_CACHE_DIR']}/linux_amd64" || "#{ENV['HOME']}/.terraform.d/plugin-cache/linus_amd64")
|
28
|
+
TERRAFORM_GET_PLUGINS = (ENV['COVALENCE_TERRAFORM_GET_PLUGINS'] || "true") =~ (/(true|t|yes|y|1)$/i)
|
27
29
|
|
28
30
|
PACKER_CMD = ENV['PACKER_CMD'] || "packer"
|
29
31
|
|
@@ -77,9 +77,7 @@ module Covalence
|
|
77
77
|
# so when the parent dies, child will know to terminate itself.
|
78
78
|
Signal.trap("INT") { logger.info "Trapped Ctrl-c. Disable parent process from exiting, orphaning the child fork below which may or may not work" }
|
79
79
|
wait_thread = nil
|
80
|
-
|
81
|
-
whole_cmd=['prefixout', '-p', "#{prefix} ", '--'].concat(run_cmd.split)
|
82
|
-
Open3.popen3(env, *whole_cmd, :chdir=>workdir) do |stdin, stdout, stderr, wait_thr|
|
80
|
+
Open3.popen3(env, *run_cmd, :chdir=>workdir) do |stdin, stdout, stderr, wait_thr|
|
83
81
|
mappings = { stdin_io => stdin, stdout => stdout_io, stderr => stderr_io }
|
84
82
|
wait_thread = wait_thr
|
85
83
|
|
@@ -48,7 +48,7 @@ module Covalence
|
|
48
48
|
if ENV['TF_PLUGIN_LOCAL'] == 'true'
|
49
49
|
cmd = [Covalence::TERRAFORM_CMD, "init", "-get-plugins=false", "-get=false", "-input=false", "-plugin-dir=#{Covalence::TERRAFORM_PLUGIN_CACHE}"]
|
50
50
|
else
|
51
|
-
cmd = [Covalence::TERRAFORM_CMD, "init", "-get-plugins
|
51
|
+
cmd = [Covalence::TERRAFORM_CMD, "init", "-get-plugins=#{Covalence::TERRAFORM_GET_PLUGINS ? 'true' : 'false'}", "-get=false", "-input=false"]
|
52
52
|
end
|
53
53
|
|
54
54
|
output = PopenWrapper.run(
|
@@ -51,19 +51,19 @@ module Covalence
|
|
51
51
|
File.open("#{path}/covalence-inputs.tfvars",'w') {|f| f.write(config)}
|
52
52
|
elsif type == "packer"
|
53
53
|
config = Hash.new
|
54
|
-
inputs.each do |name, input|
|
55
|
-
config[name] = input
|
54
|
+
inputs.values.map(&:to_command_hash_elements).each do |name, input|
|
55
|
+
config["#{name}"] = input
|
56
56
|
end
|
57
57
|
config_json = JSON.generate(config)
|
58
|
-
logger.info "\nStack inputs:\n\n#{config_json}"
|
59
|
-
File.open(
|
58
|
+
logger.info "path: #{path} module_path: #{module_path}\nStack inputs:\n\n#{config_json}"
|
59
|
+
File.open("#{path}/covalence-inputs.json",'w') {|f| f.write(config_json)}
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def materialize_state_inputs(store: state_stores.first)
|
63
|
+
def materialize_state_inputs(store: state_stores.first, path: '.')
|
64
64
|
config = store.get_config
|
65
65
|
logger.info "\nState store configuration:\n\n#{config}"
|
66
|
-
File.open(
|
66
|
+
File.open("#{path}/covalence-state.tf",'w') {|f| f.write(config)}
|
67
67
|
end
|
68
68
|
|
69
69
|
def logger
|
@@ -62,6 +62,14 @@ module Covalence
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
# :reek:TooManyStatements
|
66
|
+
def packer_stack_export()
|
67
|
+
packer_stack_export_init(File.expand_path(File.join(Covalence::STACK_EXPORT,'packer',stack.full_name))).each do |stackdir|
|
68
|
+
populate_workspace(stackdir)
|
69
|
+
stack.materialize_cmd_inputs(stackdir)
|
70
|
+
logger.info "Exported to #{stackdir}:"
|
71
|
+
end
|
72
|
+
end
|
65
73
|
private
|
66
74
|
attr_reader :template_path, :stack
|
67
75
|
|
@@ -97,6 +105,23 @@ module Covalence
|
|
97
105
|
args.flatten.compact.reject(&:empty?).map(&:strip)
|
98
106
|
end
|
99
107
|
|
108
|
+
# :reek:BooleanParameter
|
109
|
+
def packer_stack_export_init(stackdir, dry_run: false, verbose: true)
|
110
|
+
if(File.exist?(stackdir))
|
111
|
+
logger.info "Deleting before export: #{stackdir}"
|
112
|
+
FileUtils.rm_rf(stackdir, {
|
113
|
+
noop: dry_run,
|
114
|
+
verbose: verbose,
|
115
|
+
secure: true,
|
116
|
+
})
|
117
|
+
end
|
118
|
+
logger.info "Creating stack directory: #{stackdir}"
|
119
|
+
FileUtils.mkdir_p(stackdir, {
|
120
|
+
noop: dry_run,
|
121
|
+
verbose: verbose,
|
122
|
+
})
|
123
|
+
end
|
124
|
+
|
100
125
|
def logger
|
101
126
|
Covalence::LOGGER
|
102
127
|
end
|
@@ -44,6 +44,18 @@ module Covalence
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
# :reek:TooManyStatements
|
48
|
+
def stack_export
|
49
|
+
stack_export_init(File.expand_path(File.join(Covalence::STACK_EXPORT,'terraform',stack.full_name))).each do |stackdir|
|
50
|
+
populate_workspace(stackdir)
|
51
|
+
stack.materialize_state_inputs(path: stackdir)
|
52
|
+
TerraformCli.terraform_get(path=@path, workdir=stackdir)
|
53
|
+
TerraformCli.terraform_init(path: @path, workdir: stackdir)
|
54
|
+
stack.materialize_cmd_inputs(stackdir)
|
55
|
+
logger.info "Exported to #{stackdir}:"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
47
59
|
# :reek:TooManyStatements
|
48
60
|
def stack_verify(tmpdir)
|
49
61
|
return false if !TerraformCli.terraform_check_style(@path)
|
@@ -229,6 +241,23 @@ module Covalence
|
|
229
241
|
end
|
230
242
|
end
|
231
243
|
|
244
|
+
# :reek:BooleanParameter
|
245
|
+
def stack_export_init(stackdir, dry_run: false, verbose: true)
|
246
|
+
if(File.exist?(stackdir))
|
247
|
+
logger.info "Deleting before export: #{stackdir}"
|
248
|
+
FileUtils.rm_rf(stackdir, {
|
249
|
+
noop: dry_run,
|
250
|
+
verbose: verbose,
|
251
|
+
secure: true,
|
252
|
+
})
|
253
|
+
end
|
254
|
+
logger.info "Creating stack directory: #{stackdir}"
|
255
|
+
FileUtils.mkdir_p(stackdir, {
|
256
|
+
noop: dry_run,
|
257
|
+
verbose: verbose,
|
258
|
+
})
|
259
|
+
end
|
260
|
+
|
232
261
|
def logger
|
233
262
|
Covalence::LOGGER
|
234
263
|
end
|
@@ -126,6 +126,12 @@ module Covalence
|
|
126
126
|
custom_opts = Slop.parse(get_runtime_args, { suppress_errors: true, banner: false })
|
127
127
|
packer_tasks.context_validate(target_args, custom_opts.args)
|
128
128
|
end
|
129
|
+
|
130
|
+
desc "Export the #{stack_name} stack of the #{environment_name} environment to #{Covalence::STACK_EXPORT}/packer"
|
131
|
+
task generate_rake_taskname(environment_name, stack_name, "packer_stack_export") do
|
132
|
+
packer_tasks.packer_stack_export()
|
133
|
+
end
|
134
|
+
|
129
135
|
end
|
130
136
|
|
131
137
|
# :reek:TooManyStatements
|
@@ -164,6 +170,12 @@ module Covalence
|
|
164
170
|
task generate_rake_taskname(environment_name, stack_name, "shell") do
|
165
171
|
tf_tasks.stack_shell
|
166
172
|
end
|
173
|
+
|
174
|
+
desc "Export the #{stack_name} stack of the #{environment_name} environment to #{Covalence::STACK_EXPORT}/terraform"
|
175
|
+
task generate_rake_taskname(environment_name, stack_name, "stack_export") do
|
176
|
+
tf_tasks.stack_export
|
177
|
+
end
|
178
|
+
|
167
179
|
end
|
168
180
|
|
169
181
|
# :reek:TooManyStatements
|
data/lib/covalence/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: covalence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Unif.io
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|