Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/envs/dev/church/ansible-lint-…
Browse files Browse the repository at this point in the history
…6.22.1
  • Loading branch information
pavetok authored Dec 9, 2023
2 parents 61c36df + 186c39a commit 0727dc9
Show file tree
Hide file tree
Showing 114 changed files with 1,045 additions and 1,369 deletions.
30 changes: 12 additions & 18 deletions .dx/binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,16 @@
hosts: app
run_once: true
tasks:
- name: Capture env
ansible.builtin.include_vars:
file: ../envs/dev/{{ devenv }}/vars.yaml
name: dev
tags: [always]
- name: Capture cid's
ansible.builtin.command:
cmd: git hash-object --stdin
stdin: |
{{ app_cids[app] }}
{% for lib in app_deps[app] %}
{{ lib_cids[lib] }}
{% endfor %}
{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs')[:7] }}
{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps/' ~ app)[:7] }}
# TODO: try to choose better name
register: image_cid
changed_when: false
# TODO: simplify after fix of https://youtrack.jetbrains.com/issue/KT-60507
loop: "{{ app_cids.keys() if dev.java_release < 21 else app_cids.keys()|difference(['sepuling-kotlin']) }}"
loop: "{{ solution.apps.values()|flatten|map(attribute='binary') }}"
loop_control:
loop_var: app
tags: [always]
Expand All @@ -30,13 +22,15 @@
tags: [always]
- name: Capture statuses
ansible.builtin.command:
cmd: docker {{ docker_entity }} inspect {{ app_images[app] }}:{{ image_cids[app][:7] }}-{{ devenv }}
cmd: docker {{ docker_entity }} inspect {{ app.image }}:{{ image_cids[app.binary][:7] }}-{{ devenv }}
register: image_status
changed_when: image_status.rc != 0
changed_when:
- image_status.rc != 0
failed_when: false
loop: "{{ image_cids.keys() }}"
loop: "{{ solution.apps.values()|flatten }}"
loop_control:
loop_var: app
label: "{{ app.binary }}"
tags: [always]
- name: Status commands
ansible.builtin.debug:
Expand All @@ -50,18 +44,18 @@
--no-snapshot-updates
--fail-fast
--batch-mode
--threads 1C
--threads 2
--projects {{
image_status.results
| select('changed')
| map(attribute='app')
| map('regex_replace', '^', 'apps/')
| map(attribute='app.binary')
| map('regex_replace', '^', ':')
| join(',')
}}
--also-make
clean
{{ maven_phase | default('package') }}
--define maven.compiler.release={{ dev.java_release }}
--define maven.compiler.release={{ dev[devenv].jdk.release }}
chdir: "{{ playbook_dir }}/.."
strip_empty_ends: false
changed_when: true
Expand Down
44 changes: 23 additions & 21 deletions .dx/images.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
---
- import_playbook: binaries.yaml # noqa: name[play]
vars:
maven_phase: "{{ 'install' if binary_repo == 'local' else 'deploy' }}"
maven_phase: "{{ 'install' if binary_storage == 'local' else 'deploy' }}"
tags: [binaries, deps]

- name: Images
hosts: schema
hosts: db
run_once: true
tasks:
- name: Capture statuses
ansible.builtin.command:
cmd: docker {{ docker_entity }} inspect {{ schema_images[schema] }}:{{ schema_cids[schema] }}
cmd: >
docker
{{ docker_entity }}
inspect
{{ solution.databases[storage].image }}:{{ solution.databases[storage].cid }}
register: image_status
changed_when: image_status.rc != 0
failed_when: false
loop: "{{ schema_images.keys() }}"
loop: "{{ solution.schemas.keys() }}"
loop_control:
loop_var: schema
loop_var: storage
- name: Status commands
ansible.builtin.debug:
msg: "{{ image_status.results|map(attribute='cmd')|map('join', ' ') }}"
Expand All @@ -25,13 +29,13 @@
ansible.builtin.include_role:
name: image
vars:
image_tag: "{{ schema_cids[schema] }}"
image_name: "{{ schema_images[schema] }}"
image_home: "{{ playbook_dir }}/../schemas/{{ schema }}"
image_push: "{{ image_repo != 'local' }}"
loop: "{{ image_status.results|select('changed')|map(attribute='schema') }}"
image_tag: "{{ solution.databases[storage].cid }}"
image_name: "{{ solution.databases[storage].image }}"
image_home: "{{ playbook_dir }}/../databases/{{ storage }}"
image_push: "{{ image_storage != 'local' }}"
loop: "{{ image_status.results|select('changed')|map(attribute='storage') }}"
loop_control:
loop_var: schema
loop_var: storage

- name: Images
hosts: app
Expand All @@ -43,28 +47,26 @@
mvn
--no-snapshot-updates
--batch-mode
--projects tools
clean
antrun:run@coverage
chdir: "{{ playbook_dir }}/../tools"
chdir: "{{ playbook_dir }}/.."
strip_empty_ends: false
changed_when: true
when: image_status is changed
- name: Capture env
ansible.builtin.include_vars:
file: ../envs/dev/{{ devenv }}/vars.yaml
name: dev
- name: Create images
ansible.builtin.include_role:
name: image
vars:
image_tag: "{{ image_cids[app][:7] }}-{{ devenv }}"
image_name: "{{ app_images[app] }}"
image_home: "{{ playbook_dir }}/../apps/{{ app }}"
image_tag: "{{ image_cids[app.binary][:7] }}-{{ devenv }}"
image_name: "{{ app.image }}"
image_home: "{{ playbook_dir }}/../apps/{{ app.binary }}"
image_context: target/docker-context
image_push: "{{ image_repo != 'local' }}"
image_push: "{{ image_storage != 'local' }}"
image_args:
JAVA_RELEASE: "{{ dev.java_release }}"
JAVA_RELEASE: "{{ dev[devenv].jdk.release }}"
loop: "{{ image_status.results|select('changed')|map(attribute='app') }}"
loop_control:
loop_var: app
label: "{{ app.binary }}"
when: image_status is changed
14 changes: 5 additions & 9 deletions .dx/inventory/aliases.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
---
all:
hosts:
app:
schema:
test:
vars:
ansible_connection: local
codebase:
hosts:
java:
ansible:
github:
vars:
ansible_connection: local
stack:
hosts:
solution:
toolchain:
all:
hosts:
db:
app:
test:
vars:
ansible_connection: local
52 changes: 0 additions & 52 deletions .dx/inventory/group_vars/all.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions .dx/inventory/group_vars/all/aims.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
aim: toy
aims:
toy:
storage: postgres
apps:
- sepuling
func:
storage: postgres
apps:
- sepuling
58 changes: 58 additions & 0 deletions .dx/inventory/group_vars/all/envs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
devenv: turing
dev:
anyone:
maven:
min: 3.8.0
max: 3.10.0
docker:
min: 24.0.0
max: 25.0.0
godel:
jdk:
release: 17
turing:
jdk:
release: 19
church:
jdk:
release: 21

opsenv: lamport
ops:
shannon:
storage:
vendor: postgres
version: 14.9
mapping_mode: my_batis
app:
lang: java
config:
mapping_mode: lightbend_config
lamport:
storage:
vendor: postgres
version: 15.4
mapping_mode: my_batis
app:
lang: kotlin
config:
mapping_mode: lightbend_config
milner:
storage:
vendor: postgres
version: 15.4
mapping_mode: spring_data
app:
lang: kotlin
config:
mapping_mode: spring_config
nakamoto:
storage:
vendor: postgres
version: 16.0
mapping_mode: spring_data
app:
lang: java
config:
mapping_mode: spring_config
43 changes: 43 additions & 0 deletions .dx/inventory/group_vars/all/stacks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
toolchain:
image:
name: "{{ image_repo }}/stack/toolchain"

solution:
name: "{{ project.name }}"
cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=stacks/solution')[:7] }}"
image:
name: "{{ image_repo }}/stack/solution-{{ aim }}"
config:
file_name: "application.{{ config_exts[ops[opsenv].config.mapping_mode] }}"
mapping_mode: "{{ ops[opsenv].config.mapping_mode }}"
storages:
postgres:
image: "docker.io/library/postgres"
dba:
username: "postgres"
password: "password"
owner:
username: "{{ project.name }}"
password: "{{ project.name }}"
databases:
postgres:
name: "{{ project.name }}"
cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=databases/postgres')[:7] }}"
image: "{{ image_repo }}/database/postgres"
schemas:
postgres:
- name: sepulkarium
apps:
java:
- service: sepuling
image: "{{ image_repo }}/app/sepuling-java"
binary: sepuling-java
kotlin:
- service: sepuling
image: "{{ image_repo }}/app/sepuling-kotlin"
binary: sepuling-kotlin

config_exts:
lightbend_config: conf
spring_config: yaml
11 changes: 11 additions & 0 deletions .dx/inventory/group_vars/all/vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
project:
name: bezmen
org: smecalculus

binary_storage: local
image_storage: local

image_repo: "{{ image_storage }}/{{ project.org }}/{{ project.name }}"

docker_entity: "{{ 'image' if image_storage == 'local' else 'manifest' }}"
2 changes: 2 additions & 0 deletions .dx/stacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
- name: Testing
hosts: stack
run_once: true
vars:
stack_dir: "{{ playbook_dir }}/../stacks/solution"
tasks:
- ansible.builtin.import_tasks: # noqa: name[missing]
file: tasks/solution/build.yaml
Expand Down
Loading

0 comments on commit 0727dc9

Please sign in to comment.