prima-twig 0.50.104 → 0.51.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2528bc3ac66d350a84dca6d112ed29de16931ace3da525479b06ce0c3d899bc9
4
- data.tar.gz: be60ebde15826a816217fd47152b3c3ed439aa504e6babae5e744b952961d77a
3
+ metadata.gz: 03fc625a6f554a47f38942840532d0cb8d9a095aa2901d0058fcfb1f0e351787
4
+ data.tar.gz: f9e7a16d593cd51607dbb34db2ffe237c7471381f83ffd49ff5edec4ea1a7741
5
5
  SHA512:
6
- metadata.gz: 4187128cee6f4f817119b54665128cfd201b210d6ce139fbf4e1c2610cc4cb46b651fb64adfb641e4d16503fa8c79aa797920b07f1d8e39bbe27e2278102a35b
7
- data.tar.gz: 210d381f0b28cfdfc9fb44a0ee6763a22be71421e82900cd97951ff399aafee5296b9308c792930bae31751ebe8616d06a014c0cbf1ae05e5ca1d8870a50d97d
6
+ metadata.gz: edc64a8ef5207a790ffa1dc46ded337e7c2666aea917ec398bc294b6ccd1f74cb53ba77c0eb078396a6a968e4028fb4f018642e6239854af33b8bfc014dedb41
7
+ data.tar.gz: f5a574e209e69b8bacf4dea5d78aef6301a9dce0fc327b9d2e2a5ed164ab8a4ed2b7f619e2d4140cb7033cbd0c80c8d0c3a7c9501047d2f19b91856b8549d8bc
@@ -142,23 +142,9 @@ class Review
142
142
  mail.delivery_method(:smtp, opts)
143
143
  mail.deliver
144
144
 
145
- invalidate_prismic_cache
146
-
147
145
  exec_step "terminal-notifier -message 'Deploy terminato'" if which 'terminal-notifier'
148
146
  end
149
147
 
150
- def invalidate_prismic_cache
151
- [
152
- "guarantee",
153
- "glossary",
154
- "guide",
155
- "faq"
156
- ].each do |page|
157
-
158
- exec_step "curl -X POST -H \"Content-Type: application/json\" https://www.prima.it/api/cms/update/#{page}?apikey=#{@prima.config['prima_apikey']}"
159
- end
160
- end
161
-
162
148
  def reload_parameters!
163
149
  artifact_rev = ''
164
150
  resp = @cf.describe_stacks({
@@ -31,7 +31,7 @@ class Release
31
31
  @s3 = Aws::S3::Client.new
32
32
  @s3_bucket = 'prima-artifacts'
33
33
  @artifact_path = '/tmp/prima-artifact.zip'
34
- @import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-1ELQ2B0YCR1U:1'
34
+ @import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-1Q0P0V213HYGW:1'
35
35
  @cf_role = 'arn:aws:iam::001575623345:role/qainit-service-role-cloudformat-CloudformationRole-18KBZQIS148R9'
36
36
  @dns_record_identifier = nil
37
37
  @ecs_cluster_name = nil
@@ -56,9 +56,7 @@ class Release
56
56
  'roger' => {},
57
57
  'rachele' => {},
58
58
  'leftorium' => {},
59
- 'pyxis-npm' => {},
60
- 'starsky' => {},
61
- 'hutch' => {}
59
+ 'pyxis-npm' => {}
62
60
  }
63
61
  @base_stack_name_alb = 'ecs-alb-http-public-qa-'
64
62
  @base_stack_name_alb_ws = 'ecs-alb-ws-public-qa-'
@@ -377,7 +375,7 @@ class Release
377
375
  envs.each do |key, env|
378
376
  title = ""
379
377
  env.each do |e|
380
- title << "#{e.value}" if e.key == 'qainit'
378
+ title << "\n#{e.key.upcase}: #{e.value}"
381
379
  end
382
380
  msg = "#{@prima.reduce_size(title, 1000)}".light_blue
383
381
  menu.choice(msg) { key }
@@ -614,7 +612,7 @@ class Release
614
612
  output "Recupero le informazioni sui QA attivi..."
615
613
  stack_list, envs = get_stacks
616
614
 
617
- env_hash = "qa-" + get_deploy_id
615
+ env_hash = "qa-" + calculate_deploy_id
618
616
 
619
617
  cluster_stack_name = nil
620
618
  stacks_to_delete = []
@@ -708,13 +706,8 @@ class Release
708
706
  @s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/elb/alb-public-qa.yml', response_target: 'cloudformation/stacks/elb/alb-public-qa.yml'})
709
707
  end
710
708
 
711
- def get_deploy_id
712
- if @deploy_id
713
- @deploy_id
714
- else
715
- @deploy_id = Digest::MD5.hexdigest(ENV['DRONE_BRANCH'])
716
- @deploy_id
717
- end
709
+ def calculate_deploy_id
710
+ hash = Digest::MD5.hexdigest(ENV['DRONE_BRANCH'])
718
711
  end
719
712
 
720
713
  def qainit_drone_minimal_deploy!
@@ -727,7 +720,7 @@ class Release
727
720
  git_checkout_version(project_key, @projects[project_key][:revision])
728
721
  end
729
722
  end
730
- deploy_id = get_deploy_id
723
+ deploy_id = calculate_deploy_id
731
724
 
732
725
  @git_branch = ENV['DRONE_BRANCH']
733
726
  @dns_record_identifier = deploy_id
@@ -771,7 +764,7 @@ class Release
771
764
  asg_stack_name = "ecs-asg-allinone-qa-#{deploy_id}"
772
765
  create_asg_stack(asg_stack_name, tags) unless stack_exists?(asg_stack_name)
773
766
 
774
- deploy_id = get_deploy_id
767
+ deploy_id = calculate_deploy_id
775
768
  create_pyxis_artifact(@projects["pyxis-npm"][:revision], deploy_id)
776
769
  create_prima_artifact(@projects["prima"][:revision], @projects["prima"][:name], deploy_id, true) unless artifact_exists?('prima-artifacts-encrypted', "prima/#{@projects["prima"][:revision]}.tar.gz")
777
770
 
@@ -879,7 +872,7 @@ class Release
879
872
  def deploy_feature!
880
873
  `git pull && git submodule init && git submodule update`
881
874
  @ami_id = get_ami_id("ecs-fleet-allinone-staging")
882
- deploy_id = get_deploy_id
875
+ deploy_id = calculate_deploy_id
883
876
  stack_name_alb = 'ecs-alb-http-public-qa-' + deploy_id[0..5]
884
877
  stack_name_alb_ws = 'ecs-alb-ws-public-qa-' + deploy_id[0..5]
885
878
  unless @qainit
@@ -903,11 +896,8 @@ class Release
903
896
  }
904
897
  ]
905
898
  @projects.each do |key, value|
906
- case key.to_s
907
- when 'crash'
899
+ if key.to_s == 'crash'
908
900
  tags << { key: 'crash', value: @projects['crash'][:name] } if deploy_crash?
909
- when 'starsky', 'hutch'
910
- tags << { key: key.to_s, value: @projects[key.to_s][:name] } if deploy_starsky_hutch?
911
901
  else
912
902
  tags << { key: key, value: value[:name] }
913
903
  end
@@ -972,8 +962,6 @@ class Release
972
962
  create_activia_artifact(@projects["activia"][:revision]) unless artifact_exists?('prima-artifacts-encrypted', "microservices/activia/#{@projects["activia"][:revision]}-qa.tar.gz")
973
963
  create_leftorium_artifact(@projects["leftorium"][:revision]) unless artifact_exists?('prima-artifacts-encrypted', "microservices/leftorium/#{@projects["leftorium"][:revision]}-qa.tar.gz")
974
964
  create_skynet_artifact(@projects["skynet"][:revision]) unless artifact_exists?('prima-artifacts-encrypted', "microservices/skynet/#{@projects["skynet"][:revision]}-qa.tar.gz")
975
- create_starsky_artifact(@projects["starsky"][:revision]) unless !deploy_starsky_hutch? || artifact_exists?('prima-artifacts-encrypted', "microservices/starsky/#{@projects["starsky"][:revision]}-qa.tar.gz")
976
- create_hutch_artifact(@projects["hutch"][:revision]) unless !deploy_starsky_hutch? || artifact_exists?('prima-artifacts-encrypted', "microservices/hutch/#{@projects["hutch"][:revision]}-qa.tar.gz")
977
965
 
978
966
  wait_for_db_import(db_task) unless stack_exists?("ecs-route53-qa-#{deploy_id}") # dovrebbe essere istantaneo
979
967
 
@@ -1052,14 +1040,6 @@ class Release
1052
1040
  {
1053
1041
  parameter_key: 'CrashElbHostname',
1054
1042
  parameter_value: get_alb_host(stack_name_alb_ws)
1055
- },
1056
- {
1057
- parameter_key: 'StarskyElbHostname',
1058
- parameter_value: get_alb_host(stack_name_alb)
1059
- },
1060
- {
1061
- parameter_key: 'HutchElbHostname',
1062
- parameter_value: get_alb_host(stack_name_alb)
1063
1043
  }
