lambda-version-manager 0.0.13 → 0.0.14
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/bin/lambda-version-manager +3 -2
- data/lib/deployer.rb +14 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b74f08aa1f3d28d495ce5ed45725e11fdd99233
|
4
|
+
data.tar.gz: 81d3e4031ea100cd5713242ca6273a6c93a9d35c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e7d3aabd312942d9edd74d22247abcb104c0bf7e8a6c20c5efdb8fc7836f4b0c8714759e267714d50b1ed9bbce383585e0e1f7e17ac417f2cfb46ec56396186
|
7
|
+
data.tar.gz: b7744d9a396c49c9c17fc0ea77c203bfd3b4df9c452d48ed714243014403be1172cd8ec2eaf0b523ef738cefeebe3b8f7b3407272af676ef1c8269e34e4f19fe
|
data/bin/lambda-version-manager
CHANGED
@@ -14,6 +14,7 @@ class GeneratorCLI < ::Thor
|
|
14
14
|
option 'lambda', banner: 'LAMBDA', type: :string, desc: 'Deploy lambdas with this name'
|
15
15
|
option 'account', banner: 'ACCOUNT', type: :string, desc: 'Account to deploy to', :required => true
|
16
16
|
option 'version_map_file', banner: 'VERSION_MAP_FILE', type: :string, desc: 'A java properties file mapping artifacts to update to version'
|
17
|
+
option 'deploy_all', banner: 'DEPLOY_ALL', type: :boolean, desc: 'Ignore the history therefore deploy everything included in the filter', default: false
|
17
18
|
|
18
19
|
def deploy
|
19
20
|
opts = validate_deploy(options)
|
@@ -21,11 +22,11 @@ class GeneratorCLI < ::Thor
|
|
21
22
|
#for each x=y pair we need to call
|
22
23
|
File.readlines(options['version_map_file']).each do |line|
|
23
24
|
array = line.split("=")
|
24
|
-
deployer = Deployer.new(opts['project_path'], opts['account'], array[0].strip)
|
25
|
+
deployer = Deployer.new(opts['deploy_all'], opts['project_path'], opts['account'], array[0].strip)
|
25
26
|
deployer.deploy(opts['environments'])
|
26
27
|
end
|
27
28
|
else
|
28
|
-
deployer = Deployer.new(opts['project_path'], opts['account'], opts['artifact'], opts['lambda'])
|
29
|
+
deployer = Deployer.new(opts['deploy_all'], opts['project_path'], opts['account'], opts['artifact'], opts['lambda'])
|
29
30
|
deployer.deploy(opts['environments'])
|
30
31
|
end
|
31
32
|
end
|
data/lib/deployer.rb
CHANGED
@@ -9,8 +9,10 @@ class Deployer
|
|
9
9
|
attr_accessor :lambda
|
10
10
|
attr_accessor :artifact
|
11
11
|
attr_accessor :environments
|
12
|
+
attr_accessor :deploy_all
|
12
13
|
|
13
|
-
def initialize(project_path, account, artifact=nil, lambda=nil)
|
14
|
+
def initialize(deploy_all, project_path, account, artifact=nil, lambda=nil)
|
15
|
+
@deploy_all = deploy_all
|
14
16
|
@project_path = project_path
|
15
17
|
@account = account
|
16
18
|
@project = Project.new("#{project_path}")
|
@@ -48,7 +50,13 @@ class Deployer
|
|
48
50
|
env_region_map = project.env_region_map
|
49
51
|
#Filter by account as the primary owner of envs
|
50
52
|
lambda_env_map = project.get_lambdas
|
51
|
-
|
53
|
+
unless deploy_all
|
54
|
+
lambda_env_map = diff_projects(lambda_env_map)
|
55
|
+
if lambda_env_map.empty?
|
56
|
+
puts "No lambdas have been changed, skipping deploy"
|
57
|
+
return
|
58
|
+
end
|
59
|
+
end
|
52
60
|
lambda_env_map = get_deployable_lambdas(lambda_env_map)
|
53
61
|
environments ||= project.environments
|
54
62
|
account_env_map.each do |env|
|
@@ -66,8 +74,8 @@ class Deployer
|
|
66
74
|
puts "S3 Key: #{s3_key}"
|
67
75
|
client.update_function_code(lambda_name,s3_bucket,s3_key)
|
68
76
|
end
|
77
|
+
archive_project(env)
|
69
78
|
end
|
70
|
-
archive_project
|
71
79
|
end
|
72
80
|
|
73
81
|
|
@@ -88,13 +96,10 @@ class Deployer
|
|
88
96
|
end
|
89
97
|
end
|
90
98
|
|
91
|
-
def archive_project
|
92
|
-
|
93
|
-
FileUtils.remove_dir("#{project_path}/.history/environments")
|
94
|
-
FileUtils.remove_dir("#{project_path}/.history/config")
|
95
|
-
end
|
99
|
+
def archive_project(environment)
|
100
|
+
FileUtils.mkpath("#{project_path}/.history/")
|
96
101
|
FileUtils.copy_entry("#{project_path}/config","#{project_path}/.history/config")
|
97
|
-
FileUtils.copy_entry("#{project_path}/environments","#{project_path}/.history/environments")
|
102
|
+
FileUtils.copy_entry("#{project_path}/environments/#{environment}.yaml","#{project_path}/.history/environments/#{environment}.yaml")
|
98
103
|
end
|
99
104
|
|
100
105
|
def parse_archive
|
@@ -103,9 +108,6 @@ class Deployer
|
|
103
108
|
end
|
104
109
|
|
105
110
|
def diff_projects(new_project)
|
106
|
-
unless Dir.exist?("#{project_path}/.history/")
|
107
|
-
return new_project
|
108
|
-
end
|
109
111
|
historic = parse_archive
|
110
112
|
historic.each do |environment, lambdas|
|
111
113
|
lambdas.each do |lambda, configs|
|