diff --git a/.dx/binaries.yml b/.dx/binaries.yml index 314de93e..03c58ebc 100644 --- a/.dx/binaries.yml +++ b/.dx/binaries.yml @@ -3,27 +3,27 @@ hosts: lib run_once: true tasks: - - name: Capture status - ansible.builtin.command: - # todo: try to implement more lightweight check - cmd: > - mvn - {% if binary_repo == 'local' %} - --offline - {% else %} - --define remoteRepositories=github::::https://{{ binary_repo }}/smecalculus/bezmen - {% endif %} - dependency:get - --define transitive=false - --define artifact=smecalculus.bezmen:libs:{{ lib_version }}:pom - chdir: "{{ playbook_dir }}/../libs" - register: binary_status - changed_when: binary_status.rc != 0 - failed_when: false - - name: Status command - ansible.builtin.debug: - msg: "{{ binary_status.cmd|join(' ') }}" - when: binary_status is changed +# - name: Capture status +# ansible.builtin.command: +# # todo: try to implement more lightweight check +# cmd: > +# mvn +# {% if binary_repo == 'local' %} +# --offline +# {% else %} +# --define remoteRepositories=github::::https://{{ binary_repo }}/smecalculus/bezmen +# {% endif %} +# dependency:get +# --define transitive=false +# --define artifact=smecalculus.bezmen:libs:{{ lib_version }}:pom +# chdir: "{{ playbook_dir }}/../libs" +# register: binary_status +# changed_when: binary_status.rc != 0 +# failed_when: false +# - name: Status command +# ansible.builtin.debug: +# msg: "{{ binary_status.cmd|join(' ') }}" +# when: binary_status is changed - name: Create binaries ansible.builtin.command: cmd: > @@ -38,34 +38,37 @@ {% else %} install {% endif %} - --define revision={{ lib_version }} chdir: "{{ playbook_dir }}/../libs" changed_when: true - when: binary_status is changed - name: Binaries hosts: app run_once: true tasks: - - name: Capture cid + - name: Capture cid's ansible.builtin.command: cmd: git hash-object --stdin stdin: | - {{ lib_cid }} - {{ app_cid }} + {{ app_cids[app] }} + {% for lib in app_deps[app] %} + {{ lib_cids[lib] }} + {% endfor %} # TODO: try to choose better name register: image_cid changed_when: false + loop: "{{ app_images.keys() }}" + loop_control: + loop_var: app tags: [always] - name: Capture statuses ansible.builtin.command: - cmd: docker {{ docker_entity }} inspect {{ item.value }}:{{ image_cid.stdout[:7] }} + cmd: docker {{ docker_entity }} inspect {{ app_images[item.app] }}:{{ item.stdout[:7] }} register: image_status changed_when: image_status.rc != 0 failed_when: false - loop: "{{ app_images|dict2items }}" + loop: "{{ image_cid.results }}" loop_control: - label: "{{ item.key }}" + label: "{{ item.app }}" tags: [always] - name: Status commands ansible.builtin.debug: @@ -80,36 +83,40 @@ --fail-fast --batch-mode --threads 1C - {% if not hostvars.lib.binary_status|default({}) is changed %} - --projects {{ image_status.results|select('changed')|map(attribute='item.key')|join(',') }} - {% endif %} + --projects {{ image_status.results|select('changed')|map(attribute='item.app')|join(',') }} clean - {% if up_to_images|default(false) %} - verify - {% else %} package - {% endif %} --define revision={{ app_version }} - --define lib.version={{ lib_version }} chdir: "{{ playbook_dir }}/../apps" strip_empty_ends: false changed_when: true when: image_status is changed -- name: Binaries - hosts: test - run_once: true - tasks: - - name: Create binaries - ansible.builtin.command: - cmd: > - mvn - --no-snapshot-updates - --batch-mode - clean - test-compile - --define lib.version={{ lib_version }} - chdir: "{{ playbook_dir }}/../tests" - strip_empty_ends: false - changed_when: true - when: hostvars.lib.binary_status|default({}) 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 +# tasks: +# - name: Create binaries +# ansible.builtin.command: +# cmd: > +# mvn +# --no-snapshot-updates +# --batch-mode +# clean +# test-compile +# --define lib.version={{ lib_version }} +# chdir: "{{ playbook_dir }}/../tests" +# strip_empty_ends: false +# changed_when: true +# when: hostvars.lib.binary_status|default({}) is changed diff --git a/.dx/group_vars/all.yml b/.dx/group_vars/all.yml index 432a2077..4707b50c 100644 --- a/.dx/group_vars/all.yml +++ b/.dx/group_vars/all.yml @@ -41,3 +41,17 @@ stack_images: 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/apps/pom.xml b/apps/pom.xml index 11914654..2e60dc58 100644 --- a/apps/pom.xml +++ b/apps/pom.xml @@ -16,7 +16,7 @@ 0.1.0-SNAPSHOT - LATEST + 0.1.0-SNAPSHOT 1.18.28 1.5.5.Final false @@ -114,6 +114,20 @@ + + maven-install-plugin + 3.1.1 + + true + + + + maven-deploy-plugin + 3.1.1 + + true + + maven-assembly-plugin 3.6.0 diff --git a/libs/pom.xml b/libs/pom.xml index 20f183b4..9e772f15 100644 --- a/libs/pom.xml +++ b/libs/pom.xml @@ -20,7 +20,7 @@ - LATEST + 0.1.0-SNAPSHOT 1.9.10 1.18.28 1.5.5.Final