prima-twig 0.60.1 → 0.60.555

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 +81 -42
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56ce558813defba2480fe8910528be1a17064539d527de6fea46feb22f7a3191
4
- data.tar.gz: '0518d8943dcbae7fe085b736ba4b39296b8e049897ddc960298e537cceccc0ff'
3
+ metadata.gz: 602d4be4494c5f7794db87c2e03995304d550be0dce16d54644b7d7e4157c736
4
+ data.tar.gz: 60d1f1d0ead4a89144904df37e9ea02058dc0df8cd0726bf8a3351302dd9500c
5
5
  SHA512:
6
- metadata.gz: 9f21f08fb02c7911d59fc467906d5eca3c3a5bd39471bc002dc11d10e6b0de9346e976eaaa4ba6a89e1848320cacc8f17a005ddb2e09978e94a5c93b923460a8
7
- data.tar.gz: 511442330f4de649392154ea025606fa9046daef7db8be2b31a287ff8fbc8ca92b1642062bf9fe49a73a75be1810715c631908296d84d957bb8c0370a81641f2
6
+ metadata.gz: 83b125d6edb979a5f2bc346d1fe2f686d4e530f37d37923e2e44fb88f08b09c7db6973bf148c2d7b79e15d287cd4ef89814bdd6c5d15a02d70476f0c3dccebaa
7
+ data.tar.gz: d5fd8d7f29bd29eb4fd4ec81ba334840dbd99e5a3b60a7c679014956e404a9ddd87e86856d35589357f633ea17daa1039860007b75aedb4fa1ff870c025f868e
data/bin/twig-feature CHANGED
@@ -59,6 +59,7 @@ class Release
59
59
  @base_stack_name_alb = 'ecs-alb-http-public-qa-'
60
60
  @base_stack_name_alb_ws = 'ecs-alb-ws-public-qa-'
61
61
  @git_branch = ''
62
+ @cloudflare = Rubyflare.connect_with(ENV['CLOUDFLARE_EMAIL'], ENV['CLOUDFLARE_APIKEY'])
62
63
  end
63
64
 
64
65
  def execute!(args)
@@ -139,7 +140,6 @@ class Release
139
140
  output 'Disable aggregator'
140
141
 
141
142
  output "Recupero le informazioni relative al puntamento dei record DNS..."
142
- cloudflare = Rubyflare.connect_with(@prima.config['cloudflare_email'], @prima.config['cloudflare_apikey'])
143
143
  output "Recupero le informazioni sui QA attivi..."
144
144
  stack_list, envs = get_stacks()
145
145
 
@@ -151,7 +151,7 @@ class Release
151
151
  end.is_a?(Aws::CloudFormation::Types::Tag)
152
152
  aggregator_enabled
153
153
  end[0]
