prima-twig 0.36.74 → 0.36.75

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-feature +61 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4b7399afbd2ce9d6e7c3817163faf41048eec97
4
- data.tar.gz: 4b4eea625b2ff94dfb42652ef4b2005582018584
3
+ metadata.gz: 7af94ef9a5e5afe0b7546c2203ca8058f92eb7ef
4
+ data.tar.gz: 35424d0078fafbafbdd87f289ab52ecabe286d62
5
5
  SHA512:
6
- metadata.gz: 44e8e1963160fa4546930f404ae9613cfac69b0d664f1fad7f7433d03bf9d2876cd256438a7b09b5036dfffc26e5647c2d006667082e3e6b5644e94e87cbbe2f
7
- data.tar.gz: 7654b11925a16ce0fbf861ac097051ed2a28d59c81b049e3f40ca9fb8043dafac1c0c63ce3b899e05f5c530c1a22750fb9f96d836886eab1e8bf713b83076ce8
6
+ metadata.gz: a76d270c167b2cc70dee9bc03ac837ae80d1b5d85623360e296054017a03710d77507f54528fe67b4efd8f159c2caeb4e90d5d64911f7c9c29d512e3c0a29978
7
+ data.tar.gz: 8747ad9380f083f303d4704bc487fbac9a2143a8497f7e14a8c4d1269d0a18b5c0661f80d42bb0ea1f405d9fee9c49e28cfe3630337f244b779d8107ccad75e7
data/bin/twig-feature CHANGED
@@ -66,7 +66,7 @@ class Release
66
66
  elsif 'update' == args[1]
67
67
  qainit_deploy_update!
68
68
  elsif 'read' == args[1]
69
- qainit_read_config!
69
+ qainit_read_config! args[2]
70
70
  else
71
71
  if args[1]
72
72
  select_branches(args[1])
@@ -502,7 +502,53 @@ class Release
502
502
  `git commit --allow-empty -m 'shutdown' && git push && git checkout master`
503
503
  end
504
504
 
505
- def qainit_read_config!
505
+ def qainit_drone_shutdown!
506
+ output "Recupero le informazioni sui QA attivi..."
507
+ stack_list, envs = get_stacks
508
+
509
+ env_hash = calculate_deploy_id
510
+
511
+ cluster_stack_name = nil
512
+ stacks_to_delete = []
513
+ stack_list.each do |stack|
514
+ if stack.stack_name.match(/#{env_hash}$/)
515
+ if stack.stack_name.match(/ecs-cluster/)
516
+ cluster_stack_name = stack.stack_name
517
+ else
518
+ break unless stack.stack_name.match(/#{env_hash}$/)
519
+ stacks_to_delete.push(stack.stack_name)
520
+ delete_stack(stack.stack_name)
521
+ end
522
+ end
523
+ end
524
+
525
+ cluster_stack_name = "ecs-cluster-#{env_hash}"
526
+ aggregator_enabled = get_stack_tags(cluster_stack_name).detect do |tag|
527
+ tag.key === "hostname_pattern_priority" and tag.value === "1"
528
+ end.is_a?(Aws::CloudFormation::Types::Tag)
529
+
530
+ if aggregator_enabled
531
+ dns_to_staging()
532
+ end
533
+
534
+ # Se non ha finito di cancellare le altre non si puo' cancellare il cluster
535
+ output "Attendo 10 secondi per poter eliminare il cluster ECS"
536
+
537
+ while stacks_to_delete.length > 0
538
+ sleep 13
539
+ stacks_to_delete.each do |stack_name|
540
+ stacks_to_delete = stacks_to_delete - [stack_name] unless stack_exists?(stack_name)
541
+ end
542
+ output "Stack ancora attivi: #{stacks_to_delete.length.to_s}. Attendo altri 10 secondi per eliminare il cluster ECS"
543
+ end
544
+
545
+ delete_stack(cluster_stack_name)
546
+ delete_stack(@stack_name_alb) if envs.length < 2
547
+ delete_stack(@stack_name_alb_ws) if envs.length < 2
548
+ output "Finito!".green
549
+ end
550
+
551
+ def qainit_read_config!(action)
506
552
  File.open('branch_names', 'r') do |file|
507
553
  file.each_line do |line|
508
554
  project = line.split(':')
@@ -511,7 +557,11 @@ class Release
511
557
  end
512
558
  get_s3_config_files
513
559
  @qainit = true
514
- deploy_feature!
560
+ if ('shutdown' == action)
561
+ qainit_drone_shutdown!
562
+ else
563
+ deploy_feature!
564
+ end
515
565
  end
516
566
 
517
567
  def get_s3_config_files
@@ -524,10 +574,9 @@ class Release
524
574
  @s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/alb/ecs-alb-public.yml', response_target: 'cloudformation/stacks/alb/ecs-alb-public.yml'})
525
575
  end
526
576
 
527
- def deploy_feature!
528
- `git pull && git submodule init && git submodule update`
577
+ def calculate_deploy_id
529
578
  if deploy_crash?
530
- deploy_id = Digest::MD5.hexdigest(
579
+ Digest::MD5.hexdigest(
531
580
  @projects["prima"][:name] +
532
581
  @projects["backoffice"][:name] +
533
582
  @projects["urania"][:name] +
@@ -544,7 +593,7 @@ class Release
544
593
  @projects["activia"][:name]
545
594
  )
546
595
  else
547
- deploy_id = Digest::MD5.hexdigest(
596
+ Digest::MD5.hexdigest(
548
597
  @projects["prima"][:name] +
549
598
  @projects["backoffice"][:name] +
550
599
  @projects["urania"][:name] +
@@ -560,6 +609,11 @@ class Release
560
609
  @projects["activia"][:name]
561
610
  )
562
611
  end
612
+ end
613
+
614
+ def deploy_feature!
615
+ `git pull && git submodule init && git submodule update`
616
+ deploy_id = calculate_deploy_id
563
617
  unless @qainit
564
618
  @projects.each_key do |project_key|
565
619
  if @projects[project_key][:revision]
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.36.74
4
+ version: 0.36.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino