From 86f8a7744ae73ed91be854aefa75b5bd18d94437 Mon Sep 17 00:00:00 2001 From: Pavel Vetokhin Date: Sun, 3 Dec 2023 14:29:25 +0300 Subject: [PATCH] Import with vars files --- .dx/inventory/group_vars/all.yaml | 5 +++-- .dx/stacks.yaml | 3 ++- .dx/tasks/solution/build.yaml | 18 +++++------------- .dx/tasks/solution/status.yaml | 2 +- envs/ops/lamport/vars.yaml | 13 +++++++++---- envs/ops/milner/vars.yaml | 13 +++++++++---- envs/ops/nakamoto/vars.yaml | 13 +++++++++---- envs/ops/shannon/vars.yaml | 13 +++++++++---- tests/props/lamport.properties | 2 +- tests/props/nakamoto.properties | 2 ++ 10 files changed, 50 insertions(+), 34 deletions(-) create mode 100644 tests/props/nakamoto.properties diff --git a/.dx/inventory/group_vars/all.yaml b/.dx/inventory/group_vars/all.yaml index cb56118d..bbc29258 100644 --- a/.dx/inventory/group_vars/all.yaml +++ b/.dx/inventory/group_vars/all.yaml @@ -14,14 +14,15 @@ app_cids: schema_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas')[:7] }}" schema_cids: postgres: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas/postgres')[:7] }}" -solution_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=solutions')[:7] }}" test_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=tests')[:7] }}" dx_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=.dx')[:7] }}" env_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=envs')[:7] }}" tool_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=tools')[:7] }}" -pipeline_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=.github')[:7] }}" + +stack_cids: + solution: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=stacks/solution')[:7] }}" binary_repo: local image_repo: local diff --git a/.dx/stacks.yaml b/.dx/stacks.yaml index 750ae250..70e2e246 100644 --- a/.dx/stacks.yaml +++ b/.dx/stacks.yaml @@ -21,8 +21,9 @@ - name: Testing hosts: stack run_once: true + vars_files: + - "{{ playbook_dir }}/../envs/ops/{{ opsenv }}/vars.yaml" vars: - solutions_dir: "{{ playbook_dir }}/../solutions" stack_dir: "{{ playbook_dir }}/../stacks/solution" tasks: - ansible.builtin.import_tasks: # noqa: name[missing] diff --git a/.dx/tasks/solution/build.yaml b/.dx/tasks/solution/build.yaml index ecd4bff1..0563e6e0 100644 --- a/.dx/tasks/solution/build.yaml +++ b/.dx/tasks/solution/build.yaml @@ -10,15 +10,10 @@ state: directory recurse: true -- name: Capture env - ansible.builtin.include_vars: - file: ../envs/ops/{{ opsenv }}/vars.yaml - name: ops - - name: Build conf ansible.builtin.template: src: "../envs/ops/{{ opsenv }}/config.j2" - dest: "{{ stack_dir }}/target/context/application.{{ config_exts[ops.config_mapping_mode] }}" + dest: "{{ stack_dir }}/target/context/application.{{ config_exts[application.config.mapping_mode] }}" mode: "644" vars: storage_name: postgres @@ -36,11 +31,8 @@ stack: name: "{{ project_name }}" config: - file_name: "application.{{ config_exts[ops.config_mapping_mode] }}" - mapping_mode: "{{ ops.config_mapping_mode }}" - storage: - name: postgres - version: "{{ ops.postgres_version }}" + file_name: "application.{{ config_exts[application.config.mapping_mode] }}" + mapping_mode: "{{ application.config.mapping_mode }}" database: name: "{{ project_name }}" schemas: @@ -54,5 +46,5 @@ apps: - name: sepuling image: - name: "{{ app_images['sepuling-' ~ ops.lang_mode] }}" - tag: "{{ hostvars.app.image_cids['sepuling-' ~ ops.lang_mode][:7] }}-{{ devenv }}" + name: "{{ app_images['sepuling-' ~ runtime.lang] }}" + tag: "{{ hostvars.app.image_cids['sepuling-' ~ runtime.lang][:7] }}-{{ devenv }}" diff --git a/.dx/tasks/solution/status.yaml b/.dx/tasks/solution/status.yaml index d588218f..d7659d63 100644 --- a/.dx/tasks/solution/status.yaml +++ b/.dx/tasks/solution/status.yaml @@ -6,7 +6,7 @@ {{ lib_cid }} {{ app_cid }} {{ schema_cid }} - {{ solution_cid }} + {{ stack_cids.solution }} register: stack_cid changed_when: false diff --git a/envs/ops/lamport/vars.yaml b/envs/ops/lamport/vars.yaml index 53ae620f..6d04c2b3 100644 --- a/envs/ops/lamport/vars.yaml +++ b/envs/ops/lamport/vars.yaml @@ -1,5 +1,10 @@ --- -postgres_version: 15.4 -java_release: 19 -lang_mode: kotlin -config_mapping_mode: lightbend_config +storage: + name: postgres + version: 15.4 +runtime: + release: 19 + lang: kotlin +application: + config: + mapping_mode: lightbend_config diff --git a/envs/ops/milner/vars.yaml b/envs/ops/milner/vars.yaml index 164a221b..bf23b932 100644 --- a/envs/ops/milner/vars.yaml +++ b/envs/ops/milner/vars.yaml @@ -1,5 +1,10 @@ --- -postgres_version: 15.4 -java_release: 19 -lang_mode: kotlin -config_mapping_mode: spring_config +storage: + name: postgres + version: 15.4 +runtime: + release: 19 + lang: kotlin +application: + config: + mapping_mode: spring_config diff --git a/envs/ops/nakamoto/vars.yaml b/envs/ops/nakamoto/vars.yaml index 744f0053..cde1b36c 100644 --- a/envs/ops/nakamoto/vars.yaml +++ b/envs/ops/nakamoto/vars.yaml @@ -1,5 +1,10 @@ --- -postgres_version: 16.0 -java_release: 21 -lang_mode: java -config_mapping_mode: spring_config +storage: + name: postgres + version: 16.0 +runtime: + release: 21 + lang: java +application: + config: + mapping_mode: spring_config diff --git a/envs/ops/shannon/vars.yaml b/envs/ops/shannon/vars.yaml index 4f47c80e..a725e3f4 100644 --- a/envs/ops/shannon/vars.yaml +++ b/envs/ops/shannon/vars.yaml @@ -1,5 +1,10 @@ --- -postgres_version: 14.9 -java_release: 17 -lang_mode: java -config_mapping_mode: lightbend_config +storage: + name: postgres + version: 14.9 +runtime: + release: 17 + lang: java +application: + config: + mapping_mode: lightbend_config diff --git a/tests/props/lamport.properties b/tests/props/lamport.properties index 75c97d25..d75d8d90 100644 --- a/tests/props/lamport.properties +++ b/tests/props/lamport.properties @@ -1,2 +1,2 @@ storage.protocol.mode=postgres -storage.mapping.mode=spring_data +storage.mapping.mode=my_batis diff --git a/tests/props/nakamoto.properties b/tests/props/nakamoto.properties new file mode 100644 index 00000000..75c97d25 --- /dev/null +++ b/tests/props/nakamoto.properties @@ -0,0 +1,2 @@ +storage.protocol.mode=postgres +storage.mapping.mode=spring_data