From be6c2285af7f4e7700624b97ec7c0c54ecbef27e Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 21 Jul 2021 11:55:30 +0200 Subject: [PATCH 1/3] Configure CircleCI matrix Test all in OTP 24 Only small_tests, pgsql and ldap in OTP 22 and 23. --- .circleci/config.yml | 179 +++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 99 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 712181a751..6cfc838f55 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,23 @@ version: 2.1 references: - - &OTP23 cimg/elixir:1.11 # Contains Erlang 23.1 + - &OTP24 cimg/elixir:1.12 # Contains Erlang 24.0 executors: - otp_23: + # OTP24 + otp_24: working_directory: ~/app docker: - - image: *OTP23 - otp_23_redis: + - image: *OTP24 + otp_24_redis: working_directory: ~/app docker: - - image: *OTP23 + - image: *OTP24 - image: circleci/redis:6.0.5 - otp_23_redis_minio_rmq: + otp_24_redis_minio_rmq: working_directory: ~/app docker: - - image: *OTP23 + - image: *OTP24 - image: circleci/redis:6.0.5 - image: minio/minio:latest environment: @@ -576,85 +577,67 @@ workflows: # ============= PACKAGES ============= - package: name: centos_7 - executor: otp_23 + executor: otp_24 platform: centos_7 context: mongooseim-org - otp_package: 23.1-1 + otp_package: 24.0-1 filters: *all_tags - package: name: debian_stretch - executor: otp_23 + executor: otp_24 platform: debian_stretch context: mongooseim-org - otp_package: 23.1-1 + otp_package: 24.0-1 filters: *all_tags # ======== BASE DOCKER BUILDS ======== - build_in_docker: - name: otp_23_docker - executor: otp_23 + name: otp_24_docker + executor: otp_24 context: mongooseim-org build_prod: true # ============= DIALYZER ============= - dialyzer: name: dialyzer - executor: otp_23 + executor: otp_24 context: mongooseim-org requires: - - otp_23_docker + - otp_24_docker filters: *all_tags # ============= XREF ============= - xref: name: xref - executor: otp_23 + executor: otp_24 context: mongooseim-org requires: - - otp_23_docker + - otp_24_docker filters: *all_tags # ============= SMALL TESTS ============= - small_tests_in_docker: - name: small_tests_23 - executor: otp_23_redis + name: small_tests_24 + executor: otp_24_redis context: mongooseim-org requires: - - otp_23_docker + - otp_24_docker filters: *all_tags # ============= BIG TESTS ============= - big_tests_in_docker: - name: internal_mnesia - executor: otp_23_redis_minio_rmq + name: internal_mnesia_24 + executor: otp_24_redis_minio_rmq context: mongooseim-org preset: internal_mnesia db: "mnesia minio" tls_dist: true requires: - - otp_23_docker + - otp_24_docker filters: *all_tags # ============================================ # ============= IN VM EXECUTORS ============== - # ============= BASE BUILDS ============= + # ============= TESTS OTP 22 ============= - build: name: otp_22 otp_package: 22.3.4.9-1 context: mongooseim-org filters: *all_tags - - build: - name: otp_23 - otp_package: 23.0.3-1 - context: mongooseim-org - filters: *all_tags - - build: - name: otp_24 - otp_package: 24.0.2-1 - context: mongooseim-org - filters: *all_tags - # ============= SMALL TESTS ============= - - small_tests: - name: small_tests_24 - otp_package: 24.0.2-1 - context: mongooseim-org - requires: - - otp_24 - filters: *all_tags - small_tests: name: small_tests_22 otp_package: 22.3.4.9-1 @@ -662,48 +645,33 @@ workflows: requires: - otp_22 filters: *all_tags - # ============= MOST RECENT VERSION TESTS ============= - big_tests: - name: mysql_redis - otp_package: 23.0.3-1 - preset: mysql_redis - db: mysql + name: ldap_mnesia_22 + otp_package: 22.3.4.9-1 + preset: ldap_mnesia + db: mnesia context: mongooseim-org requires: - - otp_23 + - otp_22 filters: *all_tags - big_tests: - name: mssql_mnesia - otp_package: 23.0.3-1 - preset: odbc_mssql_mnesia - db: mssql + name: pgsql_mnesia_22 + otp_package: 22.3.4.9-1 + preset: pgsql_mnesia + db: pgsql context: mongooseim-org requires: - - otp_23 + - otp_22 filters: *all_tags - - big_tests: - name: elasticsearch_and_cassandra + # ============= TESTS OTP 23 ============= + - build: + name: otp_23 otp_package: 23.0.3-1 - preset: elasticsearch_and_cassandra_mnesia - db: "elasticsearch cassandra" context: mongooseim-org - requires: - - otp_23 filters: *all_tags - - big_tests: - name: riak_mnesia - otp_package: 23.0.3-1 - preset: riak_mnesia - db: riak - context: mongooseim-org - requires: - - otp_23 - filters: *all_tags - - big_tests: - name: pgsql_mnesia + - small_tests: + name: small_tests_23 otp_package: 23.0.3-1 - preset: pgsql_mnesia - db: pgsql context: mongooseim-org requires: - otp_23 @@ -717,37 +685,31 @@ workflows: requires: - otp_23 filters: *all_tags - # ============= DYNAMIC DOMAINS ============= - big_tests: - name: dynamic_domains + name: pgsql_mnesia_23 otp_package: 23.0.3-1 - spec: dynamic_domains.spec preset: pgsql_mnesia db: pgsql context: mongooseim-org requires: - otp_23 filters: *all_tags - # ============= 1 VERSION OLDER TESTS ============= - - big_tests: - name: ldap_mnesia_22 - otp_package: 22.3.4.9-1 - preset: ldap_mnesia - db: mnesia - context: mongooseim-org - requires: - - otp_22 - filters: *all_tags - big_tests: - name: pgsql_mnesia_22 - otp_package: 22.3.4.9-1 + name: dynamic_domains_23 + otp_package: 23.0.3-1 + spec: dynamic_domains.spec preset: pgsql_mnesia db: pgsql context: mongooseim-org requires: - - otp_22 + - otp_23 + filters: *all_tags + # ============= TESTS OTP 24 ============= + - build: + name: otp_24 + otp_package: 24.0.2-1 + context: mongooseim-org filters: *all_tags - # ============= MOST RECENT VERSION TESTS OTP 24 ============= - big_tests: name: ldap_mnesia_24 otp_package: 24.0.2-1 @@ -802,22 +764,41 @@ workflows: requires: - otp_24 filters: *all_tags + - big_tests: + name: dynamic_domains_24 + otp_package: 24.0.2-1 + spec: dynamic_domains.spec + preset: pgsql_mnesia + db: pgsql + context: mongooseim-org + requires: + - otp_24 + filters: *all_tags # ============= DOCKER IMAGE BUILD & UPLOAD ============= - docker_image: name: docker_build_and_ship - executor: otp_23 + executor: otp_24 context: mongooseim-org requires: - - ldap_mnesia_23 - - pgsql_mnesia - - riak_mnesia - - elasticsearch_and_cassandra - - internal_mnesia - - mysql_redis - - mssql_mnesia - - dialyzer - - xref - small_tests_22 + - ldap_mnesia_22 + - pgsql_mnesia_22 + - small_tests_23 + - ldap_mnesia_23 + - pgsql_mnesia_23 + - dynamic_domains_23 + - small_tests_24 + - internal_mnesia_24 + - pgsql_mnesia_24 + - mysql_redis_24 + - mssql_mnesia_24 + - ldap_mnesia_24 + - riak_mnesia_24 + - elasticsearch_and_cassandra_24 + - dynamic_domains_24 + + - dialyzer + - xref filters: *all_tags From 974b626f10f3624604a10eadc0136090f0ec2987 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 21 Jul 2021 12:19:20 +0200 Subject: [PATCH 2/3] Test simplest major version --- .circleci/config.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6cfc838f55..0a35b93761 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -666,19 +666,19 @@ workflows: # ============= TESTS OTP 23 ============= - build: name: otp_23 - otp_package: 23.0.3-1 + otp_package: 23.3.1-1 context: mongooseim-org filters: *all_tags - small_tests: name: small_tests_23 - otp_package: 23.0.3-1 + otp_package: 23.3.1-1 context: mongooseim-org requires: - otp_23 filters: *all_tags - big_tests: name: ldap_mnesia_23 - otp_package: 23.0.3-1 + otp_package: 23.3.1-1 preset: ldap_mnesia db: mnesia context: mongooseim-org @@ -687,7 +687,7 @@ workflows: filters: *all_tags - big_tests: name: pgsql_mnesia_23 - otp_package: 23.0.3-1 + otp_package: 23.3.1-1 preset: pgsql_mnesia db: pgsql context: mongooseim-org @@ -696,7 +696,7 @@ workflows: filters: *all_tags - big_tests: name: dynamic_domains_23 - otp_package: 23.0.3-1 + otp_package: 23.3.1-1 spec: dynamic_domains.spec preset: pgsql_mnesia db: pgsql @@ -707,12 +707,12 @@ workflows: # ============= TESTS OTP 24 ============= - build: name: otp_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 context: mongooseim-org filters: *all_tags - big_tests: name: ldap_mnesia_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 preset: ldap_mnesia db: mnesia context: mongooseim-org @@ -721,7 +721,7 @@ workflows: filters: *all_tags - big_tests: name: mysql_redis_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 preset: mysql_redis db: mysql context: mongooseim-org @@ -730,7 +730,7 @@ workflows: filters: *all_tags - big_tests: name: mssql_mnesia_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 preset: odbc_mssql_mnesia db: mssql context: mongooseim-org @@ -739,7 +739,7 @@ workflows: filters: *all_tags - big_tests: name: elasticsearch_and_cassandra_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 preset: elasticsearch_and_cassandra_mnesia db: "elasticsearch cassandra" context: mongooseim-org @@ -748,7 +748,7 @@ workflows: filters: *all_tags - big_tests: name: riak_mnesia_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 preset: riak_mnesia db: riak context: mongooseim-org @@ -757,7 +757,7 @@ workflows: filters: *all_tags - big_tests: name: pgsql_mnesia_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 preset: pgsql_mnesia db: pgsql context: mongooseim-org @@ -766,7 +766,7 @@ workflows: filters: *all_tags - big_tests: name: dynamic_domains_24 - otp_package: 24.0.2-1 + otp_package: 24.0-1 spec: dynamic_domains.spec preset: pgsql_mnesia db: pgsql From 0c484690326e29c2c4e5909f88c5802cf6d1b922 Mon Sep 17 00:00:00 2001 From: Nelson Vides Date: Wed, 21 Jul 2021 12:27:14 +0200 Subject: [PATCH 3/3] Handle os:env change in otp versions --- rel/files/scripts/bootstrap20-template.escript | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rel/files/scripts/bootstrap20-template.escript b/rel/files/scripts/bootstrap20-template.escript index 1223b05221..4d91217aad 100755 --- a/rel/files/scripts/bootstrap20-template.escript +++ b/rel/files/scripts/bootstrap20-template.escript @@ -26,7 +26,7 @@ init_and_template(MIM_DIR, TemplateConfigPath, TemplateConfigBin) -> %% Options defined in the ini config file FileOpts = maps:from_list(proplists:get_value(options, TemplateConfig, [])), - LowerEnvVars = [{string:to_lower(K), V} || {K, V} <- os:list_env_vars()], + LowerEnvVars = get_env_vars(), %% Add all env variables with prefix MIM_ EnvVars = maps:from_list([{list_to_atom(K), list_to_binary(V)} @@ -109,3 +109,16 @@ parse_template_config(TemplateConfigPath, TemplateConfigBin) -> io:format("Failed to parse ~p~n Reason ~p~n", [TemplateConfigPath, Other]), halt_with_error("parse_template_config_failed") end. + +-ifdef(OTP_RELEASE). +-if(?OTP_RELEASE >= 24). +get_env_vars() -> + LowerEnvVars = [{string:to_lower(K), V} || {K, V} <- os:env()]. +-else. +get_env_vars() -> + LowerEnvVars = [{string:to_lower(K), V} || {K, V} <- os:list_env_vars()]. +-endif. +-else. +get_env_vars() -> + LowerEnvVars = [{string:to_lower(K), V} || {K, V} <- os:list_env_vars()]. +-endif.