prima-twig 0.52.2 → 0.53.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-feature +125 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3914957beb00a7caaee21784bea2b6ae4c7b925d247d035ba45af63f7e2951c8
4
- data.tar.gz: 5ed93b515e414dcec39eadfa23ec599c4e49a300a4ebf28a3afefb469dd9e7f8
3
+ metadata.gz: 4e7ed94315b823c77e7906ac0d7ad9d3e7314f8b9bee2a281182a4a724ef8f06
4
+ data.tar.gz: 8359144db9048c8777e38f14869038a49b50f87049450b5bccc7b6c1abf1969d
5
5
  SHA512:
6
- metadata.gz: 363d0ba3308ddc9de3adabadb41aa5d8ccf7d531e0aea9232c0c5b55b1f3b17c86c86e219d57c5934b0e55461076e65b3a5d2e286d504ee81c8fa451a6725802
7
- data.tar.gz: 9dad14322d5406be7a12dc66ebdb1ded7ade3e7038d8ac4743622609bc55620f741c938231a1187584b4f3e06d521647e67e1f0780440c9243e0546a29b1aac5
6
+ metadata.gz: da6d94d4bb4b70445609e5bf92d33cea327ea3357533b0196e25df695d199873959d78e121215cb6c4a0453db0601aa37922ad563ccd114ef2203c6a95111026
7
+ data.tar.gz: 371a6e947b3eb681eaa21f4f8802f1d9dd33e7b87a5196cc02280cc7f85e00e5ebb854e3748711d834030c57c172f2e58593c8b164e72617c0f33dc312e0913a
@@ -56,7 +56,8 @@ class Release
56
56
  'roger' => {},
57
57
  'rachele' => {},
58
58
  'leftorium' => {},
59
- 'pyxis-npm' => {}
59
+ 'pyxis-npm' => {},
60
+ 'starsky' => {}
60
61
  }
61
62
  @base_stack_name_alb = 'ecs-alb-http-public-qa-'
62
63
  @base_stack_name_alb_ws = 'ecs-alb-ws-public-qa-'
@@ -612,7 +613,7 @@ class Release
612
613
  output "Recupero le informazioni sui QA attivi..."
613
614
  stack_list, envs = get_stacks
614
615
 
615
- env_hash = "qa-" + calculate_deploy_id
616
+ env_hash = "qa-" + get_deploy_id
616
617
 
617
618
  cluster_stack_name = nil
618
619
  stacks_to_delete = []
@@ -706,8 +707,13 @@ class Release
706
707
  @s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/elb/alb-public-qa.yml', response_target: 'cloudformation/stacks/elb/alb-public-qa.yml'})
707
708
  end
708
709
 
709
- def calculate_deploy_id
710
- hash = Digest::MD5.hexdigest(ENV['DRONE_BRANCH'])
710
+ def get_deploy_id
711
+ if @deploy_id
712
+ @deploy_id
713
+ else
714
+ @deploy_id = Digest::MD5.hexdigest(ENV['DRONE_BRANCH'])
715
+ @deploy_id
716
+ end
711
717
  end
712
718
 
713
719
  def qainit_drone_minimal_deploy!
@@ -720,7 +726,7 @@ class Release
720
726
  git_checkout_version(project_key, @projects[project_key][:revision])
721
727
  end
722
728
  end
723
- deploy_id = calculate_deploy_id
729
+ deploy_id = get_deploy_id
724
730
 
725
731
  @git_branch = ENV['DRONE_BRANCH']
726
732
  @dns_record_identifier = deploy_id
@@ -764,7 +770,7 @@ class Release
764
770
  asg_stack_name = "ecs-asg-allinone-qa-#{deploy_id}"
765
771
  create_asg_stack(asg_stack_name, tags) unless stack_exists?(asg_stack_name)
766
772
 
767
- deploy_id = calculate_deploy_id
773
+ deploy_id = get_deploy_id
768
774
  create_pyxis_artifact(@projects["pyxis-npm"][:revision], deploy_id)
