prima-twig 0.37.5 → 0.37.6

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 +59 -289
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69e220e449bb42b6645c55f424302b9ab25d3607
4
- data.tar.gz: 159863b6bba37056272c929fde78bb8ac9caf9b4
3
+ metadata.gz: 4d961ad6634eafe94f6abbcca37777211883c7ee
4
+ data.tar.gz: 25c4205391692d5f9c77c4fd04e8b2b4946c9ac4
5
5
  SHA512:
6
- metadata.gz: 2ef9635657a78d1852d484c2016e51cef1ca65f20cdcac55c7f3016980a4932cef072ba52419bac496771856f9ad16f721bef5d6d11d9d0fadd0436774fcb1b8
7
- data.tar.gz: 3e0886f5067dcfb1ea2d5678eda75896eb53dce2e621138b714790b7e44109201573e12a1fc245d489a778f34533ff44900ec5f04d3bbb2a1737cbc6118ab831
6
+ metadata.gz: 9c4796739745b1d9368c8f441be8f5dc1874d1655d953d995eec8b719e58da8ab0fd4aded0e324222e2cb6db1ad4e6518f6242c6b02359e49c7ca21b04127d17
7
+ data.tar.gz: c02f614527122a168d89827c34bd6391d8a242a2eea34dd9f5369ba485b79463b415489386535f07f96b0558860bfb5b19d3da4c5a6b433cb95e65dc01b82790
@@ -67,8 +67,6 @@ class Release
67
67
  qainit_deploy_update!
68
68
  elsif 'read' == args[1]
69
69
  qainit_read_config! args[2]
70
- elsif 'minimal' == args[1]
71
- qainit_minimal_deploy! args[2]
72
70
  else
73
71
  if args[1]
74
72
  select_branches(args[1])
@@ -460,40 +458,9 @@ class Release
460
458
  git checkout master`
461
459
  end
462
460
 
463
- def qainit_minimal_deploy!(project)
464
- abort('Gli unici progetti permessi sono prima e crash') unless ['prima', 'crash'].include? project
465
- project_definition = choose_branch_to_deploy(project)
466
-
467
- `git checkout master && git pull && git remote prune origin`
468
-
469
- default_name = get_default_name @projects
470
- output "Inserisci la feature a cui si riferisce il QA: [#{default_name}]".cyan
471
- feature_number = String(STDIN.gets.chomp)
472
- feature_number = default_name if feature_number.empty?
473
-
474
- if `git branch -l | grep #{feature_number}`.size > 0
475
- `git checkout #{feature_number} && git pull`
476
- else
477
- `git checkout -b #{feature_number}`
478
- end
479
-
480
- # così recupero le informazioni sul branch, poi vado a scrivere il file branch_names con una sola riga
481
- branch = "#{project}:#{project_definition[:name]}:#{project_definition[:revision]}:#{project_definition[:default_branch]}"
482
-
483
- File.open('branch_names', 'w') { |file| file.write(branch) }
484
-
485
- `git add projects && \
486
- git add branch_names && \
487
- git commit -m 'minimal_#{feature_number}' && \
488
- git push --set-upstream origin #{feature_number} && \
489
- git checkout master`
490
- end
491
-
492
461
  def qainit_deploy_update!
493
- `git checkout master && git pull`
494
- # cancelliamo tutti i branch che non sono più sul repo remoto
495
- `git fetch -p && for branch in \`git branch -vv | grep ': gone]' | awk '{print $1}'\`; do git branch -D $branch; done`
496
- # leggiamo i nomi dei branch superstiti
462
+ `git checkout master && git pull && git remote prune origin`
463
+ # leggiamo i nomi dei branch
497
464
  former_branches = `git branch -a | grep remotes/ | grep -v HEAD | sed 's/ remotes\\/origin\\///g'`.split "\n"
498
465
  # stampiamo la lista
499
466
  chosen_branch = choose do |menu|
@@ -624,11 +591,8 @@ class Release
624
591
  end
625
592
  get_s3_config_files
626
593
  @qainit = true
627
- case action
628
- when 'shutdown'
594
+ if ('shutdown' == action)
629
595
  qainit_drone_shutdown!
630
- when 'minimal'
631
- qainit_drone_minimal_deploy!
632
596
  else
