From bd33e7e1e747fa16194f096cb3ea3d74af7cc6bb Mon Sep 17 00:00:00 2001
From: Pavel Vetokhin
Date: Tue, 19 Sep 2023 20:02:28 +0300
Subject: [PATCH] Build in one reactor
---
.dx/binaries.yml | 48 +++++++++--------------------------
.dx/group_vars/all.yml | 24 ++++++++----------
.dx/images.yml | 24 ++++++++++--------
apps/pom.xml | 29 +++------------------
libs/pom.xml | 19 --------------
pom.xml | 38 +++++++++++++++++++++++++++
tests/pom.xml | 11 +-------
{.tools => tools}/README.adoc | 0
{.tools => tools}/pom.xml | 0
9 files changed, 79 insertions(+), 114 deletions(-)
create mode 100644 pom.xml
rename {.tools => tools}/README.adoc (100%)
rename {.tools => tools}/pom.xml (100%)
diff --git a/.dx/binaries.yml b/.dx/binaries.yml
index b13cddd8..17eb790a 100644
--- a/.dx/binaries.yml
+++ b/.dx/binaries.yml
@@ -1,25 +1,4 @@
---
-- name: Binaries
- hosts: lib
- run_once: true
- tasks:
- - name: Create binaries
- ansible.builtin.command:
- cmd: >
- mvn
- --no-snapshot-updates
- --fail-fast
- --batch-mode
- --threads 1C
- clean
- {% if focus == 'solution' %}
- deploy
- {% else %}
- install
- {% endif %}
- chdir: "{{ playbook_dir }}/../libs"
- changed_when: true
-
- name: Binaries
hosts: app
run_once: true
@@ -62,25 +41,19 @@
--fail-fast
--batch-mode
--threads 1C
- --projects {{ image_status.results|select('changed')|map(attribute='item.app')|join(',') }}
+ --projects {{ image_status.results|select('changed')|map(attribute='item.app')|map('regex_replace', '^', 'apps/')|join(',') }}
+ --also-make
clean
+ {% if focus == 'solution' and up_to_images|default(false) %}
+ deploy
+ {% else %}
package
- chdir: "{{ playbook_dir }}/../apps"
+ {% endif %}
+ chdir: "{{ playbook_dir }}/.."
strip_empty_ends: false
changed_when: true
when: image_status is changed
-# {% if hostvars.lib.binary_status|default({}) is changed %}
-# --also-make
-# {% endif %}
-# {% if not up_to_images|default(false) %}
-# package
-# {% elif focus == 'pipeline' %}
-# install
-# {% else %}
-# deploy
-# {% endif %}
-
- name: Binaries
hosts: test
run_once: true
@@ -91,8 +64,11 @@
mvn
--no-snapshot-updates
--batch-mode
+ --projects tools,tests
+ --also-make
clean
- test-compile
- chdir: "{{ playbook_dir }}/../tests"
+ package
+ chdir: "{{ playbook_dir }}/.."
strip_empty_ends: false
changed_when: true
+ when: focus == 'pipeline'
diff --git a/.dx/group_vars/all.yml b/.dx/group_vars/all.yml
index 4707b50c..dcc9ecc9 100644
--- a/.dx/group_vars/all.yml
+++ b/.dx/group_vars/all.yml
@@ -6,8 +6,19 @@ usage: toy
prefs: turing
lib_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs')[:7] }}"
+lib_cids:
+ client: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/client')[:7] }}"
+ construction: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/construction')[:7] }}"
+ data: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/data')[:7] }}"
+ essentials: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/essentials')[:7] }}"
+ messaging: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/messaging')[:7] }}"
+ testing: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/testing')[:7] }}"
app_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps')[:7] }}"
+app_cids:
+ foo: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:apps/foo')[:7] }}"
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] }}"
lib_version: 0.1.0-{{ lib_cid }}
@@ -32,26 +43,13 @@ image_repo: local
app_images:
foo: "{{ image_repo }}/{{ organization }}/{{ project }}/app/foo"
-
schema_images:
postgres: "{{ image_repo }}/{{ organization }}/{{ project }}/schema/postgres"
-
stack_images:
solution: "{{ image_repo }}/{{ organization }}/{{ project }}/stack/solution-{{ usage }}-{{ prefs }}"
pipeline: "{{ image_repo }}/{{ organization }}/{{ project }}/stack/pipeline-{{ environ }}"
docker_entity: "{{ 'image' if image_repo == 'local' else 'manifest' }}"
-app_cids:
- foo: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:apps/foo')[:7] }}"
-
app_deps:
foo: [essentials, construction, client, messaging, data]
-
-lib_cids:
- client: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:libs/client')[:7] }}"
- construction: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:libs/construction')[:7] }}"
- data: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:libs/data')[:7] }}"
- essentials: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:libs/essentials')[:7] }}"
- messaging: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:libs/messaging')[:7] }}"
- testing: "{{ lookup('ansible.builtin.pipe', 'git rev-parse HEAD:libs/testing')[:7] }}"
diff --git a/.dx/images.yml b/.dx/images.yml
index 9bf2762a..bcc75e20 100644
--- a/.dx/images.yml
+++ b/.dx/images.yml
@@ -10,13 +10,13 @@
tasks:
- name: Capture statuses
ansible.builtin.command:
- cmd: docker {{ docker_entity }} inspect {{ item.value }}:{{ schema_cid }}
+ cmd: docker {{ docker_entity }} inspect {{ schema_images[schema] }}:{{ schema_cids[schema] }}
register: image_status
changed_when: image_status.rc != 0
failed_when: false
- loop: "{{ schema_images|dict2items }}"
+ loop: "{{ schema_images.keys() }}"
loop_control:
- label: "{{ item.key }}"
+ loop_var: schema
- name: Status commands
ansible.builtin.debug:
msg: "{{ image_status.results|map(attribute='cmd')|map('join', ' ') }}"
@@ -25,11 +25,13 @@
ansible.builtin.include_role:
name: image
vars:
- image_tag: "{{ schema_cid }}"
- image_name: "{{ item.value }}"
- image_home: "{{ playbook_dir }}/../schemas/{{ item.key }}"
+ image_tag: "{{ schema_cids[schema] }}"
+ image_name: "{{ schema_images[schema] }}"
+ image_home: "{{ playbook_dir }}/../schemas/{{ schema }}"
image_push: "{{ focus == 'solution' }}"
- loop: "{{ image_status.results|select('changed')|map(attribute='item') }}"
+ loop: "{{ image_status.results|select('changed')|map(attribute='schema') }}"
+ loop_control:
+ loop_var: schema
- name: Images
hosts: app
@@ -43,7 +45,7 @@
--batch-mode
clean
antrun:run@coverage
- chdir: "{{ playbook_dir }}/../.tools"
+ chdir: "{{ playbook_dir }}/../tools"
strip_empty_ends: false
changed_when: true
when: image_status is changed
@@ -51,9 +53,9 @@
ansible.builtin.include_role:
name: image
vars:
- image_tag: "{{ image_cid.stdout[:7] }}"
- image_name: "{{ item.value }}"
- image_home: "{{ playbook_dir }}/../apps/{{ item.key }}"
+ image_tag: "{{ item.stdout[:7] }}"
+ image_name: "{{ app_images[item.app] }}"
+ image_home: "{{ playbook_dir }}/../apps/{{ item.app }}"
image_context: target/docker-context
image_push: "{{ focus == 'solution' }}"
loop: "{{ image_status.results|select('changed')|map(attribute='item') }}"
diff --git a/apps/pom.xml b/apps/pom.xml
index aae6c836..03698fa1 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -53,7 +53,10 @@
- maven-dependency-plugin
+ maven-install-plugin
+
+
+ maven-deploy-plugin
maven-surefire-plugin
@@ -140,30 +143,6 @@
-
- maven-dependency-plugin
- 3.6.0
-
-
- analyze
-
- analyze-only
-
-
- true
- true
- true
-
- org.junit.jupiter:junit-jupiter-engine
-
-
-
- *:*
-
-
-
-
-
com.diffplug.spotless
spotless-maven-plugin
diff --git a/libs/pom.xml b/libs/pom.xml
index 9e772f15..4df10b10 100644
--- a/libs/pom.xml
+++ b/libs/pom.xml
@@ -430,25 +430,6 @@
maven-dependency-plugin
3.6.0
-
- analyze
-
- analyze-only
-
-
- true
- true
- true
-
- *:*
-
-
- org.projectlombok:lombok
- org.junit.jupiter:junit-jupiter-engine
-
-
-
-
reset
clean
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 00000000..741e2a96
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,38 @@
+
+
+ 4.0.0
+
+ pom
+
+ smecalculus.bezmen
+ root
+ latest
+
+
+ libs
+ apps
+ tools
+ tests
+
+
+
+
+
+ maven-install-plugin
+ 3.1.1
+
+ true
+
+
+
+ maven-deploy-plugin
+ 3.1.1
+
+ true
+
+
+
+
+
diff --git a/tests/pom.xml b/tests/pom.xml
index a4ff1f69..c462da46 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -16,7 +16,6 @@
turing
- LATEST
1.18.28
UTF-8
@@ -28,20 +27,12 @@
-
-
- org.projectlombok
- lombok
- provided
-
-
-
${project.groupId}
libs
- ${lib.version}
+ 0.1.0-SNAPSHOT
pom
import
diff --git a/.tools/README.adoc b/tools/README.adoc
similarity index 100%
rename from .tools/README.adoc
rename to tools/README.adoc
diff --git a/.tools/pom.xml b/tools/pom.xml
similarity index 100%
rename from .tools/pom.xml
rename to tools/pom.xml