769
775
  create_prima_artifact(@projects["prima"][:revision], @projects["prima"][:name], deploy_id, true) unless artifact_exists?('prima-artifacts-encrypted', "prima/#{@projects["prima"][:revision]}.tar.gz")
770
776
 
@@ -872,7 +878,7 @@ class Release
872
878
  def deploy_feature!
873
879
  `git pull && git submodule init && git submodule update`
874
880
  @ami_id = get_ami_id("ecs-fleet-allinone-staging")
875
- deploy_id = calculate_deploy_id
881
+ deploy_id = get_deploy_id
876
882
  stack_name_alb = 'ecs-alb-http-public-qa-' + deploy_id[0..5]
877
883
  stack_name_alb_ws = 'ecs-alb-ws-public-qa-' + deploy_id[0..5]
878
884
  unless @qainit
@@ -896,8 +902,11 @@ class Release
896
902
  }
897
903
  ]
898
904
  @projects.each do |key, value|
899
- if key.to_s == 'crash'
905
+ case key.to_s
906
+ when 'crash'
900
907
  tags << { key: 'crash', value: @projects['crash'][:name] } if deploy_crash?
908
+ when 'starsky', 'hutch'
909
+ tags << { key: key.to_s, value: @projects[key.to_s][:name] } if deploy_starsky_hutch?
901
910
  else
902
911
  tags << { key: key, value: value[:name] }
903
912
  end
@@ -962,6 +971,7 @@ class Release
962
971
  create_activia_artifact(@projects["activia"][:revision]) unless artifact_exists?('prima-artifacts-encrypted', "microservices/activia/#{@projects["activia"][:revision]}-qa.tar.gz")
963
972
  create_leftorium_artifact(@projects["leftorium"][:revision]) unless artifact_exists?('prima-artifacts-encrypted', "microservices/leftorium/#{@projects["leftorium"][:revision]}-qa.tar.gz")
964
973
  create_skynet_artifact(@projects["skynet"][:revision]) unless artifact_exists?('prima-artifacts-encrypted', "microservices/skynet/#{@projects["skynet"][:revision]}-qa.tar.gz")
974
+ create_starsky_artifact(@projects["starsky"][:revision]) unless !deploy_starsky_hutch? || artifact_exists?('prima-artifacts-encrypted', "microservices/starsky/#{@projects["starsky"][:revision]}-qa.tar.gz")
965
975
 
966
976
  wait_for_db_import(db_task) unless stack_exists?("ecs-route53-qa-#{deploy_id}") # dovrebbe essere istantaneo
967
977
 
@@ -1040,6 +1050,10 @@ class Release
1040
1050
  {
1041
1051
  parameter_key: 'CrashElbHostname',
1042
1052
  parameter_value: get_alb_host(stack_name_alb_ws)
1053
+ },
1054
+ {
1055
+ parameter_key: 'StarskyElbHostname',
1056
+ parameter_value: get_alb_host(stack_name_alb)
1043
1057
  }
1044
1058
  ]
1045
1059
 
@@ -1592,6 +1606,52 @@ class Release
1592
1606
  end
1593
1607
  end
1594
1608
 
1609
+ if deploy_starsky_hutch?
1610
+ stack_name_starsky = "ecs-task-starsky-qa-#{deploy_id}"
1611
+ git_checkout_version('starsky', @projects["starsky"][:revision])
1612
+ stack_body = IO.read('projects/starsky/deploy/task.yml')
1613
+ parameters = [
1614
+ {
1615
+ parameter_key: "Environment",
1616
+ parameter_value: "qa"
1617
+ },
1618
+ {
1619
+ parameter_key: "ReleaseVersion",
1620
+ parameter_value: "#{@projects["starsky"][:revision]}"
1621
+ },
1622
+ {
1623
+ parameter_key: "TaskDesiredCount",
1624
+ parameter_value: "1"
1625
+ },
1626
+ {
1627
+ parameter_key: "ECSClusterName",
1628
+ parameter_value: @ecs_cluster_name
1629
+ },
1630
+ {
1631
+ parameter_key: "ALBShortName",
1632
+ parameter_value: "starsky-qa-#{deploy_id}"[0..27]
1633
+ },
1634
+ {
1635
+ parameter_key: "EnvHash",
1636
+ parameter_value: deploy_id
1637
+ },
1638
+ {
1639
+ parameter_key: "HostnamePattern",
1640
+ parameter_value: "starsky-#{@dns_record_identifier}.qa.colaster.com"
1641
+ },
1642
+ {
1643
+ parameter_key: "HostnamePatternPriority",
1644
+ parameter_value: (hostname_pattern_priority.to_i + 74).to_s
1645
+ }
1646
+ ]
1647
+ if stack_exists?(stack_name_starsky)
1648
+ cur_version = get_currently_deployed_version(stack_name_starsky)
1649
+ update_stack(stack_name_starsky, stack_body, parameters, tags, @cf_role) unless cur_version.include?(@projects["starsky"][:revision])
1650
+ else
1651
+ create_stack(stack_name_starsky, stack_body, parameters, tags, @cf_role)
1652
+ end
1653
+ end
1654
+
1595
1655
  stack_name_activia = "ecs-task-activia-qa-#{deploy_id}"