633
597
  deploy_feature!
634
598
  end
@@ -645,207 +609,39 @@ class Release
645
609
  end
646
610
 
647
611
  def calculate_deploy_id
648
- hashable = ''
649
- @projects.each_key do |project_key|
650
- if @projects[project_key][:name]
651
- hashable += @projects[project_key][:name]
652
- end
653
- end
654
- Digest::MD5.hexdigest(hashable)
655
- end
656
-
657
- def qainit_drone_minimal_deploy!
658
- #check whether it's prima or crash
659
- project = ''
660
- @projects.each_key do |project_key|
661
- if @projects[project_key][:revision]
662
- project = project_key
663
- git_checkout_version(project_key, @projects[project_key][:revision])
664
- end
665
- end
666
- deploy_id = calculate_deploy_id
667
- # servono 3 stack:
668
- #cluster-qa
669
- #asg
670
- #project
671
- @dns_record_identifier = deploy_id
672
- hostname_pattern_priority = hostname_pattern_priority()
673
- tags = [
674
- {
675
- key: project,
676
- value: @projects[project][:name]
677
- },
678
- {
679
- key: "hostname_pattern_priority",
680
- value: hostname_pattern_priority
681
- }
682
- ]
683
-
684
- cluster_stack_name = "ecs-cluster-qa-#{deploy_id}"
685
-
686
- if stack_exists?(cluster_stack_name)
687
- tags = get_stack_tags(cluster_stack_name)
688
- hostname_pattern_priority = tags.detect do |tag|
689
- tag.key == 'hostname_pattern_priority'
690
- end.value
691
- end
692
-
693
- create_cluster_stack(cluster_stack_name, tags) unless stack_exists?(cluster_stack_name)
694
- wait_for_stack_ready(cluster_stack_name) unless stack_ready?(cluster_stack_name)
695
-
696
- create_alb_stack(@stack_name_alb, "http") unless stack_exists?(@stack_name_alb)
697
- create_alb_stack(@stack_name_alb_ws, "websocket") unless stack_exists?(@stack_name_alb_ws)
698
-
699
- resp = @cf.describe_stack_resource({stack_name: cluster_stack_name, logical_resource_id: 'ECSCluster'})
700
- @ecs_cluster_name = resp.stack_resource_detail.physical_resource_id
701
-
702
- asg_stack_name = "ecs-asg-allinone-qa-#{deploy_id}"
703
- create_asg_stack(asg_stack_name, tags) unless stack_exists?(asg_stack_name)
704
-
705
- case project
706
- when 'prima'
707
- create_prima_artifact(@projects["prima"][:revision], @projects["prima"][:name], deploy_id, true) unless artifact_exists?('prima-artifacts-encrypted', "prima/#{@projects["prima"][:revision]}-#{deploy_id}.tar.gz")
708
- when 'crash'
709
- create_crash_artifact(@projects['crash'][:revision], deploy_id, true) unless !deploy_crash? || artifact_exists?('prima-artifacts-encrypted', "microservices/crash/#{@projects['crash'][:revision]}-#{deploy_id}-qa.tar.gz")
710
- end
711
-
712
- wait_for_stack_ready(@stack_name_alb) unless stack_ready?(@stack_name_alb)
713
- wait_for_stack_ready(@stack_name_alb_ws) unless stack_ready?(@stack_name_alb_ws)
714
-
715
- stack_name_route53 = "ecs-route53-qa-#{deploy_id}"
716
- stack_body = IO.read('cloudformation/stacks/route53/minimal_qa.yml') # creare
717
- parameters = [
718
- {
719
- parameter_key: "DnsRecordIdentifier",
720
- parameter_value: @dns_record_identifier
721
- },
722
- {
723
- parameter_key: "PrimaElbHostname",
724
- parameter_value: get_alb_host(@stack_name_alb)
725
- },
726
- {
727
- parameter_key: 'CrashElbHostname',
728
- parameter_value: get_alb_host(@stack_name_alb_ws)
729
- }
730
- ]
731
-
732
- create_stack(stack_name_route53, stack_body, parameters, tags) unless stack_exists?(stack_name_route53)
733
- wait_for_stack_ready(stack_name_route53) unless stack_ready?(stack_name_route53)
734
-
735
- case project
736
- when 'prima'
737
- stack_name_web = "ecs-task-web-qa-#{deploy_id}"
738
- git_checkout_version('prima', @projects["prima"][:revision])
739
- stack_body = IO.read('projects/prima/app/cloudformation/tasks/web.yml')
740
- parameters = [
741
- {
742
- parameter_key: "Environment",
743
- parameter_value: "staging"
744
- },
745
- {
746
- parameter_key: "ReleaseVersion",
747
- parameter_value: "#{@projects["prima"][:revision]}-#{deploy_id}"
748
- },
749
- {
750
- parameter_key: "TaskDesiredCount",
751
- parameter_value: "1"
752
- },
753
- {
754
- parameter_key: "ECSClusterName",
755
- parameter_value: @ecs_cluster_name
756
- },
757
- {
758
- parameter_key: "ALBShortName",
759
- parameter_value: "web-qa-#{deploy_id}"[0..31]
760
- },
761
- {
762
- parameter_key: "WebQaBaseHostname",
763
- parameter_value: "#{@dns_record_identifier}.qa.colaster.com"
764
- },
765
- {
766
- parameter_key: "HostnamePattern",
767
- parameter_value: "ww*-#{@dns_record_identifier}.qa.colaster.com"
768
- },
769
- {
770
- parameter_key: "HostnamePatternPriority",
771
- parameter_value: hostname_pattern_priority
772
- },
773
- {
774
- parameter_key: "HostnamePatternAggregatorPriority",
775
- parameter_value: (hostname_pattern_priority.to_i + 1).to_s
776
- }
777
- ]
778
- if stack_exists?(stack_name_web)
779
- cur_version = get_currently_deployed_version(stack_name_web)
780
- update_stack(stack_name_web, stack_body, parameters, tags) unless cur_version.include?(@projects["prima"][:revision])
781
- else
782
- create_stack(stack_name_web, stack_body, parameters, tags)
783
- end
784
- wait_for_stack_ready(stack_name_web) unless stack_ready?(stack_name_web)
785
- update_service_defaults(stack_name_web)
786
- prima_hostname = get_route53_hostname(stack_name_web)
787
-
788
- # chefare? col supervisor? non dovrebbe essere un problema, tanto le feature che vengono deployate nei qa minimali
789
- # dovrebbero essere relative solo al front end.
790
-
791
- projects_text = "
792
- > Prima url: https://#{prima_hostname}
793
- > Prima RI url: https://#{prima_hostname.sub("www", "wwwri")}
794
- > Supervisor url: http://#{ec2_ip_address(asg_stack_name)}:9001
795
- > SSH connection: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no githubUsername@#{ec2_ip_address(asg_stack_name)}\n"
796
-
797
- when 'crash'
798
- git_checkout_version('crash', @projects['crash'][:revision])
799
- stack_name_crash = "ecs-task-crash-qa-#{deploy_id}"
800
- stack_body = IO.read('projects/crash/deploy/task.yml')
801
- parameters = [
802
- {
803
- parameter_key: 'Environment',
804
- parameter_value: 'staging'
805
- },
806
- {
807
- parameter_key: 'ReleaseVersion',
808
- parameter_value: "#{@projects['crash'][:revision]}-#{deploy_id}"
809
- },
810
- {
811
- parameter_key: 'TaskDesiredCount',
812
- parameter_value: '1'
813
- },
814
- {
815
- parameter_key: 'ECSClusterName',
816
- parameter_value: @ecs_cluster_name
817
- },
818
- {
819
- parameter_key: 'ALBShortName',
820
- parameter_value: "crash-qa-#{deploy_id}"[0..31]
821
- },
822
- {
823
- parameter_key: 'HostnamePattern',
824
- parameter_value: "crash-#{@dns_record_identifier}.qa.colaster.com"
825
- },
826
- {
827
- parameter_key: 'HostnamePatternPriority',
828
- parameter_value: (hostname_pattern_priority.to_i + 10).to_s
829
- }
830
- ]
831
- if stack_exists?(stack_name_crash)
832
- cur_version = get_currently_deployed_version(stack_name_crash)
833
- update_stack(stack_name_crash, stack_body, parameters, tags) unless cur_version.include?(@projects["crash"][:revision])
834
- else
835
- create_stack(stack_name_crash, stack_body, parameters, tags)
836
- end
837
- wait_for_stack_ready(stack_name_crash) unless stack_ready?(stack_name_crash)
838
- update_service_defaults(stack_name_crash)
839
- deploy_crash? && crash_hostname = get_route53_hostname(stack_name_crash)
840
- projects_text = "
841
- > Crash url: https://#{crash_hostname}
842
- > SSH connection: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no githubUsername@#{ec2_ip_address(asg_stack_name)}\n"
843
- end
844
-
845
- output projects_text.cyan
846
- output "Deploy effettuato, everything is awesome!\n".green
847
- if @qainit
848
- qainit_write_output(projects_text, 'Indirizzi scritti su ')
612
+ if deploy_crash?
613
+ Digest::MD5.hexdigest(
614
+ @projects["prima"][:name] +
615
+ @projects["backoffice"][:name] +
616
+ @projects["urania"][:name] +
617
+ @projects["ermes"][:name] +
618
+ @projects["bburago"][:name] +
619
+ @projects["hal9000"][:name] +
620
+ @projects["fidaty"][:name] +
621
+ @projects["peano"][:name] +
622
+ @projects["rogoreport"][:name] +
623
+ @projects["assange"][:name] +
624
+ @projects["borat"][:name] +
625
+ @projects["bolla"][:name] +
626
+ @projects['crash'][:name] +
627
+ @projects["activia"][:name]
628
+ )
629
+ else
630
+ Digest::MD5.hexdigest(
631
+ @projects["prima"][:name] +
632
+ @projects["backoffice"][:name] +
633
+ @projects["urania"][:name] +
634
+ @projects["ermes"][:name] +
635
+ @projects["bburago"][:name] +
636
+ @projects["hal9000"][:name] +
637
+ @projects["fidaty"][:name] +
638
+ @projects["peano"][:name] +
639
+ @projects["rogoreport"][:name] +
640
+ @projects["assange"][:name] +
641
+ @projects["borat"][:name] +
642
+ @projects["bolla"][:name] +
643
+ @projects["activia"][:name]
644
+ )
849
645
  end
