prima-twig 0.60.560 → 0.61.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: d9b76836a74bf69072c2ba470a55e8da80964c13a888df81f318b52d67bc9170
4
- data.tar.gz: a3546bc0b536ecbf63e902e8639a75983924c6d588ce4c10e95929c930606695
3
+ metadata.gz: 1b7fe6e793d7918dae758d6a790bdd77c00443c88f935aef69cdcbd6fbc59e38
4
+ data.tar.gz: c554ac218300687b47366785c270df602783f04c1003363d471597abbca10ac6
5
5
  SHA512:
6
- metadata.gz: 722adb0be551ac294cdf5fe68a03522a75d4fc129a0861a928ef60d68f3940f338c67180fefc2a9a67926c48b2157b686de3794b8ef38d27fd284fa2c978bc51
7
- data.tar.gz: 941bada5a21bccddc54126d47fb6079dddc41bcfe7992b77b5e98d4b252755c15759c6378f3661338fd72563549004562e12c8b1228294bd00c66cc0bb945fb1
6
+ metadata.gz: d463ea20979d3e7d8832a1ba536257ea3e4e0457ef047221c9862f41a7f74bd03d405270922d893f7d89f9aac13a2f4057c395bd6408f0eb86cc68d34c56e87d
7
+ data.tar.gz: aea5c6b038bb65da4ef094ce1c5dc5fc2347d4e2dd83b179047cd56b516d2f5b5d85d5095c3783a87586f4b184945b252fc00a8098903e1c4aa074a7bf728ca7
@@ -5,10 +5,7 @@ require_relative '../lib/prima_twig.rb'
5
5
  require_relative '../lib/prima_aws_client.rb'
6
6
  require 'colorize'
7
7
  require 'highline/import'
8
- require 'aws-sdk-batch'
9
- require 'aws-sdk-cloudformation'
10
- require 'aws-sdk-ecs'
11
- require 'aws-sdk-s3'
8
+ require 'aws-sdk'
12
9
  require 'redcarpet'
13
10
  require 'mail'
14
11
  require 'erb'
@@ -26,7 +26,7 @@ class Release
26
26
  @s3 = Aws::S3::Client.new
27
27
  @s3_bucket = 'prima-artifacts'
28
28
  @artifact_path = '/tmp/prima-artifact.zip'
29
- @import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-P358L3UYOC6F:1'
29
+ @import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-1BXH13XEVLPP0:1'
30
30
  @cf_role = 'arn:aws:iam::001575623345:role/qainit-service-role-cloudformat-CloudformationRole-18KBZQIS148R9'
31
31
  @dns_record_identifier = nil
32
32
  @ecs_cluster_name = nil
@@ -59,7 +59,6 @@ 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'])
63
62
  end
64
63
 
65
64
  def execute!(args)
@@ -140,6 +139,7 @@ class Release
140
139
  output 'Disable aggregator'
141
140
 
142
141
  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,7 +167,8 @@ class Release
167
167
  output 'Enable aggregator'
168
168
 
169
169
  output 'Recupero le informazioni relative al puntamento dei record DNS...'
170
- dns_records = @cloudflare.get('zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records', { per_page: 100, type: 'CNAME', content: 'staging.prima.it' })
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' })
171
172
  stop_if dns_records.body[:result].empty?, "I record DNS degli aggregatori stanno gia' puntando ad un QA".red
172
173
 
173
174
  output "Recupero le informazioni sui QA attivi..."
@@ -197,7 +198,7 @@ class Release
197
198
  dns_records.body[:result].each do |dns|
198
199
  if dns[:name] =~ /^\w+\-\w+\-staging\.prima\.it$/
199
200
  output "Changing #{dns[:name]} DNS record"
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})
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})
201
202
  end
202
203
  end
203
204
 
@@ -256,11 +257,12 @@ class Release
256
257
 
257
258
  def dns_to_staging(env_hash)
258
259
  output "Recupero le informazioni relative al puntamento dei record DNS..."
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])})
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])})
260
262
  dns_records.body[:result].each do |dns|
261
263
  if dns[:name] =~ /^\w+\-\w+\-staging\.prima\.it$/
262
264
  output "Changing #{dns[:name]} DNS record"
263
- @cloudflare.put("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns[:id]}", {type: 'CNAME', name: dns[:name], content: 'staging.prima.it', proxied: true, ttl: 1})
265
+ cloudflare.put("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns[:id]}", {type: 'CNAME', name: dns[:name], content: 'staging.prima.it', proxied: true, ttl: 1})
264
266
  end
265
267
  end
266
268
  end
@@ -594,8 +596,6 @@ class Release
594
596
  delete_stack(@base_stack_name_alb + env_hash[3..8]) if stack_exists?(@base_stack_name_alb + env_hash[3..8])
595
597
  delete_stack(@base_stack_name_alb_ws + env_hash[3..8]) if stack_exists?(@base_stack_name_alb_ws + env_hash[3..8])