154
- dns_records = cloudflare.get("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {per_page: 100, type: 'CNAME', content: get_alb_host(@base_stack_name_alb + env_hash[3..8])})
154
+ dns_records = @cloudflare.get("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {per_page: 100, type: 'CNAME', content: get_alb_host(@base_stack_name_alb + env_hash[3..8])})
155
155
  stop_if dns_records.body[:result].empty?, "I record DNS degli aggregatori non stanno puntando ad un QA".red
156
156
  change_hostname_priority(env_hash, hostname_pattern_priority())
157
157
  dns_to_staging(env_hash)
@@ -167,8 +167,7 @@ class Release
167
167
  output 'Enable aggregator'
168
168
 
169
169
  output 'Recupero le informazioni relative al puntamento dei record DNS...'
170
- cloudflare = Rubyflare.connect_with(@prima.config['cloudflare_email'], @prima.config['cloudflare_apikey'])
171
- dns_records = cloudflare.get('zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records', { per_page: 100, type: 'CNAME', content: 'staging.prima.it' })
170
+ dns_records = @cloudflare.get('zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records', { per_page: 100, type: 'CNAME', content: 'staging.prima.it' })
172
171
  stop_if dns_records.body[:result].empty?, "I record DNS degli aggregatori stanno gia' puntando ad un QA".red
173
172
 
174
173
  output "Recupero le informazioni sui QA attivi..."
@@ -198,7 +197,7 @@ class Release
198
197
  dns_records.body[:result].each do |dns|
199
198
  if dns[:name] =~ /^\w+\-\w+\-staging\.prima\.it$/
200
199
  output "Changing #{dns[:name]} DNS record"
201
- cloudflare.put("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns[:id]}", {type: 'CNAME', name: dns[:name], content: get_alb_host(@base_stack_name_alb + env_hash[3..8]), proxied: true, ttl: 1})
200
+ @cloudflare.put("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns[:id]}", {type: 'CNAME', name: dns[:name], content: get_alb_host(@base_stack_name_alb + env_hash[3..8]), proxied: true, ttl: 1})
202
201
  end
203
202
  end
204
203
 
@@ -257,12 +256,11 @@ class Release
257
256
 
258
257
  def dns_to_staging(env_hash)
259
258
  output "Recupero le informazioni relative al puntamento dei record DNS..."
260
- cloudflare = Rubyflare.connect_with(@prima.config['cloudflare_email'], @prima.config['cloudflare_apikey'])
261
- dns_records = cloudflare.get("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {per_page: 100, type: 'CNAME', content: get_alb_host(@base_stack_name_alb + env_hash[3..8])})
259
+ dns_records = @cloudflare.get("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {per_page: 100, type: 'CNAME', content: get_alb_host(@base_stack_name_alb + env_hash[3..8])})
262
260
  dns_records.body[:result].each do |dns|
263
261
  if dns[:name] =~ /^\w+\-\w+\-staging\.prima\.it$/
264
262
  output "Changing #{dns[:name]} DNS record"
265
- cloudflare.put("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns[:id]}", {type: 'CNAME', name: dns[:name], content: 'staging.prima.it', proxied: true, ttl: 1})
263
+ @cloudflare.put("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns[:id]}", {type: 'CNAME', name: dns[:name], content: 'staging.prima.it', proxied: true, ttl: 1})
266
264
  end
267
265
  end
268
266
  end
@@ -596,6 +594,8 @@ class Release
596
594
  delete_stack(@base_stack_name_alb + env_hash[3..8]) if stack_exists?(@base_stack_name_alb + env_hash[3..8])
597
595
  delete_stack(@base_stack_name_alb_ws + env_hash[3..8]) if stack_exists?(@base_stack_name_alb_ws + env_hash[3..8])
598
596
  `git checkout master && git push origin --delete ${DRONE_BRANCH}`
597
+ output "Cancello il record DNS utilizzato da Lighthouse"
598
+ delete_lighthouse_dns()
599
599
  output "Finito!".green
600
600
 
601
601
  if @qainit
@@ -752,7 +752,7 @@ class Release
752
752
  create_skynet_artifact(@projects["skynet"]['revision']) unless artifact_exists?('prima-artifacts-encrypted', "microservices/skynet/#{@projects["skynet"]['revision']}-qa.tar.gz")
753
753
  create_maia_artifact(@projects["maia"]['revision']) unless artifact_exists?('prima-artifacts-encrypted', "microservices/maia/#{@projects["maia"]['revision']}-qa.tar.gz")
754
754
  create_starsky_artifact(@projects["starsky"]['revision']) unless !deploy_starsky_hutch? || artifact_exists?('prima-artifacts-encrypted', "microservices/starsky/#{@projects["starsky"]['revision']}-qa.tar.gz")
755
- create_hutch_artifact(@projects["hutch"]['revision']) unless !deploy_starsky_hutch? || artifact_exists?('prima-artifacts-encrypted', "microservices/hutch/#{@projects["hutch"]['revision']}-qa.tar.gz")
755
+ create_hutch_artifact(@projects["hutch"]['revision']) unless !deploy_starsky_hutch? || artifact_exists?('prima-artifacts-encrypted', "microservices/hutch/#{@projects["hutch"]['revision']}-#{@dns_record_identifier[0..7]}-qa.tar.gz")
756
756
 
757
757
 
758
758
  wait_for_db_import(db_task) unless stack_exists?("ecs-route53-qa-#{deploy_id}") # dovrebbe essere istantaneo
@@ -1532,10 +1532,6 @@ class Release
1532
1532
  parameter_key: "WebQaBaseHostname",
1533
1533
  parameter_value: "#{@dns_record_identifier}.qa.colaster.com"
1534
1534
  },
1535
- {
1536
- parameter_key: "HostnamePattern",
1537
- parameter_value: "ww*-#{@dns_record_identifier}.qa.colaster.com"
1538
- },
1539
1535
  {
1540
1536
  parameter_key: "HostnamePatternPriority",
1541
1537
  parameter_value: hostname_pattern_priority
@@ -1566,7 +1562,7 @@ class Release
1566
1562
  },
1567
1563
  {
1568
1564
  parameter_key: "HostnamePattern",
1569
- parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
1565
+ parameter_value: "www-#{@dns_record_identifier}.*"
1570
1566
  }
1571
1567
  ]
1572
1568
  if stack_exists?(stack_name_web)
@@ -1674,7 +1670,7 @@ class Release
1674
1670
  },
1675
1671
  {
1676
1672
  parameter_key: "ReleaseVersion",
1677
- parameter_value: "#{@projects["hutch"]['revision']}"
1673
+ parameter_value: "#{@projects["hutch"]['revision']}-#{@dns_record_identifier[0..7]}"
1678
1674
  },
1679
1675
  {
1680
1676
  parameter_key: "ALBShortName",
@@ -1845,33 +1841,13 @@ class Release
1845
1841
 
1846
1842
  if @projects['prima']['name'] != 'master' then
1847
1843
  output "Lancio il batch job per la visual regression..."
1848
- @batch.submit_job({
1849
- job_name: "bocelli-test-#{@dns_record_identifier}",
1850
- job_queue: "tools-production",
1851
- job_definition: describe_stack_resource('batch-job-bocelli-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
1852
- container_overrides: {
1853
- environment: [
1854
- {
1855
- name: "BATCH_COMMAND",
1856
- value: "test"
1857
- },
1858
- {
1859
- name: "QA_HOSTNAME",
1860
- value: prima_hostname
1861
- },
1862
- {
1863
- name: "BRANCH_NAME",
1864
- value: @projects['prima']['name']
1865
- },
1866
- {
1867
- name: "COMMITTER_EMAIL",
1868
- value: @projects['prima']['committer']
1869
- }
1870
- ]
1871
- }
1872
- })
1873
-
1844
+ launch_bocelli_test(prima_hostname)
1874
1845
  output "Visual regression lanciata con successo!"
1846
+
1847
+ output "Lancio i test con Lighthouse..."
1848
+ launch_lighthouse_test(prima_hostname, "mobile")
1849
+ launch_lighthouse_test(prima_hostname, "desktop")
1850
+ output "Test con Lighthouse lanciati con successo..."
1875
1851
  end
1876
1852
 
1877
1853
  qainit_write_output(projects_text, 'Indirizzi scritti su ')
@@ -2028,6 +2004,69 @@ class Release
2028
2004
  update_ecs_service(@ecs_cluster_name, resp.stack_resource_detail.physical_resource_id, {minimum_healthy_percent: 0, maximum_percent: 100})
2029
2005
  end
2030
2006
 
2007
+ def launch_lighthouse_test(url, device)
2008
+ @cloudflare.post("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {type: 'CNAME', name: "www-#{@dns_record_identifier}", content: url, proxied: true, ttl: 1}) unless get_lighthouse_dns()
2009
+
2010
+ @batch.submit_job({
2011
+ job_name: "lighthouse-#{device}-#{@dns_record_identifier}",
2012
+ job_queue: "tools-production",
2013
+ job_definition: describe_stack_resource('batch-job-lighthouse-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
2014
+ container_overrides: {
2015
+ environment: [
2016
+ {
2017
+ name: "URL_TO_TEST",
2018
+ value: "https://www-#{@dns_record_identifier}.prima.it/?superprima"
2019
+ },
2020
+ {
2021
+ name: "DEVICE",
2022
+ value: device
2023
+ }
2024
+ ]
2025
+ }
2026
+ })
2027
+ end
2028
+
2029
+ def get_lighthouse_dns()
2030
+ dns_records = @cloudflare.get("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {per_page: 100, type: 'CNAME', name: "www-#{@dns_record_identifier}.prima.it"})
2031
+ if dns_records.body[:result_info][:count] > 0
2032
+ return dns_records.body[:result][0][:id]
2033
+ end
2034
+ false
2035
+ end
2036
+
2037
+ def delete_lighthouse_dns()
2038
+ dns_id = get_lighthouse_dns()
2039
+ @cloudflare.delete("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns_id}") if dns_id
2040
+ end
2041
+
2042
+ def launch_bocelli_test(url)
2043
+ @batch.submit_job({
2044
+ job_name: "bocelli-test-#{@dns_record_identifier}",
2045
+ job_queue: "tools-production",
2046
+ job_definition: describe_stack_resource('batch-job-bocelli-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
2047
+ container_overrides: {
2048
+ environment: [
2049
+ {
2050
+ name: "BATCH_COMMAND",
2051
+ value: "test"
2052
+ },
2053
+ {
2054
+ name: "QA_HOSTNAME",
2055
+ value: url
2056
+ },
2057
+ {
2058
+ name: "BRANCH_NAME",
2059
+ value: @projects['prima']['name']
2060
+ },
2061
+ {
2062
+ name: "COMMITTER_EMAIL",
2063
+ value: @projects['prima']['committer']
2064
+ }
2065
+ ]
2066
+ }
2067
+ })
2068
+ end
2069
+
2031
2070
  def create_activia_artifact(revision)
2032
2071
  output "Preparo l'artifact activia .zip\n".yellow
2033
2072
 
@@ -2305,7 +2344,7 @@ class Release
2305
2344
  cleanup_containers
2306
2345
 
2307
2346
  artifact_path = "./hutch.tar.gz"
2308
- upload_artifact(artifact_path, "microservices/hutch/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2347
+ upload_artifact(artifact_path, "microservices/hutch/#{revision}-#{@dns_record_identifier[0..7]}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2309
2348
 
2310
2349
  Dir.chdir '../../'
2311
2350
  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.60.1
4
+ version: 0.60.555
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: 2020-02-03 00:00:00.000000000 Z
17
+ date: 2020-02-04 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: aws-sdk
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
- rubygems_version: 3.0.3
217
+ rubygems_version: 3.0.1
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: The Prima twig toolbelt