850
646
  end
851
647
 
@@ -1954,7 +1750,7 @@ class Release
1954
1750
  !@projects['crash'].empty? && (!@projects['crash'][:default_branch] || !@projects['crash'][:default_branch])
1955
1751
  end
1956
1752
 
1957
- def create_crash_artifact(revision, deploy_id, minimal = false)
1753
+ def create_crash_artifact(revision, deploy_id)
1958
1754
  output "Preparo l'artifact crash .zip\n".yellow
1959
1755
 
1960
1756
  git_checkout_version('crash', revision)
@@ -1974,49 +1770,26 @@ class Release
1974
1770
  if @qainit
1975
1771
  `mv docker-compose-ci.yml docker-compose.yml`
1976
1772
  exec_step 'prepare-docker-compose --directory crash && cp docker-compose-qainit.yml docker-compose.yml'
1977
- if minimal
1978
- [
1979
- 'docker-compose build web',
1980
- "docker-compose run -w $PWD -u root -e WS_ENDPOINT=#{ws_endpoint} -e GRAPHQL_ENDPOINT=#{frontend_endpoint} -e MIX_ENV=staging web \
1981
- '-c' 'sed -i \"s/crash-staging.prima.it/#{crash_qa_host}/g\" config/staging.exs && \
1982
- mix local.hex --force && mix hex.info && \
1983
- mix deps.get && \
1984
- cd assets && \
1985
- yarn --cache-folder ~/.cache/yarn && \
1986
- ./node_modules/.bin/elm-github-install && \
1987
- NODE_ENV=production sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
1988
- cd ../ && \
1989
- mix release.clean --implode --no-confirm && \
1990
- mix phx.digest && \
1991
- mix deps.clean --all && \
1992
- mix deps.get && \
1993
- mix compile && mix release --env=staging'",
1994
- 'docker-compose down'
1995
- ].each do |cmd|
1996
- execute_command cmd
1997
- end
1998
- else
1999
- [
2000
- 'docker-compose build web',
2001
- "docker-compose run -w $PWD -u root -e WS_ENDPOINT=#{ws_endpoint} -e GRAPHQL_ENDPOINT=#{frontend_endpoint} -e MIX_ENV=qa web \
2002
- '-c' 'sed -i \"s/web-qa-host/#{web_qa_host}/g\" config/qa.exs && \
2003
- sed -i \"s/crash-qa-host/#{crash_qa_host}/g\" config/qa.exs && \
2004
- mix local.hex --force && mix hex.info && \
2005
- mix deps.get && \
2006
- cd assets && \
2007
- yarn --cache-folder ~/.cache/yarn && \
2008
- ./node_modules/.bin/elm-github-install && \
2009
- NODE_ENV=production sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
2010
- cd ../ && \
2011
- mix release.clean --implode --no-confirm && \
2012
- mix phx.digest && \
2013
- mix deps.clean --all && \
2014
- mix deps.get && \
2015
- mix compile && mix release --env=qa'",
2016
- 'docker-compose down'
2017
- ].each do |cmd|
2018
- execute_command cmd
2019
- end
1773
+ [
1774
+ 'docker-compose build web',
1775
+ "docker-compose run -w $PWD -u root -e WS_ENDPOINT=#{ws_endpoint} -e GRAPHQL_ENDPOINT=#{frontend_endpoint} -e MIX_ENV=qa web \
1776
+ '-c' 'sed -i \"s/web-qa-host/#{web_qa_host}/g\" config/qa.exs && \
1777
+ sed -i \"s/crash-qa-host/#{crash_qa_host}/g\" config/qa.exs && \
1778
+ mix local.hex --force && mix hex.info && \
1779
+ mix deps.get && \
1780
+ cd assets && \
1781
+ yarn --cache-folder ~/.cache/yarn && \
1782
+ ./node_modules/.bin/elm-github-install && \
1783
+ NODE_ENV=production sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
1784
+ cd ../ && \
1785
+ mix release.clean --implode --no-confirm && \
1786
+ mix phx.digest && \
1787
+ mix deps.clean --all && \
1788
+ mix deps.get && \
1789
+ mix compile && mix release --env=qa'",
1790
+ 'docker-compose down'
1791
+ ].each do |cmd|
1792
+ execute_command cmd
2020
1793
  end