1596
1656
  git_checkout_version('activia', @projects["activia"][:revision])
1597
1657
  stack_body = File.read('projects/activia/deploy/task.yml')
@@ -1795,6 +1855,7 @@ class Release
1795
1855
  wait_for_stack_ready(stack_name_borat) unless stack_ready?(stack_name_borat)
1796
1856
  wait_for_stack_ready(stack_name_activia) unless stack_ready?(stack_name_activia)
1797
1857
  wait_for_stack_ready(stack_name_crash) unless stack_ready?(stack_name_crash) unless !deploy_crash?
1858
+ wait_for_stack_ready(stack_name_starsky) unless stack_ready?(stack_name_starsky) unless !deploy_starsky_hutch?
1798
1859
 
1799
1860
  update_service_defaults(stack_name_web)
1800
1861
  update_service_defaults(stack_name_consumer)
@@ -1811,6 +1872,7 @@ class Release
1811
1872
  update_service_defaults(stack_name_skynet)
1812
1873
  update_service_defaults(stack_name_leftorium)
1813
1874
  update_service_defaults(stack_name_rachele)
1875
+ update_service_defaults(stack_name_starsky) unless !deploy_starsky_hutch?
1814
1876
  update_service_defaults(stack_name_crash) unless !deploy_crash?
1815
1877
 
1816
1878
  activia_hostname = get_route53_hostname(stack_name_activia)
@@ -1828,6 +1890,7 @@ class Release
1828
1890
  leftorium_hostname = get_route53_hostname(stack_name_leftorium)
1829
1891
  rachele_hostname = get_route53_hostname(stack_name_rachele)
1830
1892
  crash_hostname = get_route53_hostname(stack_name_crash) unless !deploy_crash?
1893
+ starsky_hostname = get_route53_hostname(stack_name_starsky) unless !deploy_starsky_hutch?
1831
1894
 
1832
1895
  # launch_marley ec2_ip_address(asg_stack_name), prima_hostname, borat_hostname
1833
1896
 
@@ -1849,6 +1912,8 @@ class Release
1849
1912
  projects_text.concat "
1850
1913
  > Crash url: https://#{crash_hostname}" if deploy_crash?
1851
1914
  projects_text.concat "
1915
+ > Starsky url: https://#{starsky_hostname}" if deploy_starsky_hutch?
1916
+ projects_text.concat "
1852
1917
  > RabbitMQ url: http://#{ec2_ip_address(asg_stack_name)}:15672
1853
1918
  > Supervisor url: http://#{ec2_ip_address(asg_stack_name)}:9001
1854
1919
  > Elasticsearch url: http://#{ec2_ip_address(asg_stack_name)}:9200
@@ -1891,6 +1956,8 @@ class Release
1891
1956
  host = "leftorium-#{@dns_record_identifier}.qa.colaster.com"
1892
1957
  when stack_name.include?('rachele')
1893
1958
  host = "rachele-#{@dns_record_identifier}.qa.colaster.com"
1959
+ when stack_name.include?('starsky')
1960
+ host = "starsky-#{@dns_record_identifier}.qa.colaster.com"
1894
1961
  end
