prima-twig 0.58.1 → 0.58.2
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 +4 -4
- data/bin/twig-feature +84 -298
- data/lib/prima_aws_client.rb +35 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eb8b57c9fc8ab64904b362fb8eac88fb8a7aba035b3087ea542dfb28034bab8
|
4
|
+
data.tar.gz: 390b436f2f2d49989174893c3471ec373ab323152c2a7b798a74a7c32d67e4be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45402151d5c9829fa98af9c575b88f78e13c5c2db80978d8d2ec72239bc608a41bb23b579f53a80924a86ae57f1818dd07a58f8a54b7d68d707931ee56321775
|
7
|
+
data.tar.gz: 16adec8fcc0b18bf94d7d08c6d4c1fc90d83e24bd2db3ee3ef83843d7ee869e6c95a41738ee0e5c6df60ed8c49d5b12b91388d8c3b3ddbbd47f8f2cb8a697f5d
|
data/bin/twig-feature
CHANGED
@@ -75,8 +75,6 @@ class Release
|
|
75
75
|
qainit_deploy_update!
|
76
76
|
elsif 'read' == args[1]
|
77
77
|
qainit_read_config! args[2]
|
78
|
-
elsif 'minimal' == args[1]
|
79
|
-
qainit_minimal_deploy! args[2]
|
80
78
|
else
|
81
79
|
if args[1]
|
82
80
|
select_branches(args[1..-1])
|
@@ -90,8 +88,6 @@ class Release
|
|
90
88
|
if 'deploy' == args[1]
|
91
89
|
suite_py_branches(args[2])
|
92
90
|
qainit_deploy!(true)
|
93
|
-
else
|
94
|
-
qainit_deploy_shutdown!(args[2])
|
95
91
|
end
|
96
92
|
when 'deploy'
|
97
93
|
abort('Non sei nella cartella di artemide') unless Dir.pwd.match 'artemide$'
|
@@ -101,8 +97,6 @@ class Release
|
|
101
97
|
deploy_update!
|
102
98
|
elsif 'lock' == args[1]
|
103
99
|
deploy_lock!
|
104
|
-
elsif 'minimal' == args[1]
|
105
|
-
qainit_drone_minimal_deploy!
|
106
100
|
else
|
107
101
|
if args[1]
|
108
102
|
select_branches(args[1])
|
@@ -435,26 +429,20 @@ class Release
|
|
435
429
|
end
|
436
430
|
|
437
431
|
def get_default_branch_name(projects)
|
438
|
-
|
439
|
-
return projects['
|
440
|
-
elsif ![nil, 'master'].include? projects['crash']['name']
|
441
|
-
return projects['crash']['name']
|
442
|
-
else
|
443
|
-
projects.each_key do |project_key|
|
444
|
-
return projects[project_key]['name'] if projects[project_key]['name'] != 'master'
|
445
|
-
end
|
432
|
+
projects.each_key do |project|
|
433
|
+
return projects[project]['name'] if not projects[project]['default_branch']
|
446
434
|
end
|
447
435
|
end
|
448
436
|
|
449
437
|
def suite_py_branches(args_json)
|
450
|
-
|
438
|
+
arg_projects = JSON.parse(args_json)
|
451
439
|
|
452
|
-
|
453
|
-
@projects[project] = { name: args['projects'][project]['branch'], revision: args['projects'][project]['revision'], committer: '', default_branch: false }
|
454
|
-
end
|
440
|
+
@projects.merge!(arg_projects)
|
455
441
|
|
456
442
|
@projects.each_key do |project|
|
457
|
-
@projects[project]
|
443
|
+
if @projects[project].empty?
|
444
|
+
@projects[project] = choose_branch_to_deploy(project, true)
|
445
|
+
end
|
458
446
|
end
|
459
447
|
end
|
460
448
|
|
@@ -495,35 +483,6 @@ class Release
|
|
495
483
|
git checkout master`
|
496
484
|
end
|
497
485
|
|
498
|
-
def qainit_minimal_deploy!(project)
|
499
|
-
abort('L\'unico progetto permesso è prima') unless ['prima'].include? project
|
500
|
-
project_definition = choose_branch_to_deploy(project)
|
501
|
-
|
502
|
-
`git checkout master && git pull && git remote prune origin`
|
503
|
-
|
504
|
-
default_name = project_definition[:name]
|
505
|
-
output "Inserisci la feature a cui si riferisce il QA: [#{default_name}]".cyan
|
506
|
-
feature_number = String(STDIN.gets.chomp)
|
507
|
-
feature_number = default_name if feature_number.empty?
|
508
|
-
|
509
|
-
if `git branch -l | grep #{feature_number}`.size > 0
|
510
|
-
`git checkout #{feature_number} && git pull`
|
511
|
-
else
|
512
|
-
`git checkout -b #{feature_number}`
|
513
|
-
end
|
514
|
-
|
515
|
-
# così recupero le informazioni sul branch, poi vado a scrivere il file branch_names con una sola riga
|
516
|
-
branch = {'project' => { 'name' => project_definition[:name], 'revision' => project_definition['revision'], 'default_branch' => project_definition[:default_branch]}}
|
517
|
-
|
518
|
-
File.open('branch_names', 'w') { |file| file.write(JSON.generate(branch)) }
|
519
|
-
|
520
|
-
`git add projects && \
|
521
|
-
git add branch_names && \
|
522
|
-
git commit -m 'minimal_#{feature_number}' && \
|
523
|
-
git push --set-upstream origin #{feature_number} && \
|
524
|
-
git checkout master`
|
525
|
-
end
|
526
|
-
|
527
486
|
def qainit_deploy_update!
|
528
487
|
`git checkout master && git pull`
|
529
488
|
# cancelliamo tutti i branch che non sono più sul repo remoto
|
@@ -562,11 +521,7 @@ class Release
|
|
562
521
|
|
563
522
|
File.open('branch_names', 'w') { |file| file.write(JSON.generate(@projects)) }
|
564
523
|
|
565
|
-
|
566
|
-
`git commit -am 'minimal_update'`
|
567
|
-
else
|
568
|
-
`git commit -am 'update'`
|
569
|
-
end
|
524
|
+
`git commit -am 'update'`
|
570
525
|
`git push && git checkout master`
|
571
526
|
end
|
572
527
|
|
@@ -674,9 +629,6 @@ class Release
|
|
674
629
|
when 'shutdown'
|
675
630
|
output 'Shutting down'.green
|
676
631
|
qainit_drone_shutdown!
|
677
|
-
when 'minimal'
|
678
|
-
output 'Starting minimal deploy'.green
|
679
|
-
qainit_drone_minimal_deploy!
|
680
632
|
else
|
681
633
|
output 'Starting standard deploy'.green
|
682
634
|
deploy_feature!
|
@@ -688,7 +640,6 @@ class Release
|
|
688
640
|
`mkdir -p cloudformation/stacks/task cloudformation/stacks/route53 cloudformation/stacks/asg cloudformation/stacks/elb`
|
689
641
|
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/task/db.yml', response_target: 'cloudformation/stacks/task/db.yml'})
|
690
642
|
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/route53/qa.yml', response_target: 'cloudformation/stacks/route53/qa.yml'})
|
691
|
-
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/route53/minimal_qa.yml', response_target: 'cloudformation/stacks/route53/minimal_qa.yml'})
|
692
643
|
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/asg/ecs-asg-allinone.yml', response_target: 'cloudformation/stacks/asg/ecs-asg-allinone.yml'})
|
693
644
|
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/ecs-cluster.yml', response_target: 'cloudformation/stacks/ecs-cluster.yml'})
|
694
645
|
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/elb/alb-public-qa.yml', response_target: 'cloudformation/stacks/elb/alb-public-qa.yml'})
|
@@ -703,173 +654,6 @@ class Release
|
|
703
654
|
end
|
704
655
|
end
|
705
656
|
|
706
|
-
def qainit_drone_minimal_deploy!
|
707
|
-
# tenere solo il project da deployare (l'unico project è prima)
|
708
|
-
@ami_id = get_ami_id("ecs-fleet-allinone-staging")
|
709
|
-
project = ''
|
710
|
-
@projects.each_key do |project_key|
|
711
|
-
if @projects[project_key]['revision']
|
712
|
-
project = project_key
|
713
|
-
git_checkout_version(project_key, @projects[project_key]['revision'])
|
714
|
-
end
|
715
|
-
end
|
716
|
-
deploy_id = get_deploy_id
|
717
|
-
|
718
|
-
@git_branch = ENV['DRONE_BRANCH']
|
719
|
-
@dns_record_identifier = deploy_id
|
720
|
-
hostname_pattern_priority = hostname_pattern_priority()
|
721
|
-
tags = [
|
722
|
-
{
|
723
|
-
key: "qainit",
|
724
|
-
value: @git_branch
|
725
|
-
},
|
726
|
-
{
|
727
|
-
key: project,
|
728
|
-
value: @projects[project]['name']
|
729
|
-
},
|
730
|
-
{
|
731
|
-
key: "hostname_pattern_priority",
|
732
|
-
value: hostname_pattern_priority
|
733
|
-
}
|
734
|
-
]
|
735
|
-
|
736
|
-
cluster_stack_name = "ecs-cluster-qa-#{deploy_id}"
|
737
|
-
|
738
|
-
if stack_exists?(cluster_stack_name)
|
739
|
-
tags = get_stack_tags(cluster_stack_name)
|
740
|
-
hostname_pattern_priority = tags.detect do |tag|
|
741
|
-
tag.key == 'hostname_pattern_priority'
|
742
|
-
end.value
|
743
|
-
end
|
744
|
-
|
745
|
-
stack_name_alb = @base_stack_name_alb + deploy_id[0..5]
|
746
|
-
stack_name_alb_ws = @base_stack_name_alb_ws + deploy_id[0..5]
|
747
|
-
|
748
|
-
create_cluster_stack(cluster_stack_name, tags) unless stack_exists?(cluster_stack_name)
|
749
|
-
wait_for_stack_ready(cluster_stack_name) unless stack_ready?(cluster_stack_name)
|
750
|
-
|
751
|
-
create_alb_stack(stack_name_alb, "http", deploy_id, 'qa-minimal') unless stack_exists?(stack_name_alb)
|
752
|
-
create_alb_stack(stack_name_alb_ws, "websocket", deploy_id, 'qa-minimal') unless stack_exists?(stack_name_alb_ws)
|
753
|
-
|
754
|
-
resp = describe_stack_resource(cluster_stack_name, 'ECSCluster')
|
755
|
-
@ecs_cluster_name = resp.stack_resource_detail.physical_resource_id
|
756
|
-
|
757
|
-
asg_stack_name = "ecs-asg-allinone-qa-#{deploy_id}"
|
758
|
-
create_asg_stack(asg_stack_name, tags) unless stack_exists?(asg_stack_name)
|
759
|
-
|
760
|
-
deploy_id = get_deploy_id
|
761
|
-
create_pyxis_artifact(@projects["pyxis-npm"]['revision'], deploy_id)
|
762
|
-
create_prima_artifact(@projects["prima"]['revision'], @projects["prima"]['name'], deploy_id, true) unless artifact_exists?('prima-artifacts-encrypted', "prima/#{@projects["prima"]['revision']}.tar.gz")
|
763
|
-
|
764
|
-
wait_for_stack_ready(stack_name_alb) unless stack_ready?(stack_name_alb)
|
765
|
-
wait_for_stack_ready(stack_name_alb_ws) unless stack_ready?(stack_name_alb_ws)
|
766
|
-
|
767
|
-
stack_name_route53 = "ecs-route53-qa-#{deploy_id}"
|
768
|
-
stack_body = IO.read('cloudformation/stacks/route53/minimal_qa.yml')
|
769
|
-
parameters = [
|
770
|
-
{
|
771
|
-
parameter_key: "DnsRecordIdentifier",
|
772
|
-
parameter_value: @dns_record_identifier
|
773
|
-
},
|
774
|
-
{
|
775
|
-
parameter_key: "PrimaElbHostname",
|
776
|
-
parameter_value: get_alb_host(stack_name_alb)
|
777
|
-
},
|
778
|
-
{
|
779
|
-
parameter_key: 'CrashElbHostname',
|
780
|
-
parameter_value: get_alb_host(stack_name_alb_ws)
|
781
|
-
}
|
782
|
-
]
|
783
|
-
|
784
|
-
create_stack(stack_name_route53, stack_body, parameters, tags, @cf_role) unless stack_exists?(stack_name_route53)
|
785
|
-
wait_for_stack_ready(stack_name_route53) unless stack_ready?(stack_name_route53)
|
786
|
-
|
787
|
-
stack_name_web = "ecs-task-web-qa-#{deploy_id}"
|
788
|
-
git_checkout_version('prima', @projects["prima"]['revision'])
|
789
|
-
stack_body = IO.read('projects/prima/app/cloudformation/tasks/web.yml')
|
790
|
-
parameters = [
|
791
|
-
{
|
792
|
-
parameter_key: "Environment",
|
793
|
-
parameter_value: "qa-minimal"
|
794
|
-
},
|
795
|
-
{
|
796
|
-
parameter_key: "ReleaseVersion",
|
797
|
-
parameter_value: "#{@projects["prima"]['revision']}"
|
798
|
-
},
|
799
|
-
{
|
800
|
-
parameter_key: "TaskDesiredCount",
|
801
|
-
parameter_value: "1"
|
802
|
-
},
|
803
|
-
{
|
804
|
-
parameter_key: "ECSClusterName",
|
805
|
-
parameter_value: @ecs_cluster_name
|
806
|
-
},
|
807
|
-
{
|
808
|
-
parameter_key: "ALBShortName",
|
809
|
-
parameter_value: "web-qa-#{deploy_id}"[0..27]
|
810
|
-
},
|
811
|
-
{
|
812
|
-
parameter_key: "WebQaBaseHostname",
|
813
|
-
parameter_value: "#{@dns_record_identifier}.qa.colaster.com"
|
814
|
-
},
|
815
|
-
{
|
816
|
-
parameter_key: "HostnamePattern",
|
817
|
-
parameter_value: "ww*-#{@dns_record_identifier}.qa.colaster.com"
|
818
|
-
},
|
819
|
-
{
|
820
|
-
parameter_key: "HostnamePatternPriority",
|
821
|
-
parameter_value: hostname_pattern_priority
|
822
|
-
},
|
823
|
-
{
|
824
|
-
parameter_key: "HostnamePatternAggregatorPriority",
|
825
|
-
parameter_value: (hostname_pattern_priority.to_i + 1).to_s
|
826
|
-
},
|
827
|
-
{
|
828
|
-
parameter_key: "EnvHash",
|
829
|
-
parameter_value: deploy_id
|
830
|
-
},
|
831
|
-
{
|
832
|
-
parameter_key: "AssangeHostname",
|
833
|
-
parameter_value: "assange-#{@dns_record_identifier}.qa.colaster.com"
|
834
|
-
},
|
835
|
-
{
|
836
|
-
parameter_key: "BackofficeHostname",
|
837
|
-
parameter_value: "backoffice-#{@dns_record_identifier}.qa.colaster.com"
|
838
|
-
},
|
839
|
-
{
|
840
|
-
parameter_key: "WebHostname",
|
841
|
-
parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
|
842
|
-
},
|
843
|
-
{
|
844
|
-
parameter_key: "FePrimaDomain",
|
845
|
-
parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
|
846
|
-
},
|
847
|
-
{
|
848
|
-
parameter_key: "HostnamePattern",
|
849
|
-
parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
|
850
|
-
}
|
851
|
-
]
|
852
|
-
if stack_exists?(stack_name_web)
|
853
|
-
cur_version = get_currently_deployed_version(stack_name_web)
|
854
|
-
update_stack(stack_name_web, stack_body, parameters, tags, @cf_role) unless cur_version.include?(@projects["prima"]['revision'])
|
855
|
-
else
|
856
|
-
create_stack(stack_name_web, stack_body, parameters, tags, @cf_role)
|
857
|
-
end
|
858
|
-
wait_for_stack_ready(stack_name_web) unless stack_ready?(stack_name_web)
|
859
|
-
update_service_defaults(stack_name_web)
|
860
|
-
prima_hostname = get_route53_hostname(stack_name_web)
|
861
|
-
|
862
|
-
projects_text = "
|
863
|
-
> Prima url: https://#{prima_hostname}
|
864
|
-
> SSH connection: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no githubUsername@#{ec2_ip_address(asg_stack_name)}\n"
|
865
|
-
|
866
|
-
output projects_text.cyan
|
867
|
-
output "Deploy effettuato, everything is awesome!\n".green
|
868
|
-
if @qainit
|
869
|
-
qainit_write_output(projects_text, 'Indirizzi scritti su ')
|
870
|
-
end
|
871
|
-
end
|
872
|
-
|
873
657
|
def deploy_feature!
|
874
658
|
`git pull && git submodule init && git submodule update`
|
875
659
|
@ami_id = get_ami_id("ecs-fleet-allinone-staging")
|
@@ -1489,7 +1273,11 @@ class Release
|
|
1489
1273
|
]
|
1490
1274
|
if stack_exists?(stack_name_rachele)
|
1491
1275
|
cur_version = get_currently_deployed_version(stack_name_rachele)
|
1492
|
-
|
1276
|
+
unless cur_version.include?(@projects["rachele"]['revision'])
|
1277
|
+
delete_stack(stack_name_rachele)
|
1278
|
+
wait_for_stack_removal(stack_name_rachele)
|
1279
|
+
create_stack(stack_name_rachele, stack_body, parameters, tags, @cf_role)
|
1280
|
+
end
|
1493
1281
|
else
|
1494
1282
|
create_stack(stack_name_rachele, stack_body, parameters, tags, @cf_role)
|
1495
1283
|
end
|
@@ -2051,6 +1839,29 @@ class Release
|
|
2051
1839
|
output projects_text.cyan
|
2052
1840
|
output "Deploy effettuato, everything is awesome!\n".green
|
2053
1841
|
|
1842
|
+
if @projects['prima']['name'] != 'master' then
|
1843
|
+
output "Lancio il batch job per la visual regression..."
|
1844
|
+
@batch.submit_job({
|
1845
|
+
job_name: "bocelli-test-#{@dns_record_identifier}",
|
1846
|
+
job_queue: "tools-production",
|
1847
|
+
job_definition: describe_stack_resource('batch-job-bocelli-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
|
1848
|
+
container_overrides: {
|
1849
|
+
environment: [
|
1850
|
+
{
|
1851
|
+
name: "BATCH_COMMAND",
|
1852
|
+
value: "test"
|
1853
|
+
},
|
1854
|
+
{
|
1855
|
+
name: "QA_HOSTNAME",
|
1856
|
+
value: prima_hostname
|
1857
|
+
}
|
1858
|
+
]
|
1859
|
+
}
|
1860
|
+
})
|
1861
|
+
|
1862
|
+
output "Visual regression lanciata con successo!"
|
1863
|
+
end
|
1864
|
+
|
2054
1865
|
qainit_write_output(projects_text, 'Indirizzi scritti su ')
|
2055
1866
|
end
|
2056
1867
|
|
@@ -2216,21 +2027,26 @@ class Release
|
|
2216
2027
|
|
2217
2028
|
exec_step 'cp docker-compose.yml docker-compose-ci.yml'
|
2218
2029
|
exec_step 'prepare-docker-compose --directory activia && cp docker-compose-qainit.yml docker-compose.yml'
|
2219
|
-
|
2220
|
-
|
2221
|
-
"
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2030
|
+
|
2031
|
+
if File.exists? 'deploy/build_qa_artifact'
|
2032
|
+
execute_command "deploy/build_qa_artifact"
|
2033
|
+
else
|
2034
|
+
[
|
2035
|
+
"docker-compose build web",
|
2036
|
+
"docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
|
2037
|
+
'-c' 'mix local.hex --force && mix hex.info && \
|
2038
|
+
mix deps.get && mix compile && mix deps.compile && \
|
2039
|
+
cd assets && \
|
2040
|
+
rm -rf node_modules && \
|
2041
|
+
yarn --cache-folder ~/.cache/yarn && \
|
2042
|
+
sysconfcpus -n 2 ./node_modules/.bin/webpack --mode production && \
|
2043
|
+
cd .. && \
|
2044
|
+
mix phx.digest && \
|
2045
|
+
rm -rf _build/qa/rel/ && \
|
2046
|
+
mix release --env=qa'"
|
2047
|
+
].each do |cmd|
|
2048
|
+
execute_command cmd
|
2049
|
+
end
|
2234
2050
|
end
|
2235
2051
|
|
2236
2052
|
cleanup_containers
|
@@ -2300,22 +2116,27 @@ class Release
|
|
2300
2116
|
|
2301
2117
|
exec_step 'cp docker-compose.yml docker-compose-ci.yml'
|
2302
2118
|
exec_step 'prepare-docker-compose --directory borat && cp docker-compose-qainit.yml docker-compose.yml'
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2119
|
+
|
2120
|
+
if File.exists? 'deploy/build_qa_artifact'
|
2121
|
+
execute_command "deploy/build_qa_artifact"
|
2122
|
+
else
|
2123
|
+
[
|
2124
|
+
"docker network create borat_network || true",
|
2125
|
+
"docker-compose build web",
|
2126
|
+
"docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
|
2127
|
+
'-c' 'mix local.hex --force && mix hex.info && \
|
2128
|
+
mix deps.get && \
|
2129
|
+
cd assets && \
|
2130
|
+
yarn --cache-folder ~/.cache/yarn && \
|
2131
|
+
sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
|
2132
|
+
cd ../ && \
|
2133
|
+
mix phx.digest && \
|
2134
|
+
mix compile && mix deps.compile && \
|
2135
|
+
rm -rf _build/qa/rel/ && \
|
2136
|
+
mix distillery.release --env=qa'"
|
2137
|
+
].each do |cmd|
|
2138
|
+
execute_command cmd
|
2139
|
+
end
|
2319
2140
|
end
|
2320
2141
|
|
2321
2142
|
cleanup_containers
|
@@ -2340,28 +2161,7 @@ class Release
|
|
2340
2161
|
`mv docker-compose-ci.yml docker-compose.yml`
|
2341
2162
|
exec_step 'prepare-docker-compose --directory crash && cp docker-compose-qainit.yml docker-compose.yml'
|
2342
2163
|
|
2343
|
-
|
2344
|
-
`deploy/build_qa_artifact #{deploy_id}`
|
2345
|
-
else # TODO remove when deploy/build_qa_artifact is merged
|
2346
|
-
[
|
2347
|
-
'docker-compose build web',
|
2348
|
-
"docker-compose run -w $PWD -u root -e MIX_ENV=qa -e ENV_HASH=#{deploy_id} web \
|
2349
|
-
'-c' 'mix local.hex --force && mix hex.info && \
|
2350
|
-
mix deps.get && \
|
2351
|
-
cd assets && \
|
2352
|
-
yarn --cache-folder ~/.cache/yarn && \
|
2353
|
-
NODE_ENV=production sysconfcpus -n 1 yarn run build && \
|
2354
|
-
cd ../ && \
|
2355
|
-
mix release.clean --implode --no-confirm && \
|
2356
|
-
mix phx.digest && \
|
2357
|
-
mix deps.clean --all && \
|
2358
|
-
mix deps.get && \
|
2359
|
-
mix compile && mix release --env=qa'",
|
2360
|
-
'docker-compose down'
|
2361
|
-
].each do |cmd|
|
2362
|
-
execute_command cmd
|
2363
|
-
end
|
2364
|
-
end
|
2164
|
+
execute_command "deploy/build_qa_artifact #{deploy_id}"
|
2365
2165
|
|
2366
2166
|
cleanup_containers
|
2367
2167
|
|
@@ -2562,20 +2362,7 @@ class Release
|
|
2562
2362
|
exec_step 'cp docker-compose.yml docker-compose-ci.yml'
|
2563
2363
|
exec_step 'prepare-docker-compose --directory peano && cp docker-compose-qainit.yml docker-compose.yml'
|
2564
2364
|
|
2565
|
-
|
2566
|
-
`deploy/build_qa_artifact`
|
2567
|
-
else # TODO remove when deploy/build_qa_artifact is merged
|
2568
|
-
[
|
2569
|
-
"docker-compose build web",
|
2570
|
-
"docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
|
2571
|
-
'-c' 'mix local.hex --force && mix hex.info && \
|
2572
|
-
mix deps.get && mix compile && mix deps.compile && \
|
2573
|
-
rm -rf _build/qa/rel/ && \
|
2574
|
-
mix release --env=qa'"
|
2575
|
-
].each do |cmd|
|
2576
|
-
execute_command cmd
|
2577
|
-
end
|
2578
|
-
end
|
2365
|
+
execute_command "deploy/build_qa_artifact"
|
2579
2366
|
|
2580
2367
|
cleanup_containers
|
2581
2368
|
|
@@ -2585,7 +2372,7 @@ class Release
|
|
2585
2372
|
Dir.chdir '../../'
|
2586
2373
|
end
|
2587
2374
|
|
2588
|
-
def create_prima_artifact(revision, branch_name, deploy_id
|
2375
|
+
def create_prima_artifact(revision, branch_name, deploy_id)
|
2589
2376
|
output "Preparo l'artifact prima .zip\n".yellow
|
2590
2377
|
|
2591
2378
|
git_checkout_version('prima', revision)
|
@@ -2988,7 +2775,7 @@ class Release
|
|
2988
2775
|
end
|
2989
2776
|
|
2990
2777
|
def choose_branch_to_deploy(project_name, select_master = false)
|
2991
|
-
return {name
|
2778
|
+
return {'name' => 'master', 'revision' => '399653d555b8864', 'committer' => 'crash@prima.it', 'default_branch' => true} if project_name == 'crash' && select_master
|
2992
2779
|
Dir.chdir "projects/#{project_name}"
|
2993
2780
|
output "Recupero la lista dei branch del progetto #{project_name}..."
|
2994
2781
|
`git remote prune origin`
|
@@ -3028,8 +2815,8 @@ class Release
|
|
3028
2815
|
name = branch_name.split(' ')[0]
|
3029
2816
|
revision = branch_name.split(' ')[1]
|
3030
2817
|
committer_email = branch_name.split(' ')[2].tr('<>', '')
|
3031
|
-
return { name
|
3032
|
-
{ name
|
2818
|
+
return { 'name' => 'crash', 'default_branch' => true } if project_name == 'crash' && branch_name == 'master' #rimuovere questa riga se mai nei qa servirà crash con un branch diverso da master
|
2819
|
+
{ 'name' => name, 'revision' => revision[0..14], 'committer' => committer_email, 'default_branch' => select_master }
|
3033
2820
|
end
|
3034
2821
|
|
3035
2822
|
def select_branch_to_deploy(project_name, branch_name)
|
@@ -3045,7 +2832,7 @@ class Release
|
|
3045
2832
|
name = branch_name.split(' ')[0]
|
3046
2833
|
revision = branch_name.split(' ')[1]
|
3047
2834
|
committer_email = branch_name.split(' ')[2].tr('<>', '')
|
3048
|
-
{ name
|
2835
|
+
{ 'name' => name, 'revision' => revision[0..14], 'committer' => committer_email }
|
3049
2836
|
end
|
3050
2837
|
|
3051
2838
|
def get_stacks()
|
@@ -3186,7 +2973,6 @@ Description
|
|
3186
2973
|
finish finishes the feature by merging to dev and master
|
3187
2974
|
qainit deploys a new environment with selected branches from every project
|
3188
2975
|
qainit $PROJECT_NAME deploys a new environment allowing to selected a branch from the input project (everything else is master)
|
3189
|
-
qainit minimal prima deploys a new copy of prima project, using staging microservices and database
|
3190
2976
|
qainit shutdown deletes a specific qa environment
|
3191
2977
|
|
3192
2978
|
Available only to devops (from artemide)
|
data/lib/prima_aws_client.rb
CHANGED
@@ -212,6 +212,24 @@ module PrimaAwsClient
|
|
212
212
|
output "\nStack #{stack_name} pronto!\n".green
|
213
213
|
end
|
214
214
|
|
215
|
+
def wait_for_stack_removal(stack_name)
|
216
|
+
ready = false
|
217
|
+
sleep_seconds = 13
|
218
|
+
sleep 10
|
219
|
+
output "Attendo che lo stack #{stack_name} finisca di essere cancellato...\n".yellow
|
220
|
+
while !ready
|
221
|
+
ready = true if stack_deleted?(stack_name)
|
222
|
+
seconds_elapsed = 0
|
223
|
+
loop do
|
224
|
+
break if seconds_elapsed >= sleep_seconds
|
225
|
+
print '.'.yellow; STDOUT.flush
|
226
|
+
sleep 1
|
227
|
+
seconds_elapsed += 1
|
228
|
+
end
|
229
|
+
end
|
230
|
+
output "\nStack #{stack_name} eliminato!\n".green
|
231
|
+
end
|
232
|
+
|
215
233
|
def get_stack_tags(name)
|
216
234
|
begin
|
217
235
|
resp = cf_client.describe_stacks(stack_name: name)
|
@@ -275,6 +293,23 @@ module PrimaAwsClient
|
|
275
293
|
['CREATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_ROLLBACK_COMPLETE', 'ROLLBACK_COMPLETE'].include? stack_status
|
276
294
|
end
|
277
295
|
|
296
|
+
def stack_deleted?(stack_name, failed_statuses = ['ROLLBACK_IN_PROGRESS', 'ROLLBACK_FAILED', 'DELETE_FAILED', 'UPDATE_ROLLBACK_FAILED', 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS'])
|
297
|
+
begin
|
298
|
+
resp = cf_client.describe_stacks(
|
299
|
+
stack_name: stack_name
|
300
|
+
)
|
301
|
+
stack_status = resp.stacks[0].stack_status
|
302
|
+
rescue Aws::CloudFormation::Errors::Throttling => e
|
303
|
+
print 'Throttling'.red; STDOUT.flush
|
304
|
+
return false
|
305
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
306
|
+
print 'Stack deleted'
|
307
|
+
return true
|
308
|
+
end
|
309
|
+
raise "The stack #{stack_name} errored out" if failed_statuses.include? stack_status
|
310
|
+
['DELETE_COMPLETE'].include? stack_status
|
311
|
+
end
|
312
|
+
|
278
313
|
def artifact_exists?(bucket, path)
|
279
314
|
resp = s3_client.list_objects(
|
280
315
|
bucket: bucket,
|
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.58.
|
4
|
+
version: 0.58.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Giachino
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2019-
|
17
|
+
date: 2019-12-24 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: aws-sdk
|