prima-twig 0.35.0 → 0.36.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/bin/twig-feature +80 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff7487628271433b14f1e490c6df78e3d4e7908c
|
4
|
+
data.tar.gz: 8fb80cb0f4c8f593c0335dc84d2f24fa4a1e122b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61957a5f710a1c6fca415c7d19fdd0881af732fe68e914f0aa71644b6d836d01c4d44bda63b17fea7ab1bbe0c3c22661a3b4ab9602efdafb6022a286b3413b8a
|
7
|
+
data.tar.gz: 47b16a8c48cfc1bb86005932299244364c0804dada3250c51cc62301d0ef466c6bf50d8c0db6c97c55e2dd9e50085f269c21ed1eaa9289a2454660680958b9b4
|
data/bin/twig-feature
CHANGED
@@ -23,6 +23,7 @@ class Release
|
|
23
23
|
@ecs = Aws::ECS::Client.new
|
24
24
|
@batch = Aws::Batch::Client.new
|
25
25
|
@asg = Aws::AutoScaling::Client.new
|
26
|
+
@s3 = Aws::S3::Client.new
|
26
27
|
@s3_bucket = 'prima-artifacts'
|
27
28
|
@artifact_path = '/tmp/prima-artifact.zip'
|
28
29
|
@import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-UDIDEVPA4H7Q:1'
|
@@ -55,6 +56,22 @@ class Release
|
|
55
56
|
start_feature!
|
56
57
|
when 'finish'
|
57
58
|
finish_feature!
|
59
|
+
when 'qainit'
|
60
|
+
abort('Non sei nella cartella di qainit') unless Dir.pwd.match 'qainit$'
|
61
|
+
if ['terminate', 'stop', 'shutdown', 'halt', 'destroy'].include? args[1]
|
62
|
+
qainit_deploy_update! 'update'
|
63
|
+
elsif 'update' == args[1]
|
64
|
+
qainit_deploy_update! 'shutdown'
|
65
|
+
elsif 'read' == args[1]
|
66
|
+
qainit_read_config! args[2]
|
67
|
+
else
|
68
|
+
if args[1]
|
69
|
+
select_branches(args[1])
|
70
|
+
else
|
71
|
+
select_branches
|
72
|
+
end
|
73
|
+
qainit_deploy!
|
74
|
+
end
|
58
75
|
when 'deploy'
|
59
76
|
abort('Non sei nella cartella di artemide') unless Dir.pwd.match 'artemide$'
|
60
77
|
if ['terminate', 'stop', 'shutdown', 'halt', 'destroy'].include? args[1]
|
@@ -394,6 +411,69 @@ class Release
|
|
394
411
|
output "Finito!".green
|
395
412
|
end
|
396
413
|
|
414
|
+
def qainit_deploy!
|
415
|
+
output 'Inserisci la feature a cui si riferisce il QA: '
|
416
|
+
feature_number = String(STDIN.gets)
|
417
|
+
|
418
|
+
`git checkout master && git checkout -b #{feature_number}`
|
419
|
+
|
420
|
+
branches = ''
|
421
|
+
|
422
|
+
@projects.each_key do |project_key|
|
423
|
+
if @projects[project_key][:revision]
|
424
|
+
branches += "#{project_key}:#{@projects[project_key][:name]}:#{@projects[project_key][:revision]}:#{@projects[project_key][:default_branch]}\n"
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
File.open('branch_names', 'w') { |file| file.write(branches) }
|
429
|
+
|
430
|
+
`git add branch_names && \
|
431
|
+
git commit -m '#{feature_number}' && \
|
432
|
+
git push --set-upstream origin #{feature_number}`
|
433
|
+
end
|
434
|
+
|
435
|
+
def qainit_deploy_update!(action)
|
436
|
+
# leggiamo i nomi dei branch
|
437
|
+
`git branch -a | grep remotes/ | grep -v HEAD | sed 's/ remotes\\/origin\\///g'`
|
438
|
+
# stampiamo la lista
|
439
|
+
chosen_branch = choose do |menu|
|
440
|
+
case action
|
441
|
+
when "update"
|
442
|
+
menu.prompt = "Scegli il QA che vuoi aggiornare: ".cyan
|
443
|
+
when "shutdown"
|
444
|
+
menu.prompt = "Scegli il QA che vuoi spegnere: ".cyan
|
445
|
+
end
|
446
|
+
menu.shell = true
|
447
|
+
branches.each do |branch|
|
448
|
+
msg = branch.light_blue
|
449
|
+
menu.choice(msg) { branch }
|
450
|
+
end
|
451
|
+
end
|
452
|
+
# checkout master, checkout branch, pull branch, push sul branch con commit vuoto
|
453
|
+
`git checkout master && git checkout #{chosen_branch} && git pull && git commit -m '#{action}' --allow-empty`
|
454
|
+
end
|
455
|
+
|
456
|
+
def qainit_read_config!
|
457
|
+
File.open('branch_names', 'r') do |file|
|
458
|
+
file.each_line do |line|
|
459
|
+
project = line.split(':')
|
460
|
+
@projects[project[0]] = {:name=> project[1], :revision=> project[2], :default_branch=> project[3]}
|
461
|
+
end
|
462
|
+
end
|
463
|
+
get_s3_config_files
|
464
|
+
deploy_feature!
|
465
|
+
end
|
466
|
+
|
467
|
+
def get_s3_config_files
|
468
|
+
# manteniamo la struttura per lanciarlo facilmente anche da locale
|
469
|
+
`mkdir -p cloudformation/stacks/task cloudformation/stacks/route53 cloudformation/stacks/asg cloudformation/stacks/alb`
|
470
|
+
@s3.get_object({bucket: 'prima-deploy', key: 'cloudformation/stacks/task/db.yml', response_target: 'cloudformation/stacks/task/db.yml'})
|
471
|
+
@s3.get_object({bucket: 'prima-deploy', key: 'cloudformation/stacks/route53/qa.yml', response_target: 'cloudformation/stacks/route53/qa.yml'})
|
472
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/asg/ecs-asg-allinone.yml', response_target: 'cloudformation/stacks/asg/ecs-asg-allinone.yml'})
|
473
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/ecs-cluster.yml', response_target: 'cloudformation/stacks/ecs-cluster.yml'})
|
474
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/alb/ecs-alb-public.yml', response_target: 'cloudformation/stacks/alb/ecs-alb-public.yml'})
|
475
|
+
end
|
476
|
+
|
397
477
|
def deploy_feature!
|
398
478
|
`git pull && git submodule init && git submodule update`
|
399
479
|
if deploy_crash?
|
@@ -1987,18 +2067,14 @@ class Release
|
|
1987
2067
|
},
|
1988
2068
|
count: 1
|
1989
2069
|
})
|
1990
|
-
pp resp
|
1991
2070
|
output "Attendo che i DB vengano importati...\n".yellow
|
1992
2071
|
stopped_at = nil
|
1993
2072
|
while stopped_at.nil?
|
1994
|
-
pp "stopped_at == nil"
|
1995
2073
|
unless resp.tasks[0].nil?
|
1996
|
-
pp "describe tasks..."
|
1997
2074
|
resp = @ecs.describe_tasks({
|
1998
2075
|
cluster: @ecs_cluster_name,
|
1999
2076
|
tasks: [resp.tasks[0].task_arn]
|
2000
2077
|
})
|
2001
|
-
pp resp
|
2002
2078
|
end
|
2003
2079
|
stopped_at = resp.tasks[0].stopped_at unless resp.tasks[0].nil?
|
2004
2080
|
sleep_seconds = 10
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prima-twig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Giachino
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2018-05-
|
16
|
+
date: 2018-05-22 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: aws-sdk
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.6.
|
217
|
+
rubygems_version: 2.6.11
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: The Prima twig toolbelt
|