2021
1794
 
2022
1795
  cleanup_containers
@@ -2363,7 +2136,7 @@ class Release
2363
2136
  web_qa_host = get_route53_hostname(stack_name_web)
2364
2137
 
2365
2138
  stack_name_peano = "ecs-task-peano-qa-notneeded"
2366
- peano_qa_host = "#{get_route53_hostname(stack_name_peano)}:10041"
2139
+ peano_qa_host = "#{get_route53_hostname(stack_name_peano)}:10039"
2367
2140
 
2368
2141
  decrypt_secrets()
2369
2142
 
@@ -2595,7 +2368,7 @@ class Release
2595
2368
  Dir.chdir '../../'
2596
2369
  end
2597
2370
 
2598
- def create_prima_artifact(revision, branch_name, deploy_id, minimal = false)
2371
+ def create_prima_artifact(revision, branch_name, deploy_id)
2599
2372
  output "Preparo l'artifact prima .zip\n".yellow
2600
2373
 
2601
2374
  git_checkout_version('prima', revision)
@@ -2611,11 +2384,8 @@ class Release
2611
2384
  end
2612
2385
 
2613
2386
  backoffice_qa_host = get_route53_hostname("ecs-task-borat-qa-notneeded")
2614
- # backoffice-staging.prima.it
2615
2387
  web_qa_host = get_route53_hostname("ecs-task-web-qa-notneeded")
2616
- # staging.prima.it
2617
2388
  assange_qa_host = get_route53_hostname("ecs-task-assange-qa-notneeded")
2618
- # assange-staging.prima.it
2619
2389
 
2620
2390
  if @qainit
2621
2391
  exec_step 'mv docker-compose-ci.yml docker-compose.yml'
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.37.5
4
+ version: 0.37.6
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-06-26 00:00:00.000000000 Z
16
+ date: 2018-06-28 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: aws-sdk