Skip to content

Commit

Permalink
Import with vars files
Browse files Browse the repository at this point in the history
  • Loading branch information
pavetok committed Dec 3, 2023
1 parent a8d5ea8 commit 86f8a77
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 34 deletions.
5 changes: 3 additions & 2 deletions .dx/inventory/group_vars/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .dx/stacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
18 changes: 5 additions & 13 deletions .dx/tasks/solution/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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 }}"
2 changes: 1 addition & 1 deletion .dx/tasks/solution/status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{ lib_cid }}
{{ app_cid }}
{{ schema_cid }}
{{ solution_cid }}
{{ stack_cids.solution }}
register: stack_cid
changed_when: false

Expand Down
13 changes: 9 additions & 4 deletions envs/ops/lamport/vars.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 9 additions & 4 deletions envs/ops/milner/vars.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 9 additions & 4 deletions envs/ops/nakamoto/vars.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 9 additions & 4 deletions envs/ops/shannon/vars.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/props/lamport.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
storage.protocol.mode=postgres
storage.mapping.mode=spring_data
storage.mapping.mode=my_batis
2 changes: 2 additions & 0 deletions tests/props/nakamoto.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
storage.protocol.mode=postgres
storage.mapping.mode=spring_data

0 comments on commit 86f8a77

Please sign in to comment.