1895
1962
  host
1896
1963
  end
@@ -1945,6 +2012,8 @@ class Release
1945
2012
  logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1946
2013
  when stack_name.include?('rachele')
1947
2014
  logical_resource_id = 'EcsApplicationLoadBalancerInternal'
2015
+ when stack_name.include?('starsky')
2016
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1948
2017
  end
1949
2018
  resp = @cf.describe_stack_resource({
1950
2019
  stack_name: stack_name,
@@ -1994,6 +2063,8 @@ class Release
1994
2063
  logical_resource_id = 'ECSServiceRacheleQA'
1995
2064
  when stack_name.include?('crash')
1996
2065
  logical_resource_id = 'ECSServiceCrashQA'
2066
+ when stack_name.include?('starsky')
2067
+ logical_resource_id = 'ECSServiceStarskyQA'
1997
2068
  else
1998
2069
  raise "Service name non gestito per lo stack #{stack_name}"
1999
2070
  end
@@ -2523,6 +2594,46 @@ class Release
2523
2594
  Dir.chdir '../../'
2524
2595
  end
2525
2596
 
2597
+ def create_starsky_artifact(revision)
2598
+ output "Preparo l'artifact starsky\n".yellow
2599
+
2600
+ git_checkout_version('starsky', revision)
2601
+
2602
+ Dir.chdir 'projects/starsky'
2603
+
2604
+ version = `git rev-parse HEAD`
2605
+
2606
+ #artifact_path = "/tmp/starsky-#{revision}-qa.tar.gz"
2607
+
2608
+ decrypt_secrets() unless File.exist?('config/secrets.yml')
2609
+
2610
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2611
+ exec_step 'prepare-docker-compose --directory starsky && cp docker-compose-qainit.yml docker-compose.yml'
2612
+ exec_step "sed s/qa_deploy_id/#{get_deploy_id}/ .env.dist.qa"
2613
+ exec_step "cp .env.dist.qa .env"
2614
+
2615
+ [
2616
+ "sed -i 's/USER app/USER root/g' Dockerfile",
2617
+ "docker-compose build web",
2618
+ "docker-compose run -w $PWD -u root --entrypoint /bin/sh web \
2619
+ '-c' 'cargo build --release -vv \
2620
+ && cargo build --bin migrate --release \
2621
+ && cargo build --bin rabbit_worker --release \
2622
+ && cp -p target/release/starsky . \
2623
+ && cp -p target/release/migrate . \
2624
+ && cp -p target/release/rabbit_worker . \
2625
+ && tar cfz #{revision}-qa.tar.gz config starsky migrate rabbit_worker .env.dist.*'"
2626
+ ].each do |cmd|
2627
+ execute_command cmd
2628
+ end
2629
+
2630
+ artifact_path = "./#{revision}-qa.tar.gz"
2631
+
2632
+ upload_artifact(artifact_path, "microservices/starsky/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2633
+
2634
+ Dir.chdir '../../'
2635
+ end
2636
+
2526
2637
  def create_urania_artifact(revision)
2527
2638
  output "Preparo l'artifact urania .zip\n".yellow
2528
2639
 
@@ -2573,6 +2684,12 @@ class Release
2573
2684
  crash_present || leftorium_present
2574
2685
  end
2575
2686
 
2687
+ def deploy_starsky_hutch?
2688
+ starsky_present = !@projects['starsky'].nil? && !@projects['starsky'].empty? && @projects['starsky'][:name] != 'master' && !@projects['starsky'][:default_branch]
2689
+ #hutch_present = !@projects['hutch'].empty? && @projects['hutch'][:name] != 'master' && !@projects['hutch'][:default_branch]
2690
+ starsky_present #|| hutch_present TODO REMOVE
2691
+ end
2692
+
2576
2693
  def get_pyxis_version(deploy_id)
2577
2694
  (deploy_id.delete '[a-z0]')[0..9]
2578
2695
  end
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.52.2
4
+ version: 0.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-09-19 00:00:00.000000000 Z
17
+ date: 2019-09-26 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: aws-sdk