1064
1044
  ]
1065
1045
 
@@ -1612,52 +1592,6 @@ class Release
1612
1592
  end
1613
1593
  end
1614
1594
 
1615
- if deploy_starsky_hutch?
1616
- stack_name_starsky = "ecs-task-starsky-qa-#{deploy_id}"
1617
- git_checkout_version('starsky', @projects["starsky"][:revision])
1618
- stack_body = IO.read('projects/starsky/deploy/task.yml')
1619
- parameters = [
1620
- {
1621
- parameter_key: "Environment",
1622
- parameter_value: "qa"
1623
- },
1624
- {
1625
- parameter_key: "ReleaseVersion",
1626
- parameter_value: "#{@projects["starsky"][:revision]}"
1627
- },
1628
- {
1629
- parameter_key: "TaskDesiredCount",
1630
- parameter_value: "1"
1631
- },
1632
- {
1633
- parameter_key: "ECSClusterName",
1634
- parameter_value: @ecs_cluster_name
1635
- },
1636
- {
1637
- parameter_key: "ALBShortName",
1638
- parameter_value: "starsky-qa-#{deploy_id}"[0..27]
1639
- },
1640
- {
1641
- parameter_key: "EnvHash",
1642
- parameter_value: deploy_id
1643
- },
1644
- {
1645
- parameter_key: "HostnamePattern",
1646
- parameter_value: "starsky-#{@dns_record_identifier}.qa.colaster.com"
1647
- },
1648
- {
1649
- parameter_key: "HostnamePatternPriority",
1650
- parameter_value: (hostname_pattern_priority.to_i + 74).to_s
1651
- }
1652
- ]
1653
- if stack_exists?(stack_name_starsky)
1654
- cur_version = get_currently_deployed_version(stack_name_starsky)
1655
- update_stack(stack_name_starsky, stack_body, parameters, tags, @cf_role) unless cur_version.include?(@projects["starsky"][:revision])
1656
- else
1657
- create_stack(stack_name_starsky, stack_body, parameters, tags, @cf_role)
1658
- end
1659
- end
1660
-
1661
1595
  stack_name_activia = "ecs-task-activia-qa-#{deploy_id}"
1662
1596
  git_checkout_version('activia', @projects["activia"][:revision])
1663
1597
  stack_body = File.read('projects/activia/deploy/task.yml')
@@ -1852,52 +1786,6 @@ class Release
1852
1786
  create_stack(stack_name_roger, stack_body, parameters, tags, @cf_role)
1853
1787
  end
1854
1788
 
1855
- wait_for_stack_ready(stack_name_starsky) unless stack_ready?(stack_name_starsky) unless !deploy_starsky_hutch?
1856
-
1857
- stack_name_hutch = "ecs-task-hutch-qa-#{deploy_id}"
1858
- git_checkout_version('hutch', @projects["hutch"][:revision])
1859
- stack_body = File.read('projects/hutch/deploy/task.yml')
1860
- parameters = [
1861
- {
1862
- parameter_key: "Environment",
1863
- parameter_value: "qa"
1864
- },
1865
- {
1866
- parameter_key: "ReleaseVersion",
1867
- parameter_value: "#{@projects["hutch"][:revision]}"
1868
- },
1869
- {
1870
- parameter_key: "ALBShortName",
1871
- parameter_value: "hutch-qa-#{deploy_id}"[0..27]
1872
- },
1873
- {
1874
- parameter_key: "ECSClusterName",
1875
- parameter_value: @ecs_cluster_name
1876
- },
1877
- {
1878
- parameter_key: "EnvHash",
1879
- parameter_value: deploy_id
1880
- },
1881
- {
1882
- parameter_key: "HostnamePattern",
1883
- parameter_value: "hutch-#{@dns_record_identifier}.qa.colaster.com"
1884
- },
1885
- {
1886
- parameter_key: "HostnamePatternPriority",
1887
- parameter_value: (hostname_pattern_priority.to_i + 254).to_s
1888
- },
1889
- {
1890
- parameter_key: "StarskyUrl",
1891
- parameter_value: get_route53_hostname('ecs-task-starsky-qa-notneeded')
1892
- }
1893
- ]
1894
- if stack_exists?(stack_name_hutch)
1895
- cur_version = get_currently_deployed_version(stack_name_hutch)
1896
- update_stack(stack_name_hutch, stack_body, parameters, tags, @cf_role) unless cur_version.include?(@projects["hutch"][:revision])
1897
- else
1898
- create_stack(stack_name_hutch, stack_body, parameters, tags, @cf_role)
1899
- end
1900
-
1901
1789
  wait_for_stack_ready(stack_name_web) unless stack_ready?(stack_name_web)
1902
1790
  wait_for_stack_ready(stack_name_consumer) unless stack_ready?(stack_name_consumer)
1903
1791
  wait_for_stack_ready(stack_name_ermes) unless stack_ready?(stack_name_ermes)
@@ -1907,7 +1795,6 @@ class Release
1907
1795
  wait_for_stack_ready(stack_name_borat) unless stack_ready?(stack_name_borat)
1908
1796
  wait_for_stack_ready(stack_name_activia) unless stack_ready?(stack_name_activia)
1909
1797
  wait_for_stack_ready(stack_name_crash) unless stack_ready?(stack_name_crash) unless !deploy_crash?
1910
- wait_for_stack_ready(stack_name_hutch) unless stack_ready?(stack_name_hutch) unless !deploy_starsky_hutch?
1911
1798
 
1912
1799
  update_service_defaults(stack_name_web)
1913
1800
  update_service_defaults(stack_name_consumer)
@@ -1924,8 +1811,6 @@ class Release
1924
1811
  update_service_defaults(stack_name_skynet)
1925
1812
  update_service_defaults(stack_name_leftorium)
1926
1813
  update_service_defaults(stack_name_rachele)
1927
- update_service_defaults(stack_name_starsky) unless !deploy_starsky_hutch?
1928
- update_service_defaults(stack_name_hutch) unless !deploy_starsky_hutch?
1929
1814
  update_service_defaults(stack_name_crash) unless !deploy_crash?
1930
1815
 
1931
1816
  activia_hostname = get_route53_hostname(stack_name_activia)
@@ -1943,8 +1828,6 @@ class Release
1943
1828
  leftorium_hostname = get_route53_hostname(stack_name_leftorium)
1944
1829
  rachele_hostname = get_route53_hostname(stack_name_rachele)
1945
1830
  crash_hostname = get_route53_hostname(stack_name_crash) unless !deploy_crash?
1946
- starsky_hostname = get_route53_hostname(stack_name_starsky) unless !deploy_starsky_hutch?
1947
- hutch_hostname = get_route53_hostname(stack_name_hutch) unless !deploy_starsky_hutch?
1948
1831
 
1949
1832
  # launch_marley ec2_ip_address(asg_stack_name), prima_hostname, borat_hostname
1950
1833
 
@@ -1966,9 +1849,6 @@ class Release
1966
1849
  projects_text.concat "
1967
1850
  > Crash url: https://#{crash_hostname}" if deploy_crash?
1968
1851
  projects_text.concat "
1969
- > Starsky url: https://#{starsky_hostname}
1970
- > Hutch url: https://#{hutch_hostname}" if deploy_starsky_hutch?
1971
- projects_text.concat "
1972
1852
  > RabbitMQ url: http://#{ec2_ip_address(asg_stack_name)}:15672
1973
1853
  > Supervisor url: http://#{ec2_ip_address(asg_stack_name)}:9001
1974
1854
  > Elasticsearch url: http://#{ec2_ip_address(asg_stack_name)}:9200
@@ -1976,7 +1856,9 @@ class Release
1976
1856
  output projects_text.cyan
1977
1857
  output "Deploy effettuato, everything is awesome!\n".green
1978
1858
 
1979
- qainit_write_output(projects_text, 'Indirizzi scritti su ')
1859
+ if @qainit
1860
+ qainit_write_output(projects_text, 'Indirizzi scritti su ')
1861
+ end
1980
1862
  end
1981
1863
 
1982
1864
  def get_route53_hostname(stack_name)
@@ -2011,10 +1893,6 @@ class Release
2011
1893
  host = "leftorium-#{@dns_record_identifier}.qa.colaster.com"
2012
1894
  when stack_name.include?('rachele')
2013
1895
  host = "rachele-#{@dns_record_identifier}.qa.colaster.com"
2014
- when stack_name.include?('starsky')
2015
- host = "starsky-#{@dns_record_identifier}.qa.colaster.com"
2016
- when stack_name.include?('hutch')
2017
- host = "hutch-#{@dns_record_identifier}.qa.colaster.com"
2018
1896
  end
2019
1897
  host
2020
1898
  end
@@ -2069,10 +1947,6 @@ class Release
2069
1947
  logical_resource_id = 'EcsApplicationLoadBalancerPublic'
2070
1948
  when stack_name.include?('rachele')
2071
1949
  logical_resource_id = 'EcsApplicationLoadBalancerInternal'
