prima-twig 0.61.0 → 0.61.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/twig-feature +79 -36
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b7fe6e793d7918dae758d6a790bdd77c00443c88f935aef69cdcbd6fbc59e38
4
- data.tar.gz: c554ac218300687b47366785c270df602783f04c1003363d471597abbca10ac6
3
+ metadata.gz: d1f901fa85dff088af048908aefe806ab5bb2f0fb5074173a2eb03590be8d4a0
4
+ data.tar.gz: ea6b014c6164171fd9e8ef3536638444673377cc99bd0b25b0988234235ff65d
5
5
  SHA512:
6
- metadata.gz: d463ea20979d3e7d8832a1ba536257ea3e4e0457ef047221c9862f41a7f74bd03d405270922d893f7d89f9aac13a2f4057c395bd6408f0eb86cc68d34c56e87d
7
- data.tar.gz: aea5c6b038bb65da4ef094ce1c5dc5fc2347d4e2dd83b179047cd56b516d2f5b5d85d5095c3783a87586f4b184945b252fc00a8098903e1c4aa074a7bf728ca7
6
+ metadata.gz: b22a956b0e59fbca53b09ddbdd4adaaa37aff9cfed095f5360a9f441d90932426fd4667f21de9c69d0c320d03842e618f7ee0d014399508878931c9390687013
7
+ data.tar.gz: 5bb0f1a76f27750b1901d473f6ca6e82e403f642f0b5cc42e8e2f07f87c3c1f44b1303dd0655edd2d78f73d3ff5fa9ef2af6bd8f6980200d50d63e4dada02a92
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(@prima.config['cloudflare_email'], @prima.config['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']}-#{@dns_record_identifier[0..7]}-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")
756
756
 
757
757
 
758
758
  wait_for_db_import(db_task) unless stack_exists?("ecs-route53-qa-#{deploy_id}") # dovrebbe essere istantaneo
@@ -1845,33 +1845,13 @@ class Release
1845
1845
 
1846
1846
  if @projects['prima']['name'] != 'master' then
1847
1847
  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
-
1848
+ launch_bocelli_test(prima_hostname)
1874
1849
  output "Visual regression lanciata con successo!"
1850
+
1851
+ output "Lancio i test con Lighthouse..."
1852
+ launch_lighthouse_test(prima_hostname, "mobile")
1853
+ launch_lighthouse_test(prima_hostname, "desktop")
1854
+ output "Test con Lighthouse lanciati con successo..."
1875
1855
  end
1876
1856
 
1877
1857
  qainit_write_output(projects_text, 'Indirizzi scritti su ')
@@ -2028,6 +2008,69 @@ class Release
2028
2008
  update_ecs_service(@ecs_cluster_name, resp.stack_resource_detail.physical_resource_id, {minimum_healthy_percent: 0, maximum_percent: 100})
2029
2009
  end
2030
2010
 
2011
+ def launch_lighthouse_test(url, device)
2012
+ @cloudflare.post("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {type: 'CNAME', name: "test-qa-#{@dns_record_identifier}", content: url, proxied: true, ttl: 1}) unless get_lighthouse_dns()
2013
+
2014
+ @batch.submit_job({
2015
+ job_name: "lighthouse-#{device}-#{@dns_record_identifier}",
2016
+ job_queue: "tools-production",
2017
+ job_definition: describe_stack_resource('batch-job-lighthouse-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
2018
+ container_overrides: {
2019
+ environment: [
2020
+ {
2021
+ name: "URL_TO_TEST",
2022
+ value: "test-qa-#{@dns_record_identifier}.prima.it"
2023
+ },
2024
+ {
2025
+ name: "DEVICE",
2026
+ value: device
2027
+ }
2028
+ ]
2029
+ }
2030
+ })
2031
+ end
2032
+
2033
+ def get_lighthouse_dns()
2034
+ dns_records = @cloudflare.get("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {per_page: 100, type: 'CNAME', name: "test-qa-#{@dns_record_identifier}.prima.it"})
2035
+ if dns_records.body[:result_info][:count] > 0
2036
+ return dns_records.body[:result][0][:id]
2037
+ end
2038
+ false
2039
+ end
2040
+
2041
+ def delete_lighthouse_dns()
2042
+ dns_id = get_lighthouse_dns()
2043
+ @cloudflare.delete("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns_id}") if dns_id
2044
+ end
2045
+
2046
+ def launch_bocelli_test(url)
2047
+ @batch.submit_job({
2048
+ job_name: "bocelli-test-#{@dns_record_identifier}",
2049
+ job_queue: "tools-production",
2050
+ job_definition: describe_stack_resource('batch-job-bocelli-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
2051
+ container_overrides: {
2052
+ environment: [
2053
+ {
2054
+ name: "BATCH_COMMAND",
2055
+ value: "test"
2056
+ },
2057
+ {
2058
+ name: "QA_HOSTNAME",
2059
+ value: url
2060
+ },
2061
+ {
2062
+ name: "BRANCH_NAME",
2063
+ value: @projects['prima']['name']
2064
+ },
2065
+ {
2066
+ name: "COMMITTER_EMAIL",
2067
+ value: @projects['prima']['committer']
2068
+ }
2069
+ ]
2070
+ }
2071
+ })
2072
+ end
2073
+
2031
2074
  def create_activia_artifact(revision)
2032
2075
  output "Preparo l'artifact activia .zip\n".yellow
2033
2076
 
@@ -2305,7 +2348,7 @@ class Release
2305
2348
  cleanup_containers
2306
2349
 
2307
2350
  artifact_path = "./hutch.tar.gz"
2308
- upload_artifact(artifact_path, "microservices/hutch/#{revision}-#{@dns_record_identifier[0..7]}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2351
+ upload_artifact(artifact_path, "microservices/hutch/#{revision}-qa.tar.gz", "#{@s3_bucket}-encrypted")
2309
2352
 
2310
2353
  Dir.chdir '../../'
2311
2354
  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.61.0
4
+ version: 0.61.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino