Skip to content

Commit

Permalink
Different reactors and snapshot version
Browse files Browse the repository at this point in the history
  • Loading branch information
pavetok committed Sep 18, 2023
1 parent 9de9022 commit 0bb9e7e
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 56 deletions.
115 changes: 61 additions & 54 deletions .dx/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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:
Expand All @@ -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
14 changes: 14 additions & 0 deletions .dx/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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] }}"
16 changes: 15 additions & 1 deletion apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<properties>
<revision>0.1.0-SNAPSHOT</revision>
<lib.version>LATEST</lib.version>
<lib.version>0.1.0-SNAPSHOT</lib.version>
<lombok.version>1.18.28</lombok.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<skipTests>false</skipTests>
Expand Down Expand Up @@ -114,6 +114,20 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
Expand Down
2 changes: 1 addition & 1 deletion libs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</modules>

<properties>
<revision>LATEST</revision>
<revision>0.1.0-SNAPSHOT</revision>
<kotlin.version>1.9.10</kotlin.version>
<lombok.version>1.18.28</lombok.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
Expand Down

0 comments on commit 0bb9e7e

Please sign in to comment.