2072
- when stack_name.include?('starsky')
2073
- logical_resource_id = 'EcsApplicationLoadBalancerPublic'
2074
- when stack_name.include?('hutch')
2075
- logical_resource_id = 'EcsApplicationLoadBalancerPublic'
2076
1950
  end
2077
1951
  resp = @cf.describe_stack_resource({
2078
1952
  stack_name: stack_name,
@@ -2122,10 +1996,6 @@ class Release
2122
1996
  logical_resource_id = 'ECSServiceRacheleQA'
2123
1997
  when stack_name.include?('crash')
2124
1998
  logical_resource_id = 'ECSServiceCrashQA'
2125
- when stack_name.include?('starsky')
2126
- logical_resource_id = 'ECSServiceStarskyQA'
2127
- when stack_name.include?('hutch')
2128
- logical_resource_id = 'ECSServiceHutch'
2129
1999
  else
2130
2000
  raise "Service name non gestito per lo stack #{stack_name}"
2131
2001
  end
@@ -2143,135 +2013,166 @@ class Release
2143
2013
  )
2144
2014
  end
2145
2015
 
2146
- def create_activia_artifact(revision)
2147
- output "Preparo l'artifact activia .zip\n".yellow
2016
+ def create_urania_artifact(revision)
2017
+ output "Preparo l'artifact urania .zip\n".yellow
2148
2018
 
2149
- git_checkout_version('activia', revision)
2019
+ git_checkout_version('urania', revision)
2150
2020
 
2151
- Dir.chdir 'projects/activia'
2021
+ Dir.chdir 'projects/urania'
2152
2022
 
2153
2023
  decrypt_secrets()
2154
2024
 
2155
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2156
- exec_step 'prepare-docker-compose --directory activia && cp docker-compose-qainit.yml docker-compose.yml'
2157
- [
2158
- "docker-compose build web",
2159
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2160
- '-c' 'mix local.hex --force && mix hex.info && \
2161
- mix deps.get && mix compile && mix deps.compile && \
2162
- cd assets && \
2163
- rm -rf node_modules && \
2164
- yarn --cache-folder ~/.cache/yarn && \
2165
- sysconfcpus -n 2 ./node_modules/.bin/webpack --mode production && \
2166
- cd .. && \
2167
- mix phx.digest && \
2168
- rm -rf _build/qa/rel/ && \
2169
- mix release --env=qa'"
2170
- ].each do |cmd|
2171
- execute_command cmd
2025
+ if @qainit
2026
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2027
+ exec_step 'prepare-docker-compose --directory urania && cp docker-compose-qainit.yml docker-compose.yml'
2172
2028
  end
2173
2029
 
2174
- cleanup_containers
2030
+ execute_command "docker-compose build web"
2175
2031
 
2176
- artifact_path = Dir.glob("_build/qa/rel/activia/releases/*/activia.tar.gz").first
2032
+ if @qainit
2033
+ [ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2034
+ '-c' 'mix local.hex --force && mix hex.info && \
2035
+ mix deps.get && mix compile && mix deps.compile && \
2036
+ rm -rf _build/qa/rel/ && \
2037
+ mix release --env=qa'"
2038
+ ].each do |cmd|
2039
+ execute_command cmd
2040
+ end
2177
2041
 
2178
- upload_artifact(artifact_path, "microservices/activia/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2042
+ cleanup_containers
2043
+ else
2044
+ [ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh urania_web \
2045
+ '-c' 'mix local.hex --force && mix hex.info && \
2046
+ mix deps.get && mix compile && mix deps.compile && \
2047
+ rm -rf _build/qa/rel/ && \
2048
+ mix release --env=qa'"
2049
+ ].each do |cmd|
2050
+ execute_command cmd
2051
+ end
2052
+ end
2053
+
2054
+ artifact_path = Dir.glob("_build/qa/rel/urania/releases/*/urania.tar.gz").first
2055
+ upload_artifact(artifact_path, "microservices/urania/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2179
2056
 
2180
2057
  Dir.chdir '../../'
2181
2058
  end
2182
2059
 
2183
- def create_assange_artifact(revision)
2184
- output "Preparo l'artifact assange .zip\n".yellow
2060
+ def create_rachele_artifact(revision)
2061
+ output "Preparo l'artifact rachele .zip\n".yellow
2185
2062
 
2186
- git_checkout_version('assange', revision)
2063
+ git_checkout_version('rachele', revision)
2187
2064
 
2188
- Dir.chdir 'projects/assange'
2065
+ Dir.chdir 'projects/rachele'
2189
2066
 
2190
2067
  decrypt_secrets()
2191
2068
 
2192
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2193
- exec_step 'prepare-docker-compose --directory assange && cp docker-compose-qainit.yml docker-compose.yml'
2194
- [
2195
- "docker-compose build web",
2196
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2197
- '-c' 'mix local.hex --force && mix hex.info && \
2198
- mix deps.get && mix compile && mix deps.compile && \
2199
- mix phx.digest && \
2200
- rm -rf _build/qa/rel/ && \
2201
- mix release --env=qa'"
2202
- ].each do |cmd|
2203
- execute_command cmd
2069
+ if @qainit
2070
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2071
+ exec_step 'prepare-docker-compose --directory rachele && cp docker-compose-qainit.yml docker-compose.yml'
2204
2072
  end
2205
2073
 
2206
- cleanup_containers
2074
+ execute_command "docker-compose build web"
2207
2075
 
2208
- artifact_path = Dir.glob("_build/qa/rel/assange/releases/*/assange.tar.gz").first
2209
- upload_artifact(artifact_path, "microservices/assange/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2076
+ if @qainit
2077
+ [ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2078
+ '-c' 'mix local.hex --force && mix hex.info && \
2079
+ mix deps.get && mix compile && mix deps.compile && \
2080
+ rm -rf _build/qa/rel/ && \
2081
+ mix release --env=qa'"
2082
+ ].each do |cmd|
2083
+ execute_command cmd
2084
+ end
2085
+
2086
+ cleanup_containers
2087
+ else
2088
+ [ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh rachele_web \
2089
+ '-c' 'mix local.hex --force && mix hex.info && \
2090
+ mix deps.get && mix compile && mix deps.compile && \
2091
+ rm -rf _build/qa/rel/ && \
2092
+ mix release --env=qa'"
2093
+ ].each do |cmd|
2094
+ execute_command cmd
2095
+ end
2096
+ end
2097
+
2098
+ artifact_path = Dir.glob("_build/qa/rel/rachele/releases/*/rachele.tar.gz").first
2099
+ upload_artifact(artifact_path, "microservices/rachele/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2210
2100
 
2211
2101
  Dir.chdir '../../'
2212
2102
  end
2213
2103
 
2214
- def create_bburago_artifact(revision)
2215
- output "Preparo l'artifact bburago .zip\n".yellow
2104
+ def create_ermes_artifact(revision)
2105
+ output "Preparo l'artifact ermes .zip\n".yellow
2216
2106
 
2217
- git_checkout_version('bburago', revision)
2107
+ git_checkout_version('ermes', revision)
2218
2108
 
2219
- Dir.chdir 'projects/bburago'
2109
+ Dir.chdir 'projects/ermes'
2220
2110
 
2221
2111
  decrypt_secrets()
2222
2112
 
2223
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2224
- exec_step 'prepare-docker-compose --directory bburago && cp docker-compose-qainit.yml docker-compose.yml'
2113
+ if @qainit
2114
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2115
+ exec_step 'prepare-docker-compose --directory ermes && cp docker-compose-qainit.yml docker-compose.yml'
2116
+ end
2225
2117
  [
2226
- "docker-compose build web",
2227
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint deploy/create_qa_artifact web"
2118
+ "if echo `docker network ls` | grep crash_default; \
2119
+ then echo 'crash_default network already existing'; \
2120
+ else docker network create crash_default; fi",
2121
+ 'docker-compose build web'
2228
2122
  ].each do |cmd|
2229
2123
  execute_command cmd
2230
2124
  end
2231
2125
 
2232
- cleanup_containers
2126
+ if @qainit
2127
+ [ "docker-compose run --rm -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2128
+ '-c' 'mix local.hex --force && mix hex.info && \
2129
+ mix deps.get && mix compile && mix deps.compile && \
2130
+ mix phx.digest && \
2131
+ rm -rf _build/qa/rel/ && \
2132
+ mix release --env=qa'"
2133
+ ].each do |cmd|
2134
+ execute_command cmd
2135
+ end
2233
2136
 
2234
- artifact_path = Dir.glob('_build/qa/rel/bburago/releases/*/bburago.tar.gz').first
2235
- upload_artifact(artifact_path, "microservices/bburago/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2137
+ cleanup_containers
2138
+ else
2139
+ [ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh ermes_web \
2140
+ '-c' 'mix local.hex --force && mix hex.info && \
2141
+ mix deps.get && mix compile && mix deps.compile && \
2142
+ mix phx.digest && \
2143
+ rm -rf _build/qa/rel/ && \
2144
+ mix release --env=qa'",
2145
+ "if echo `docker ps` | grep crash; \
2146
+ then echo 'cannot delete crash_default network'; \
2147
+ else docker network rm crash_default; fi "
2148
+ ].each do |cmd|
2149
+ execute_command cmd
2150
+ end
2151
+ end
2152
+
2153
+ artifact_path = Dir.glob("_build/qa/rel/ermes/releases/*/ermes.tar.gz").first
2154
+ upload_artifact(artifact_path, "microservices/ermes/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2236
2155
 
2237
2156
  Dir.chdir '../../'
2238
2157
  end
2239
2158
 
2240
- def create_borat_artifact(revision)
2241
- output "Preparo l'artifact borat .zip\n".yellow
2242
-
2243
- git_checkout_version('borat', revision)
2244
-
2245
- Dir.chdir 'projects/borat'
2159
+ def deploy_pyxis?
2160
+ if defined? @deploy_pyxis
2161
+ @deploy_pyxis
2162
+ else
2163
+ pyxis_updated = `git log -p -1 --unified=0 | grep pyxis-npm:`.length > 0
2246
2164
 
2247
- decrypt_secrets()
2165
+ update_pyxis = !@projects['pyxis-npm'].empty? && @projects['pyxis-npm'][:name] != 'master' && pyxis_updated
2248
2166
 
2249
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2250
- exec_step 'prepare-docker-compose --directory borat && cp docker-compose-qainit.yml docker-compose.yml'
2251
- [
2252
- "docker network create borat_network || true",
2253
- "docker-compose build web",
2254
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2255
- '-c' 'mix local.hex --force && mix hex.info && \
2256
- mix deps.get && \
2257
- cd assets && \
2258
- yarn --cache-folder ~/.cache/yarn && \
2259
- sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
2260
- cd ../ && \
2261
- mix phx.digest && \
2262
- mix compile && mix deps.compile && \
2263
- rm -rf _build/qa/rel/ && \
2264
- mix distillery.release --env=qa'"
2265
- ].each do |cmd|
2266
- execute_command cmd
2167
+ @deploy_pyxis = update_pyxis
2168
+ return update_pyxis
2267
2169
  end
2170
+ end
2268
2171
 
2269
- cleanup_containers
2270
-
2271
- artifact_path = Dir.glob("_build/qa/rel/borat/releases/*/borat.tar.gz").first
2272
- upload_artifact(artifact_path, "microservices/borat/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2273
-
2274
- Dir.chdir '../../'
2172
+ def deploy_crash?
2173
+ crash_present = !@projects['crash'].empty? && @projects['crash'][:name] != 'master' && !@projects['crash'][:default_branch]
2174
+ leftorium_present = !@projects['leftorium'].empty? && @projects['leftorium'][:name] != 'master' && !@projects['leftorium'][:default_branch]
2175
+ crash_present || leftorium_present
2275
2176
  end
2276
2177
 
2277
2178
  def create_crash_artifact(revision, deploy_id)
@@ -2285,28 +2186,50 @@ class Release
2285
2186
 
2286
2187
  decrypt_secrets()
2287
2188
 
2288
- `mv docker-compose-ci.yml docker-compose.yml`
2289
- exec_step 'prepare-docker-compose --directory crash && cp docker-compose-qainit.yml docker-compose.yml'
2290
- [
2291
- 'docker-compose build web',
2292
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa -e ENV_HASH=#{deploy_id} web \
2293
- '-c' 'mix local.hex --force && mix hex.info && \
2294
- mix deps.get && \
2295
- cd assets && \
2296
- yarn --cache-folder ~/.cache/yarn && \
2297
- NODE_ENV=production sysconfcpus -n 1 yarn run build && \
2298
- cd ../ && \
2299
- mix release.clean --implode --no-confirm && \
2300
- mix phx.digest && \
2301
- mix deps.clean --all && \
2302
- mix deps.get && \
2303
- mix compile && mix release --env=qa'",
2304
- 'docker-compose down'
2305
- ].each do |cmd|
2306
- execute_command cmd
2307
- end
2189
+ if @qainit
2190
+ `mv docker-compose-ci.yml docker-compose.yml`
2191
+ exec_step 'prepare-docker-compose --directory crash && cp docker-compose-qainit.yml docker-compose.yml'
2192
+ [
2193
+ 'docker-compose build web',
2194
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa -e ENV_HASH=#{deploy_id} web \
2195
+ '-c' 'mix local.hex --force && mix hex.info && \
2196
+ mix deps.get && \
2197
+ cd assets && \
2198
+ yarn --cache-folder ~/.cache/yarn && \
2199
+ NODE_ENV=production sysconfcpus -n 1 yarn run build && \
2200
+ cd ../ && \
2201
+ mix release.clean --implode --no-confirm && \
2202
+ mix phx.digest && \
2203
+ mix deps.clean --all && \
2204
+ mix deps.get && \
2205
+ mix compile && mix release --env=qa'",
2206
+ 'docker-compose down'
2207
+ ].each do |cmd|
2208
+ execute_command cmd
2209
+ end
2308
2210
 
2309
- cleanup_containers
2211
+ cleanup_containers
2212
+ else
2213
+ [
2214
+ 'mv docker-compose-ci.yml docker-compose.yml',
2215
+ 'docker-compose build web',
2216
+ "docker-compose run -w $PWD -e ENV_HASH=#{deploy_id} -e MIX_ENV=qa web \
2217
+ '-c' 'mix local.hex --force && mix hex.info && \
2218
+ mix deps.get && \
2219
+ cd assets && \
2220
+ yarn --cache-folder ~/.cache/yarn && \
2221
+ NODE_ENV=production sysconfcpus -n 1 yarn run build && \
2222
+ cd ../ && \
2223
+ mix release.clean --implode --no-confirm && \
2224
+ mix phx.digest && \
2225
+ mix deps.clean --all && \
2226
+ mix deps.get && \
2227
+ mix compile && mix release --env=qa'",
2228
+ 'docker-compose down'
2229
+ ].each do |cmd|
2230
+ execute_command cmd
2231
+ end
2232
+ end
2310
2233
 
2311
2234
  artifact_path = Dir.glob('_build/qa/rel/crash/releases/*/crash.tar.gz').first
2312
2235
  upload_artifact(artifact_path, "microservices/crash/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
@@ -2314,75 +2237,71 @@ class Release
2314
2237
  Dir.chdir '../../'
2315
2238
  end
2316
2239
 
2317
- def create_ermes_artifact(revision)
2318
- output "Preparo l'artifact ermes .zip\n".yellow
2240
+ def create_bburago_artifact(revision)
2241
+ output "Preparo l'artifact bburago .zip\n".yellow
2319
2242
 
2320
- git_checkout_version('ermes', revision)
2243
+ git_checkout_version('bburago', revision)
2321
2244
 
2322
- Dir.chdir 'projects/ermes'
2245
+ Dir.chdir 'projects/bburago'
2323
2246
 
2324
2247
  decrypt_secrets()
2325
2248
 
2326
2249
  exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2327
- exec_step 'prepare-docker-compose --directory ermes && cp docker-compose-qainit.yml docker-compose.yml'
2328
-
2250
+ exec_step 'prepare-docker-compose --directory bburago && cp docker-compose-qainit.yml docker-compose.yml'
2329
2251
  [
2330
- "if echo `docker network ls` | grep crash_default; \
2331
- then echo 'crash_default network already existing'; \
2332
- else docker network create crash_default; fi",
2333
- 'docker-compose build web'
2334
- ].each do |cmd|
2335
- execute_command cmd
2336
- end
2337
-
2338
- [ "docker-compose run --rm -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2339
- '-c' 'mix local.hex --force && mix hex.info && \
2340
- mix deps.get && mix compile && mix deps.compile && \
2341
- mix phx.digest && \
2342
- MIX_ENV=dev mix compile.sms && \
2343
- MIX_ENV=dev mix compile.html && \
2344
- MIX_ENV=dev mix compile.heml && \
2345
- rm -rf _build/qa/rel/ && \
2346
- mix release --env=qa'"
2252
+ "docker-compose build web",
2253
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint deploy/create_qa_artifact web"
2347
2254
  ].each do |cmd|
2348
2255
  execute_command cmd
2349
2256
  end
2350
2257
 
2351
2258
  cleanup_containers
2352
2259
 
2353
- artifact_path = Dir.glob("_build/qa/rel/ermes/releases/*/ermes.tar.gz").first
2354
- upload_artifact(artifact_path, "microservices/ermes/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2260
+ artifact_path = Dir.glob('_build/qa/rel/bburago/releases/*/bburago.tar.gz').first
2261
+ upload_artifact(artifact_path, "microservices/bburago/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2355
2262
 
2356
2263
  Dir.chdir '../../'
2357
2264
  end
2358
2265
 
2359
- def create_fidaty_artifact(revision)
2360
- output "Preparo l'artifact fidaty .zip\n".yellow
2266
+ def create_leftorium_artifact(revision)
2267
+ output "Preparo l'artifact leftorium .zip\n".yellow
2361
2268
 
2362
- git_checkout_version('fidaty', revision)
2269
+ git_checkout_version('leftorium', revision)
2363
2270
 
2364
- Dir.chdir 'projects/fidaty'
2271
+ Dir.chdir 'projects/leftorium'
2365
2272
 
2366
2273
  decrypt_secrets()
2367
2274
 
2368
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2369
- exec_step 'prepare-docker-compose --directory fidaty && cp docker-compose-qainit.yml docker-compose.yml'
2370
- [
2371
- "docker-compose build web",
2372
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2373
- '-c' 'mix local.hex --force && mix hex.info && \
2374
- mix deps.get && mix compile && mix deps.compile && \
2375
- mix phx.digest && \
2376
- rm -rf _build/qa/rel/ && \
2377
- mix release --env=qa'"
2378
- ].each do |cmd|
2379
- execute_command cmd
2380
- end
2275
+ if @qainit
2276
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2277
+ exec_step 'prepare-docker-compose --directory leftorium && cp docker-compose-qainit.yml docker-compose.yml'
2278
+ [
2279
+ "docker-compose build web",
2280
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2281
+ '-c' 'mix local.hex --force && mix hex.info && \
2282
+ mix deps.get && mix compile && mix deps.compile && \
2283
+ rm -rf _build/qa/rel/ && \
2284
+ mix release --env=qa'"
2285
+ ].each do |cmd|
2286
+ execute_command cmd
2287
+ end
2381
2288
 
2382
- cleanup_containers
2289
+ cleanup_containers
2290
+ else
2291
+ [
2292
+ "docker-compose build web",
2293
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh leftorium_web \
2294
+ '-c' 'mix local.hex --force && mix hex.info && \
2295
+ mix deps.get && mix compile && mix deps.compile && \
2296
+ rm -rf _build/qa/rel/ && \
2297
+ mix release --env=qa'"
2298
+ ].each do |cmd|
2299
+ execute_command cmd
2300
+ end
2301
+ end
2383
2302
 
2384
- artifact_path = Dir.glob("_build/qa/rel/fidaty/releases/*/fidaty.tar.gz").first
2385
- upload_artifact(artifact_path, "microservices/fidaty/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2303
+ artifact_path = Dir.glob('_build/qa/rel/leftorium/releases/*/leftorium.tar.gz').first
2304
+ upload_artifact(artifact_path, "microservices/leftorium/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2386
2305
 
2387
2306
  Dir.chdir '../../'
2388
2307
  end
@@ -2396,21 +2315,35 @@ class Release
2396
2315
 
2397
2316
  decrypt_secrets()
2398
2317
 
2399
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2400
- exec_step 'prepare-docker-compose --directory hal9000 && cp docker-compose-qainit.yml docker-compose.yml'
2401
- [
2402
- "docker-compose build web",
2403
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2404
- '-c' 'mix local.hex --force && mix hex.info && \
2405
- mix deps.get && mix compile && mix deps.compile && \
2406
- mix phx.digest assets -o priv/static && \
2407
- rm -rf _build/qa/rel/ && \
2408
- mix release --env=qa'"
2409
- ].each do |cmd|
2410
- execute_command cmd
2411
- end
2318
+ if @qainit
2319
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2320
+ exec_step 'prepare-docker-compose --directory hal9000 && cp docker-compose-qainit.yml docker-compose.yml'
2321
+ [
2322
+ "docker-compose build web",
2323
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2324
+ '-c' 'mix local.hex --force && mix hex.info && \
2325
+ mix deps.get && mix compile && mix deps.compile && \
2326
+ mix phx.digest assets -o priv/static && \
2327
+ rm -rf _build/qa/rel/ && \
2328
+ mix release --env=qa'"
2329
+ ].each do |cmd|
2330
+ execute_command cmd
2331
+ end
2412
2332
 
2413
- cleanup_containers
2333
+ cleanup_containers
2334
+ else
2335
+ [
2336
+ "docker-compose build web",
2337
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh hal9000_web \
2338
+ '-c' 'mix local.hex --force && mix hex.info && \
2339
+ mix deps.get && mix compile && mix deps.compile && \
2340
+ mix phx.digest && \
2341
+ rm -rf _build/qa/rel/ && \
2342
+ mix release --env=qa'"
2343
+ ].each do |cmd|
2344
+ execute_command cmd
2345
+ end
2346
+ end
2414
2347
 
2415
2348
  artifact_path = Dir.glob("_build/qa/rel/hal9000/releases/*/hal9000.tar.gz").first
2416
2349
  upload_artifact(artifact_path, "microservices/hal9000/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
@@ -2418,67 +2351,47 @@ class Release
2418
2351
  Dir.chdir '../../'
2419
2352
  end
2420
2353
 
2421
- def create_hutch_artifact(revision)
2422
- output "Preparo l'artifact hutch\n".yellow
2423
-
2424
- git_checkout_version('hutch', revision)
2425
-
2426
- Dir.chdir 'projects/hutch'
2427
-
2428
- version = `git rev-parse HEAD`
2429
-
2430
- decrypt_secrets() unless File.exist?('config/secrets.yml')
2431
-
2432
- exec_step 'cp docker-compose-ci.yml docker-compose.yml'
2433
- exec_step 'prepare-docker-compose --directory hutch && cp docker-compose-qainit.yml docker-compose.yml'
2434
- exec_step "sed s/qa_deploy_id/#{get_deploy_id}/ .env.dist.qa"
2435
- exec_step "cp .env.dist.qa .env"
2436
- exec_step "rm -fr peano"
2437
-
2438
- [
2439
- "sed -i 's/USER app/USER root/g' Dockerfile",
2440
- "docker-compose build web",
2441
- "docker-compose run -w $PWD -u root -e ELM_APP_STARSKY_URL=https://#{get_route53_hostname("starsky")} --entrypoint /bin/sh web \
2442
- '-c' 'yarn && yarn run build \
2443
- && tar cfz #{revision}-qa.tar.gz *'"
2444
- # && tar cfz #{revision}-qa.tar.gz build package.json scripts config node_modules public elm-stuff src .env'"
2445
- ].each do |cmd|
2446
- execute_command cmd
2447
- end
2448
-
2449
- artifact_path = "./#{revision}-qa.tar.gz"
2450
-
2451
- upload_artifact(artifact_path, "microservices/hutch/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2452
-
2453
- Dir.chdir '../../'
2454
- end
2455
-
2456
- def create_leftorium_artifact(revision)
2457
- output "Preparo l'artifact leftorium .zip\n".yellow
2354
+ def create_fidaty_artifact(revision)
2355
+ output "Preparo l'artifact fidaty .zip\n".yellow
2458
2356
 
2459
- git_checkout_version('leftorium', revision)
2357
+ git_checkout_version('fidaty', revision)
2460
2358
 
2461
- Dir.chdir 'projects/leftorium'
2359
+ Dir.chdir 'projects/fidaty'
2462
2360
 
2463
2361
  decrypt_secrets()
2464
2362
 
2465
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2466
- exec_step 'prepare-docker-compose --directory leftorium && cp docker-compose-qainit.yml docker-compose.yml'
2467
- [
2468
- "docker-compose build web",
2469
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2470
- '-c' 'mix local.hex --force && mix hex.info && \
2471
- mix deps.get && mix compile && mix deps.compile && \
2472
- rm -rf _build/qa/rel/ && \
2473
- mix release --env=qa'"
2474
- ].each do |cmd|
2475
- execute_command cmd
2476
- end
2363
+ if @qainit
2364
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2365
+ exec_step 'prepare-docker-compose --directory fidaty && cp docker-compose-qainit.yml docker-compose.yml'
2366
+ [
2367
+ "docker-compose build web",
2368
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2369
+ '-c' 'mix local.hex --force && mix hex.info && \
2370
+ mix deps.get && mix compile && mix deps.compile && \
2371
+ mix phx.digest && \
2372
+ rm -rf _build/qa/rel/ && \
2373
+ mix release --env=qa'"
2374
+ ].each do |cmd|
2375
+ execute_command cmd
2376
+ end
2477
2377
 
2478
- cleanup_containers
2378
+ cleanup_containers
2379
+ else
2380
+ [
2381
+ "docker-compose build web",
2382
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh fidaty_web \
2383
+ '-c' 'mix local.hex --force && mix hex.info && \
2384
+ mix deps.get && mix compile && mix deps.compile && \
2385
+ mix phx.digest && \
2386
+ rm -rf _build/qa/rel/ && \
2387
+ mix release --env=qa'"
2388
+ ].each do |cmd|
2389
+ execute_command cmd
2390
+ end
2391
+ end
2479
2392
 
2480
- artifact_path = Dir.glob('_build/qa/rel/leftorium/releases/*/leftorium.tar.gz').first
2481
- upload_artifact(artifact_path, "microservices/leftorium/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2393
+ artifact_path = Dir.glob("_build/qa/rel/fidaty/releases/*/fidaty.tar.gz").first
2394
+ upload_artifact(artifact_path, "microservices/fidaty/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2482
2395
 
2483
2396
  Dir.chdir '../../'
2484
2397
  end
@@ -2492,20 +2405,33 @@ class Release
2492
2405
 
2493
2406
  decrypt_secrets() unless File.exist?('config/secrets.yml')
2494
2407
 
2495
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2496
- exec_step 'prepare-docker-compose --directory peano && cp docker-compose-qainit.yml docker-compose.yml'
2497
- [
2498
- "docker-compose build web",
2499
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2500
- '-c' 'mix local.hex --force && mix hex.info && \
2501
- mix deps.get && mix compile && mix deps.compile && \
2502
- rm -rf _build/qa/rel/ && \
2503
- mix release --env=qa'"
2504
- ].each do |cmd|
2505
- execute_command cmd
2506
- end
2408
+ if @qainit
2409
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2410
+ exec_step 'prepare-docker-compose --directory peano && cp docker-compose-qainit.yml docker-compose.yml'
2411
+ [
2412
+ "docker-compose build web",
2413
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2414
+ '-c' 'mix local.hex --force && mix hex.info && \
2415
+ mix deps.get && mix compile && mix deps.compile && \
2416
+ rm -rf _build/qa/rel/ && \
2417
+ mix release --env=qa'"
2418
+ ].each do |cmd|
2419
+ execute_command cmd
2420
+ end
2507
2421
 
2508
- cleanup_containers
2422
+ cleanup_containers
2423
+ else
2424
+ [
2425
+ "docker-compose build web",
2426
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh peano_web \
2427
+ '-c' 'mix local.hex --force && mix hex.info && \
2428
+ mix deps.get && mix compile && mix deps.compile && \
2429
+ rm -rf _build/qa/rel/ && \
2430
+ mix release --env=qa'"
2431
+ ].each do |cmd|
2432
+ execute_command cmd
2433
+ end
2434
+ end
2509
2435
 
2510
2436
  artifact_path = Dir.glob("_build/qa/rel/peano/releases/*/peano.tar.gz").first
2511
2437
  upload_artifact(artifact_path, "microservices/peano/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
@@ -2513,100 +2439,150 @@ class Release
2513
2439
  Dir.chdir '../../'
2514
2440
  end
2515
2441
 
2516
- def create_prima_artifact(revision, branch_name, deploy_id, minimal = false)
2517
- output "Preparo l'artifact prima .zip\n".yellow
2442
+ def create_rogoreport_artifact(revision)
2443
+ output "Preparo l'artifact rogoreport .zip\n".yellow
2518
2444
 
2519
- git_checkout_version('prima', revision)
2445
+ git_checkout_version('rogoreport', revision)
2520
2446
 
2521
- Dir.chdir 'projects/prima'
2447
+ Dir.chdir 'projects/rogoreport'
2522
2448
 
2523
- ['vendor'].each do |dir|
2524
- unless File.directory?(dir)
2525
- if File.directory?("../../../prima/#{dir}")
2526
- exec_step "rsync -a ../../../prima/#{dir} ."
2527
- end
2449
+ decrypt_secrets() unless File.exist?('config/secrets.yml')
2450
+
2451
+ if @qainit
2452
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2453
+ exec_step 'prepare-docker-compose --directory rogoreport && cp docker-compose-qainit.yml docker-compose.yml'
2454
+ [
2455
+ "docker-compose build web",
2456
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2457
+ '-c' 'mix local.hex --force && mix hex.info && \
2458
+ mix deps.get && mix compile && mix deps.compile && \
2459
+ rm -rf _build/qa/rel/ && \
2460
+ mix release --name=rogoreport --env=qa'"
2461
+ ].each do |cmd|
2462
+ execute_command cmd
2528
2463
  end
2529
- end
2530
2464
 
2531
- exec_step 'mv docker-compose-ci.yml docker-compose.yml'
2532
- exec_step 'prepare-docker-compose --directory prima'
2533
- exec_step 'sed -i "s/\\/home\\/app/\\/root/g" docker-compose.yml'
2534
- `sed -i 's/"@prima-assicurazioni/pyxis-npm": ".*",/"@prima-assicurazioni/pyxis-npm": "#{@pyxis_version}",/' package.json` if deploy_pyxis?
2535
- [
2536
- "bin/qa_build_artifact.sh #{branch_name} #{'update' if @deploy_update}"
2537
- ].each do |cmd|
2538
- execute_command cmd
2465
+ cleanup_containers
2466
+ else
2467
+ [
2468
+ "docker-compose build web",
2469
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh rogoreport_web \
2470
+ '-c' 'cat apps/escile/config/qa.exs && \
2471
+ mix local.hex --force && mix hex.info && \
2472
+ mix deps.get && mix compile && mix deps.compile && \
2473
+ rm -rf _build/qa/rel/ && \
2474
+ mix release --env=qa'"
2475
+ ].each do |cmd|
2476
+ execute_command cmd
2477
+ end
2539
2478
  end
2540
2479
 
2541
- cleanup_containers
2480
+ artifact_path = Dir.glob("_build/qa/rel/rogoreport/releases/*/rogoreport.tar.gz").first
2481
+ upload_artifact(artifact_path, "microservices/rogoreport/rogoreport-#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2542
2482
 
2543
- Dir.chdir "../../"
2483
+ Dir.chdir '../../'
2544
2484
  end
2545
2485
 
2546
- def create_pyxis_artifact(revision, deploy_id)
2547
- if (deploy_pyxis?)
2548
- output "Preparo l'artifact pyxis\n".yellow
2486
+ def create_assange_artifact(revision)
2487
+ output "Preparo l'artifact assange .zip\n".yellow
2549
2488
 
2550
- git_checkout_version('pyxis-npm', revision)
2489
+ git_checkout_version('assange', revision)
2551
2490
 
2552
- Dir.chdir 'projects/pyxis-npm'
2491
+ Dir.chdir 'projects/assange'
2553
2492
 
2554
- decrypt_secrets()
2493
+ decrypt_secrets()
2555
2494
 
2556
- exec_step 'mv .fakenpmrc .npmrc'
2495
+ if @qainit
2557
2496
  exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2558
- exec_step 'prepare-docker-compose --directory pyxis-npm && cp docker-compose-qainit.yml docker-compose.yml'
2559
- exec_step 'docker-compose build web'
2560
-
2561
- exec_step "docker-compose run -w $PWD -u root -e NPM_TOKEN=$NPM_TOKEN --entrypoint /bin/sh web \
2562
- '-c' 'npm view prima-assicurazioni/pyxis-npm versions --json > versions.json'" # posso recuperare le versioni pubblicate solo da dentro al container, scrivo su un file che leggo subito dopo
2563
- published_versions = `cat versions.json`
2564
- qa_versions = JSON.parse(published_versions).select{ |version| version.include? get_pyxis_version(deploy_id) }
2565
-
2566
- @pyxis_version = "0.#{get_pyxis_version(deploy_id)}.#{qa_versions.size}"
2567
-
2568
- `sed -i '3s/".*/"version": "#{@pyxis_version}",/' package.json`
2497
+ exec_step 'prepare-docker-compose --directory assange && cp docker-compose-qainit.yml docker-compose.yml'
2569
2498
  [
2570
- "docker-compose run -w $PWD -u root -e NPM_TOKEN=$NPM_TOKEN --entrypoint /bin/sh web \
2571
- '-c' 'yarn install && \
2572
- yarn build:prod && \
2573
- npm publish'"
2499
+ "docker-compose build web",
2500
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2501
+ '-c' 'mix local.hex --force && mix hex.info && \
2502
+ mix deps.get && mix compile && mix deps.compile && \
2503
+ mix phx.digest && \
2504
+ rm -rf _build/qa/rel/ && \
2505
+ mix release --env=qa'"
2574
2506
  ].each do |cmd|
2575
2507
  execute_command cmd
2576
2508
  end
2577
2509
 
2578
2510
  cleanup_containers
2579
- Dir.chdir '../../'
2511
+ else
2512
+ [
2513
+ "docker-compose build web",
2514
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh assange_web \
2515
+ '-c' 'mix local.hex --force && mix hex.info && \
2516
+ mix deps.get && mix compile && mix deps.compile && \
2517
+ mix phx.digest && \
2518
+ rm -rf _build/qa/rel/ && \
2519
+ mix release --env=qa'"
2520
+ ].each do |cmd|
2521
+ execute_command cmd
2522
+ end
2580
2523
  end
2524
+
2525
+ artifact_path = Dir.glob("_build/qa/rel/assange/releases/*/assange.tar.gz").first
2526
+ upload_artifact(artifact_path, "microservices/assange/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2527
+
2528
+ Dir.chdir '../../'
2581
2529
  end
2582
2530
 
2583
- def create_rachele_artifact(revision)
2584
- output "Preparo l'artifact rachele .zip\n".yellow
2531
+ def create_activia_artifact(revision)
2532
+ output "Preparo l'artifact activia .zip\n".yellow
2585
2533
 
2586
- git_checkout_version('rachele', revision)
2534
+ git_checkout_version('activia', revision)
2587
2535
 
2588
- Dir.chdir 'projects/rachele'
2536
+ Dir.chdir 'projects/activia'
2589
2537
 
2590
2538
  decrypt_secrets()
2591
2539
 
2592
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2593
- exec_step 'prepare-docker-compose --directory rachele && cp docker-compose-qainit.yml docker-compose.yml'
2594
-
2595
- execute_command "docker-compose build web"
2540
+ if @qainit
2541
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2542
+ exec_step 'prepare-docker-compose --directory activia && cp docker-compose-qainit.yml docker-compose.yml'
2543
+ [
2544
+ "docker-compose build web",
2545
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2546
+ '-c' 'mix local.hex --force && mix hex.info && \
2547
+ mix deps.get && mix compile && mix deps.compile && \
2548
+ cd assets && \
2549
+ rm -rf node_modules && \
2550
+ yarn --cache-folder ~/.cache/yarn && \
2551
+ sysconfcpus -n 2 ./node_modules/.bin/webpack --mode production && \
2552
+ cd .. && \
2553
+ mix phx.digest && \
2554
+ rm -rf _build/qa/rel/ && \
2555
+ mix release --env=qa'"
2556
+ ].each do |cmd|
2557
+ execute_command cmd
2558
+ end
2596
2559
 
2597
- [ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2598
- '-c' 'mix local.hex --force && mix hex.info && \
2599
- mix deps.get && mix compile && mix deps.compile && \
2600
- rm -rf _build/qa/rel/ && \
2601
- mix release --env=qa'"
2602
- ].each do |cmd|
2603
- execute_command cmd
2560
+ cleanup_containers
2561
+ else
2562
+ [
2563
+ "docker-compose build web",
2564
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh activia_web \
2565
+ '-c' 'mix local.hex --force && mix hex.info && \
2566
+ mix deps.get && mix compile && mix deps.compile && \
2567
+ cd assets && \
2568
+ rm -rf node_modules && \
2569
+ yarn --cache-folder ~/.cache/yarn && \
2570
+ sysconfcpus -n 2 ./node_modules/.bin/webpack --mode production && \
2571
+ cd .. && \
2572
+ mix phx.digest && \
2573
+ rm -rf _build/qa/rel/ && \
2574
+ mix release --env=qa'"
2575
+ ].each do |cmd|
2576
+ execute_command cmd
2577
+ end
2604
2578
  end
2605
2579
 
2606
- cleanup_containers
2607
-
2608
- artifact_path = Dir.glob("_build/qa/rel/rachele/releases/*/rachele.tar.gz").first
2609
- upload_artifact(artifact_path, "microservices/rachele/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2580
+ if @qainit
2581
+ artifact_path = Dir.glob("_build/qa/rel/activia/releases/*/activia.tar.gz").first
2582
+ else
2583
+ artifact_path = Dir.glob("_build/qa/rel/activia/releases/*/activia.tar.gz").first
2584
+ end
2585
+ upload_artifact(artifact_path, "microservices/activia/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2610
2586
 
2611
2587
  Dir.chdir '../../'
2612
2588
  end
@@ -2620,54 +2596,101 @@ class Release
2620
2596
 
2621
2597
  decrypt_secrets()
2622
2598
 
2623
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2624
- exec_step 'prepare-docker-compose --directory roger && cp docker-compose-qainit.yml docker-compose.yml'
2625
- [
2626
- "docker-compose build web",
2627
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2628
- '-c' 'mix local.hex --force && mix hex.info && \
2629
- mix deps.get && mix compile && mix deps.compile && \
2630
- mix phx.digest && \
2631
- rm -rf _build/qa/rel/ && \
2632
- mix release --env=qa'"
2633
- ].each do |cmd|
2634
- execute_command cmd
2635
- end
2599
+ if @qainit
2600
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2601
+ exec_step 'prepare-docker-compose --directory roger && cp docker-compose-qainit.yml docker-compose.yml'
2602
+ [
2603
+ "docker-compose build web",
2604
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2605
+ '-c' 'mix local.hex --force && mix hex.info && \
2606
+ mix deps.get && mix compile && mix deps.compile && \
2607
+ mix phx.digest && \
2608
+ rm -rf _build/qa/rel/ && \
2609
+ mix release --env=qa'"
2610
+ ].each do |cmd|
2611
+ execute_command cmd
2612
+ end
2636
2613
 
2637
- cleanup_containers
2614
+ cleanup_containers
2615
+ else
2616
+ [
2617
+ "docker-compose build web",
2618
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh roger_web \
2619
+ '-c' 'mix local.hex --force && mix hex.info && \
2620
+ mix deps.get && mix compile && mix deps.compile && \
2621
+ mix phx.digest && \
2622
+ rm -rf _build/qa/rel/ && \
2623
+ mix release --env=qa'"
2624
+ ].each do |cmd|
2625
+ execute_command cmd
2626
+ end
2627
+ end
2638
2628
 
2639
- artifact_path = Dir.glob("_build/qa/rel/roger/releases/*/roger.tar.gz").first
2629
+ if @qainit
2630
+ artifact_path = Dir.glob("_build/qa/rel/roger/releases/*/roger.tar.gz").first
2631
+ else
2632
+ artifact_path = Dir.glob("_build/qa/rel/roger/releases/*/roger.tar.gz").first
2633
+ end
2640
2634
  upload_artifact(artifact_path, "microservices/roger/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2641
2635
 
2642
2636
  Dir.chdir '../../'
2643
2637
  end
2644
2638
 
2645
- def create_rogoreport_artifact(revision)
2646
- output "Preparo l'artifact rogoreport .zip\n".yellow
2639
+ def create_borat_artifact(revision)
2640
+ output "Preparo l'artifact borat .zip\n".yellow
2647
2641
 
2648
- git_checkout_version('rogoreport', revision)
2642
+ git_checkout_version('borat', revision)
2649
2643
 
2650
- Dir.chdir 'projects/rogoreport'
2644
+ Dir.chdir 'projects/borat'
2651
2645
 
2652
- decrypt_secrets() unless File.exist?('config/secrets.yml')
2646
+ decrypt_secrets()
2653
2647
 
2654
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2655
- exec_step 'prepare-docker-compose --directory rogoreport && cp docker-compose-qainit.yml docker-compose.yml'
2656
- [
2657
- "docker-compose build web",
2658
- "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2659
- '-c' 'mix local.hex --force && mix hex.info && \
2660
- mix deps.get && mix compile && mix deps.compile && \
2661
- rm -rf _build/qa/rel/ && \
2662
- mix release --name=rogoreport --env=qa'"
2663
- ].each do |cmd|
2664
- execute_command cmd
2665
- end
2648
+ if @qainit
2649
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2650
+ exec_step 'prepare-docker-compose --directory borat && cp docker-compose-qainit.yml docker-compose.yml'
2651
+ [
2652
+ "docker network create borat_network || true",
2653
+ "docker-compose build web",
2654
+ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2655
+ '-c' 'mix local.hex --force && mix hex.info && \
2656
+ mix deps.get && \
2657
+ cd assets && \
2658
+ yarn --cache-folder ~/.cache/yarn && \
2659
+ ./node_modules/.bin/elm-github-install && \
2660
+ sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
2661
+ cd ../ && \
2662
+ mix phx.digest && \
2663
+ mix compile && mix deps.compile && \
2664
+ rm -rf _build/qa/rel/ && \
2665
+ mix release --env=qa'"
2666
+ ].each do |cmd|
2667
+ execute_command cmd
2668
+ end
2666
2669
 
2667
- cleanup_containers
2670
+ cleanup_containers
2671
+ else
2672
+ [
2673
+ "docker network create borat_network || true",
2674
+ "docker-compose build web",
2675
+ "docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh web \
2676
+ '-c' 'mix local.hex --force && mix hex.info && \
2677
+ mix deps.get && \
2678
+ cd assets && \
2679
+ yarn --cache-folder ~/.cache/yarn && \
2680
+ ./node_modules/.bin/elm-github-install && \
2681
+ sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
2682
+ cd ../ && \
2683
+ mix phx.digest && \
2684
+ mix compile && mix deps.compile && \
2685
+ rm -rf _build/qa/rel/ && \
2686
+ mix release --env=qa'"
2687
+ ].each do |cmd|
2688
+ execute_command cmd
2689
+ end
2690
+ end
2668
2691
 
2669
- artifact_path = Dir.glob("_build/qa/rel/rogoreport/releases/*/rogoreport.tar.gz").first
2670
- upload_artifact(artifact_path, "microservices/rogoreport/rogoreport-#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2692
+ artifact_path = Dir.glob("_build/qa/rel/borat/releases/*/borat.tar.gz").first
2693
+ upload_artifact(artifact_path, "microservices/borat/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2671
2694
 
2672
2695
  Dir.chdir '../../'
2673
2696
  end
@@ -2690,103 +2713,81 @@ class Release
2690
2713
  Dir.chdir '../../'
2691
2714
  end
2692
2715
 
2693
- def create_starsky_artifact(revision)
2694
- output "Preparo l'artifact starsky\n".yellow
2695
-
2696
- git_checkout_version('starsky', revision)
2697
-
2698
- Dir.chdir 'projects/starsky'
2699
-
2700
- version = `git rev-parse HEAD`
2701
-
2702
- #artifact_path = "/tmp/starsky-#{revision}-qa.tar.gz"
2716
+ def create_prima_artifact(revision, branch_name, deploy_id, minimal = false)
2717
+ output "Preparo l'artifact prima .zip\n".yellow
2703
2718
 
2704
- decrypt_secrets() unless File.exist?('config/secrets.yml')
2719
+ git_checkout_version('prima', revision)
2705
2720
 
2706
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2707
- exec_step 'prepare-docker-compose --directory starsky && cp docker-compose-qainit.yml docker-compose.yml'
2708
- exec_step "sed s/qa_deploy_id/#{get_deploy_id}/ .env.dist.qa"
2709
- exec_step "cp .env.dist.qa .env"
2710
- exec_step "cat docker-compose.yml"
2721
+ Dir.chdir 'projects/prima'
2711
2722
 
2712
- [
2713
- "sed -i 's/USER app/USER root/g' Dockerfile",
2714
- "docker-compose build web",
2715
- "docker-compose run -w $PWD -u root --entrypoint /bin/sh web \
2716
- '-c' 'cargo build --release -vv \
2717
- && cargo build --bin migrate --release \
2718
- && cargo build --bin rabbit_worker --release \
2719
- && cp -p target/release/starsky . \
2720
- && cp -p target/release/migrate . \
2721
- && cp -p target/release/rabbit_worker . \
2722
- && tar cfz #{revision}-qa.tar.gz config starsky migrate rabbit_worker .env.dist.*'"
2723
- ].each do |cmd|
2724
- execute_command cmd
2723
+ ['vendor'].each do |dir|
2724
+ unless File.directory?(dir)
2725
+ if File.directory?("../../../prima/#{dir}")
2726
+ exec_step "rsync -a ../../../prima/#{dir} ."
2727
+ end
2728
+ end
2725
2729
  end
2726
2730
 
2727
- artifact_path = "./#{revision}-qa.tar.gz"
2731
+ if @qainit
2732
+ exec_step 'mv docker-compose-ci.yml docker-compose.yml'
2733
+ exec_step 'prepare-docker-compose --directory prima'
2734
+ exec_step 'sed -i "s/\\/home\\/app/\\/root/g" docker-compose.yml'
2735
+ `sed -i 's/"@prima-assicurazioni/pyxis-npm": ".*",/"@prima-assicurazioni/pyxis-npm": "#{@pyxis_version}",/' package.json` if deploy_pyxis?
2736
+ [
2737
+ "bin/qa_build_artifact.sh #{branch_name} #{'update' if @deploy_update}"
2738
+ ].each do |cmd|
2739
+ execute_command cmd
2740
+ end
2728
2741
 
2729
- upload_artifact(artifact_path, "microservices/starsky/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2742
+ cleanup_containers
2743
+ else
2744
+ [
2745
+ "bin/local_build_artifact.sh #{branch_name} #{'update' if @deploy_update}"
2746
+ ].each do |cmd|
2747
+ execute_command cmd
2748
+ end
2749
+ end
2730
2750
 
2731
- Dir.chdir '../../'
2751
+ Dir.chdir "../../"
2732
2752
  end
2733
2753
 
2734
- def create_urania_artifact(revision)
2735
- output "Preparo l'artifact urania .zip\n".yellow
2736
-
2737
- git_checkout_version('urania', revision)
2738
-
2739
- Dir.chdir 'projects/urania'
2740
-
2741
- decrypt_secrets()
2742
-
2743
- exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2744
- exec_step 'prepare-docker-compose --directory urania && cp docker-compose-qainit.yml docker-compose.yml'
2754
+ def create_pyxis_artifact(revision, deploy_id)
2755
+ if (deploy_pyxis?)
2756
+ output "Preparo l'artifact pyxis\n".yellow
2745
2757
 
2746
- execute_command "docker-compose build web"
2758
+ git_checkout_version('pyxis-npm', revision)
2747
2759
 
2748
- [ "docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
2749
- '-c' 'mix local.hex --force && mix hex.info && \
2750
- mix deps.get && mix compile && mix deps.compile && \
2751
- rm -rf _build/qa/rel/ && \
2752
- mix release --env=qa'"
2753
- ].each do |cmd|
2754
- execute_command cmd
2755
- end
2760
+ Dir.chdir 'projects/pyxis-npm'
2756
2761
 
2757
- cleanup_containers
2762
+ decrypt_secrets()
2758
2763
 
2759
- artifact_path = Dir.glob("_build/qa/rel/urania/releases/*/urania.tar.gz").first
2760
- upload_artifact(artifact_path, "microservices/urania/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2764
+ exec_step 'mv .fakenpmrc .npmrc'
2765
+ exec_step 'cp docker-compose.yml docker-compose-ci.yml'
2766
+ exec_step 'prepare-docker-compose --directory pyxis-npm && cp docker-compose-qainit.yml docker-compose.yml'
2767
+ exec_step 'docker-compose build web'
2761
2768
 
2762
- Dir.chdir '../../'
2763
- end
2769
+ exec_step "docker-compose run -w $PWD -u root -e NPM_TOKEN=$NPM_TOKEN --entrypoint /bin/sh web \
2770
+ '-c' 'npm view prima-assicurazioni/pyxis-npm versions --json > versions.json'" # posso recuperare le versioni pubblicate solo da dentro al container, scrivo su un file che leggo subito dopo
2771
+ published_versions = `cat versions.json`
2772
+ qa_versions = JSON.parse(published_versions).select{ |version| version.include? get_pyxis_version(deploy_id) }
2764
2773
 
2765
- def deploy_pyxis?
2766
- if defined? @deploy_pyxis
2767
- @deploy_pyxis
2768
- else
2769
- pyxis_updated = `git log -p -1 --unified=0 | grep pyxis-npm:`.length > 0
2774
+ @pyxis_version = "0.#{get_pyxis_version(deploy_id)}.#{qa_versions.size}"
2770
2775
 
2771
- update_pyxis = !@projects['pyxis-npm'].empty? && @projects['pyxis-npm'][:name] != 'master' && pyxis_updated
2776
+ `sed -i '3s/".*/"version": "#{@pyxis_version}",/' package.json`
2777
+ [
2778
+ "docker-compose run -w $PWD -u root -e NPM_TOKEN=$NPM_TOKEN --entrypoint /bin/sh web \
2779
+ '-c' 'yarn install && \
2780
+ yarn build:prod && \
2781
+ npm publish'"
2782
+ ].each do |cmd|
2783
+ execute_command cmd
2784
+ end
2772
2785
 
2773
- @deploy_pyxis = update_pyxis
2774
- return update_pyxis
2786
+ cleanup_containers
2787
+ Dir.chdir '../../'
2775
2788
  end
2776
2789
  end
2777
2790
 
2778
- def deploy_crash?
2779
- crash_present = !@projects['crash'].empty? && @projects['crash'][:name] != 'master' && !@projects['crash'][:default_branch]
2780
- leftorium_present = !@projects['leftorium'].empty? && @projects['leftorium'][:name] != 'master' && !@projects['leftorium'][:default_branch]
2781
- crash_present || leftorium_present
2782
- end
2783
-
2784
- def deploy_starsky_hutch?
2785
- starsky_present = !@projects['starsky'].nil? && !@projects['starsky'].empty? && @projects['starsky'][:name] != 'master' && !@projects['starsky'][:default_branch]
2786
- hutch_present = !@projects['hutch'].nil? &&!@projects['hutch'].empty? && @projects['hutch'][:name] != 'master' && !@projects['hutch'][:default_branch]
2787
- starsky_present || hutch_present
2788
- end
2789
-
2790
2791
  def get_pyxis_version(deploy_id)
2791
2792
  (deploy_id.delete '[a-z0]')[0..9]
2792
2793
  end
@@ -3057,11 +3058,20 @@ class Release
3057
3058
 
3058
3059
  def decrypt_secrets()
3059
3060
  docker_image = "prima/biscuit_populate_configs"
3060
- [
3061
- "docker pull #{docker_image}",
3062
- "docker run -t --rm -v $HOME/.aws:/root/.aws -w $PWD --volumes-from #{get_host_container_name} #{docker_image}"
3063
- ].each do |cmd|
3064
- execute_command cmd
3061
+ if @qainit
3062
+ [
3063
+ "docker pull #{docker_image}",
3064
+ "docker run -t --rm -v $HOME/.aws:/root/.aws -w $PWD --volumes-from #{get_host_container_name} #{docker_image}"
3065
+ ].each do |cmd|
3066
+ execute_command cmd
3067
+ end
3068
+ else
3069
+ [
3070
+ "docker pull #{docker_image}",
3071
+ "docker run -t --rm -v $HOME/.aws:/root/.aws -v $PWD:$PWD -w $PWD #{docker_image}"
3072
+ ].each do |cmd|
3073
+ execute_command cmd
3074
+ end
3065
3075
  end
3066
3076
  end
3067
3077