596
598
  `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
@@ -1532,6 +1532,10 @@ 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
+ },
1535
1539
  {
1536
1540
  parameter_key: "HostnamePatternPriority",
1537
1541
  parameter_value: hostname_pattern_priority
@@ -1562,7 +1566,7 @@ class Release
1562
1566
  },
1563
1567
  {
1564
1568
  parameter_key: "HostnamePattern",
1565
- parameter_value: "www-#{@dns_record_identifier}.*"
1569
+ parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
1566
1570
  }
1567
1571
  ]
1568
1572
  if stack_exists?(stack_name_web)
@@ -1670,7 +1674,7 @@ class Release
1670
1674
  },
1671
1675
  {
1672
1676
  parameter_key: "ReleaseVersion",
1673
- parameter_value: "#{@projects["hutch"]['revision']}-#{@dns_record_identifier[0..7]}"
1677
+ parameter_value: "#{@projects["hutch"]['revision']}"
1674
1678
  },
1675
1679
  {
1676
1680
  parameter_key: "ALBShortName",
@@ -1841,13 +1845,33 @@ class Release
1841
1845
 
1842
1846
  if @projects['prima']['name'] != 'master' then
1843
1847
  output "Lancio il batch job per la visual regression..."
1844
- launch_bocelli_test(prima_hostname)
1845
- output "Visual regression lanciata con successo!"
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
+ })
1846
1873
 
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..."
1874
+ output "Visual regression lanciata con successo!"
1851
1875
  end
1852
1876
 
1853
1877
  qainit_write_output(projects_text, 'Indirizzi scritti su ')
@@ -2004,69 +2028,6 @@ class Release
2004
2028
  update_ecs_service(@ecs_cluster_name, resp.stack_resource_detail.physical_resource_id, {minimum_healthy_percent: 0, maximum_percent: 100})
2005
2029
  end
2006
2030
 
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
-
2070
2031
  def create_activia_artifact(revision)
2071
2032
  output "Preparo l'artifact activia .zip\n".yellow
2072
2033
 
@@ -5,7 +5,7 @@ require_relative '../lib/prima_twig.rb'
5
5
  require_relative '../lib/prima_aws_client.rb'
6
6
  require 'launchy'
7
7
  require 'json'
8
- require 'aws-sdk-s3'
8
+ require 'aws-sdk'
9
9
 
10
10
  class TwigUpdateAmi
11
11
  include Command
@@ -1,11 +1,4 @@
1
- require 'aws-sdk-autoscaling'
2
- require 'aws-sdk-batch'
3
- require 'aws-sdk-cloudformation'
4
- require 'aws-sdk-cloudfront'
5
- require 'aws-sdk-ec2'
6
- require 'aws-sdk-ecs'
7
- require 'aws-sdk-elasticloadbalancingv2'
8
- require 'aws-sdk-s3'
1
+ require 'aws-sdk'
9
2
  require 'colorize'
10
3
  #
11
4
  module PrimaAwsClient
@@ -4,7 +4,7 @@ require 'octokit'
4
4
  require 'yaml'
5
5
  require 'rugged'
6
6
  require 'highline/import'
7
- require 'aws-sdk-core'
7
+ require 'aws-sdk'
8
8
  require 'rubyflare'
9
9
 
10
10
  class Prima
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.560
4
+ version: 0.61.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino
@@ -14,122 +14,10 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2020-02-06 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
- name: aws-sdk-autoscaling
21
- requirement: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - "~>"
24
- - !ruby/object:Gem::Version
25
- version: '1'
26
- type: :runtime
27
- prerelease: false
28
- version_requirements: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '1'
33
- - !ruby/object:Gem::Dependency
34
- name: aws-sdk-batch
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '1'
47
- - !ruby/object:Gem::Dependency
48
- name: aws-sdk-cloudformation
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '1'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1'
61
- - !ruby/object:Gem::Dependency
62
- name: aws-sdk-cloudfront
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1'
68
- type: :runtime
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '1'
75
- - !ruby/object:Gem::Dependency
76
- name: aws-sdk-ec2
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '1'
82
- type: :runtime
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '1'
89
- - !ruby/object:Gem::Dependency
90
- name: aws-sdk-ecs
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '1'
96
- type: :runtime
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '1'
103
- - !ruby/object:Gem::Dependency
104
- name: aws-sdk-elasticloadbalancingv2
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '1'
110
- type: :runtime
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '1'
117
- - !ruby/object:Gem::Dependency
118
- name: aws-sdk-s3
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '1'
124
- type: :runtime
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: '1'
131
- - !ruby/object:Gem::Dependency
132
- name: aws-sdk-core
20
+ name: aws-sdk
133
21
  requirement: !ruby/object:Gem::Requirement
134
22
  requirements:
135
23
  - - "~>"