diff --git a/app/pom.xml b/app/pom.xml index 08ae9c5c..4d5baa2c 100644 --- a/app/pom.xml +++ b/app/pom.xml @@ -7,7 +7,7 @@ smecalculus.bezmen bezmen - latest + ${revision} app @@ -100,8 +100,9 @@ ${project.groupId} ${project.artifactId} - ${project.version} + ${revision} ${project.build.directory}/image/bin + ${project.packaging} diff --git a/app/sepuling-kotlin/pom.xml b/app/sepuling-kotlin/pom.xml index 35e88389..930f211a 100644 --- a/app/sepuling-kotlin/pom.xml +++ b/app/sepuling-kotlin/pom.xml @@ -47,18 +47,6 @@ - - - - org.jetbrains.kotlin - kotlin-bom - ${kotlin.version} - import - pom - - - - diff --git a/lib/pom.xml b/lib/pom.xml index 66ac6569..7d279a63 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -7,7 +7,7 @@ smecalculus.bezmen bezmen - latest + ${revision} lib @@ -27,13 +27,6 @@ 3.2.4 - - - github - https://maven.pkg.github.com/smecalculus/bezmen - - - org.projectlombok @@ -52,37 +45,37 @@ ${project.groupId} abstraction-client - ${project.version} + ${revision} ${project.groupId} abstraction - ${project.version} + ${revision} ${project.groupId} essentials - ${project.version} + ${revision} ${project.groupId} messaging-client - ${project.version} + ${revision} ${project.groupId} messaging - ${project.version} + ${revision} ${project.groupId} storage - ${project.version} + ${revision} ${project.groupId} testing - latest + ${revision} org.projectlombok @@ -94,6 +87,13 @@ mapstruct 1.5.5.Final + + org.jetbrains.kotlin + kotlin-bom + 1.9.22 + import + pom + org.mapstruct mapstruct-processor @@ -246,31 +246,10 @@ org.apache.maven.plugins - maven-dependency-plugin - - - capture - - copy - - - ${project.build.directory} - - - ${project.groupId} - abstraction-client - ${project.version} - - - ${project.groupId} - messaging-client - ${project.version} - jar - - - - - + maven-install-plugin + + false + diff --git a/orchestrator/ansible/binaries.yaml b/orchestrator/ansible/binaries.yaml index 8fe64f91..d7788fc3 100644 --- a/orchestrator/ansible/binaries.yaml +++ b/orchestrator/ansible/binaries.yaml @@ -9,7 +9,6 @@ cmd: git hash-object --stdin stdin: | {{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=lib') }} - {{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=app') }} register: binary_cid changed_when: false - name: Build, check, publish @@ -36,8 +35,7 @@ - name: Coverage ansible.builtin.command: cmd: >- - mvn clean - antrun:run@coverage + mvn antrun:run@coverage --no-snapshot-updates --batch-mode --projects :tool diff --git a/orchestrator/ansible/images.yaml b/orchestrator/ansible/images.yaml index 3977f245..bd66d793 100644 --- a/orchestrator/ansible/images.yaml +++ b/orchestrator/ansible/images.yaml @@ -7,44 +7,17 @@ apply: tags: [always] tags: [always] + - ansible.builtin.include_tasks: # noqa: name[missing] + file: tasks/{{ inventory_hostname }}/build.yaml + when: hostvars[inventory_hostname].image_status is changed -- name: DATABASE IMAGES - hosts: db - tasks: - - ansible.builtin.import_role: # noqa: name[missing] - name: image - tasks_from: clean - vars: - image_keys: >- - {{ image_status.results - | select('changed') - | map(attribute='vendor') - | map('regex_replace', '^(.*)$', 'db/\1/' ~ devenv) - }} - when: image_status is changed - - ansible.builtin.import_tasks: # noqa: name[missing] - file: tasks/db/build.yaml - when: image_status is changed - -- name: APPLICATION IMAGES - hosts: app - tasks: - - ansible.builtin.import_role: # noqa: name[missing] - name: image - tasks_from: clean - vars: - image_keys: >- - {{ image_status.results - | select('changed') - | map(attribute='app') - | map('regex_replace', '^(.*)$', 'app/\1/' ~ devenv) - }} - when: image_status is changed - +# building everything without exception otherwise purely external libs will not be published - import_playbook: binaries.yaml # noqa: name[play] vars: maven_phase: "{{ 'deploy' if repo_mode == 'rw' else 'install' }}" - when: hostvars.app.image_status is changed + when: >- + hostvars.app.image_status is changed or + hostvars.tool.image_status is changed - name: ALL IMAGES hosts: images diff --git a/orchestrator/ansible/inventory/aliases.yaml b/orchestrator/ansible/inventory/aliases.yaml index c8aa7814..5a842736 100644 --- a/orchestrator/ansible/inventory/aliases.yaml +++ b/orchestrator/ansible/inventory/aliases.yaml @@ -8,6 +8,7 @@ images: hosts: db: app: + tool: stacks: hosts: gear: diff --git a/orchestrator/ansible/tasks/app/build.yaml b/orchestrator/ansible/tasks/app/build.yaml new file mode 100644 index 00000000..c10d54ae --- /dev/null +++ b/orchestrator/ansible/tasks/app/build.yaml @@ -0,0 +1,11 @@ +--- +- ansible.builtin.import_role: # noqa: name[missing] + name: image + tasks_from: clean + vars: + image_keys: >- + {{ image_status.results + | select('changed') + | map(attribute='app') + | map('regex_replace', '^(.*)$', 'app/\1/' ~ devenv) + }} diff --git a/orchestrator/ansible/tasks/db/build.yaml b/orchestrator/ansible/tasks/db/build.yaml index e0c15536..82127c3c 100644 --- a/orchestrator/ansible/tasks/db/build.yaml +++ b/orchestrator/ansible/tasks/db/build.yaml @@ -1,4 +1,15 @@ --- +- ansible.builtin.import_role: # noqa: name[missing] + name: image + tasks_from: clean + vars: + image_keys: >- + {{ image_status.results + | select('changed') + | map(attribute='vendor') + | map('regex_replace', '^(.*)$', 'db/\1/' ~ devenv) + }} + - ansible.builtin.include_role: # noqa: name[missing] name: image tasks_from: build diff --git a/orchestrator/ansible/tasks/gear/capture.yaml b/orchestrator/ansible/tasks/gear/capture.yaml index 1993e415..f3920aac 100644 --- a/orchestrator/ansible/tasks/gear/capture.yaml +++ b/orchestrator/ansible/tasks/gear/capture.yaml @@ -3,8 +3,6 @@ ansible.builtin.command: cmd: git hash-object --stdin stdin: | - {{ lookup('ansible.builtin.pipe', 'git rev-parse :pom.xml') }} - {{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=tool') }} {{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=test') }} {{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=orchestrator') }} {{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=stack/gear/env/' ~ devenv) }} diff --git a/orchestrator/ansible/tasks/tool/build.yaml b/orchestrator/ansible/tasks/tool/build.yaml new file mode 100644 index 00000000..89fb6328 --- /dev/null +++ b/orchestrator/ansible/tasks/tool/build.yaml @@ -0,0 +1,16 @@ +--- +- ansible.builtin.import_role: # noqa: name[missing] + name: image + tasks_from: clean + vars: + image_keys: + - "tool/builder/{{ devenv }}" + +- ansible.builtin.import_role: # noqa: name[missing] + name: image + tasks_from: build + vars: + image_home: "{{ project.dir }}/tool" + image_context: . + image_key: "tool/builder/{{ devenv }}" + image_tag: "tool/builder:{{ devenv }}" diff --git a/orchestrator/ansible/tasks/tool/capture.yaml b/orchestrator/ansible/tasks/tool/capture.yaml new file mode 100644 index 00000000..e24a0404 --- /dev/null +++ b/orchestrator/ansible/tasks/tool/capture.yaml @@ -0,0 +1,24 @@ +--- +- name: Capture CID + ansible.builtin.command: + cmd: git hash-object --stdin + stdin: | + {{ lookup('ansible.builtin.pipe', 'git rev-parse :pom.xml') }} + {{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=tool') }} + register: package_cid + changed_when: false + +- name: Declare tag + ansible.builtin.set_fact: + package_tag: "{{ devenv }}-{{ package_cid.stdout[:7] }}" + changed_when: false + +- name: Capture status + ansible.builtin.command: + cmd: docker {{ docker_entity }} inspect {{ image_ns }}/{{ item }} + register: image_status + failed_when: false + changed_when: + - image_status.rc != 0 + loop: + - "tool/builder:{{ package_tag }}" diff --git a/orchestrator/ansible/tasks/tool/publish.yaml b/orchestrator/ansible/tasks/tool/publish.yaml new file mode 100644 index 00000000..8eaa0b81 --- /dev/null +++ b/orchestrator/ansible/tasks/tool/publish.yaml @@ -0,0 +1,8 @@ +--- +- ansible.builtin.import_role: # noqa: name[missing] + name: image + tasks_from: publish + vars: + image_source_tag: "tool/builder:{{ devenv }}" + image_target_tags: + - "{{ image_ns }}/tool/builder:{{ hostvars.tool.package_tag }}" diff --git a/pom.xml b/pom.xml index 37138749..0e409988 100644 --- a/pom.xml +++ b/pom.xml @@ -6,8 +6,8 @@ smecalculus.bezmen bezmen + ${revision} pom - latest lib @@ -29,7 +29,6 @@ church church - 2.0.0-Beta4 21 @@ -37,7 +36,6 @@ turing turing - 1.9.22 21 @@ -48,12 +46,18 @@ godel - 1.8.22 17 + + + github + https://maven.pkg.github.com/smecalculus/bezmen + + + @@ -69,6 +73,7 @@ flatten-maven-plugin + @@ -174,7 +179,7 @@ org.jetbrains.kotlin kotlin-maven-plugin - ${kotlin.version} + 1.9.22 ${maven.compiler.release} @@ -280,6 +285,34 @@ org.apache.maven.plugins maven-dependency-plugin 3.6.1 + + + get + none + + get + + + false + ${project.groupId} + ${project.artifactId} + ${revision} + ${project.packaging} + ${project.distributionManagement.repository.url} + + + + purge + none + + purge-local-repository + + + artifactId + ${project.groupId}:${project.artifactId} + + + org.codehaus.mojo @@ -363,6 +396,9 @@ org.apache.maven.plugins maven-install-plugin 3.1.1 + + true + org.apache.maven.plugins diff --git a/test/e2e/pom.xml b/test/e2e/pom.xml index 4a1ea4b5..84cb176e 100644 --- a/test/e2e/pom.xml +++ b/test/e2e/pom.xml @@ -7,7 +7,7 @@ smecalculus.bezmen test - latest + ${revision} e2e diff --git a/test/pom.xml b/test/pom.xml index f8b86a49..96070642 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -7,7 +7,7 @@ smecalculus.bezmen bezmen - latest + ${revision} test @@ -30,7 +30,7 @@ ${project.groupId} tool - latest + ${revision} import pom diff --git a/tool/Dockerfile b/tool/Dockerfile new file mode 100644 index 00000000..2c232c01 --- /dev/null +++ b/tool/Dockerfile @@ -0,0 +1,2 @@ +FROM scratch +COPY Dockerfile . diff --git a/tool/pom.xml b/tool/pom.xml index 1ff7a14e..8602b686 100644 --- a/tool/pom.xml +++ b/tool/pom.xml @@ -7,7 +7,7 @@ smecalculus.bezmen bezmen - latest + ${revision} tool @@ -174,6 +174,13 @@ + + org.apache.maven.plugins + maven-install-plugin + + false + + diff --git a/tool/testing/pom.xml b/tool/testing/pom.xml index 2ebd5702..893074cb 100644 --- a/tool/testing/pom.xml +++ b/tool/testing/pom.xml @@ -7,7 +7,7 @@ smecalculus.bezmen tool - latest + ${revision} testing