Skip to content

Commit

Permalink
Multiple java versions (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavetok authored Oct 22, 2023
1 parent 64c4f60 commit 1937e87
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .dx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# customize local devenv with playbook group vars
/group_vars/
5 changes: 5 additions & 0 deletions .dx/binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
msg: "{{ image_status.results|map(attribute='cmd')|map('join', ' ') }}"
when: image_status is changed
tags: [always]
- name: Capture env
ansible.builtin.include_vars:
file: envs/dev/{{ devenv }}/vars.yaml
name: dev
- name: Create binaries
ansible.builtin.command:
cmd: >
Expand All @@ -59,6 +63,7 @@
{% else %}
package
{% endif %}
--define maven.compiler.release={{ dev.java_release }}
chdir: "{{ playbook_dir }}/.."
strip_empty_ends: false
changed_when: true
Expand Down
4 changes: 2 additions & 2 deletions .dx/envs/dev/church/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
JAVA_VERSION=17.0
PYTHON_VERSION=3.8
JAVA_VERSION=21.0
PYTHON_VERSION=3.10
4 changes: 2 additions & 2 deletions .dx/envs/dev/church/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ansible-core==2.13.13
ansible-lint==6.11.0
ansible-core==2.15.5
ansible-lint==6.20.3
yamllint==1.32.0
2 changes: 2 additions & 0 deletions .dx/envs/dev/church/vars.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
java_release: 21

maven_version:
min: 3.8.0
max: 3.10.0
Expand Down
2 changes: 2 additions & 0 deletions .dx/envs/dev/turing/vars.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
java_release: 19

maven_version:
min: 3.8.0
max: 3.10.0
Expand Down
1 change: 1 addition & 0 deletions .dx/envs/ops/lamport.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
java_release: 19
postgres_version: 16.0
config_mapping_mode: spring_config
config_file_name:
Expand Down
1 change: 1 addition & 0 deletions .dx/envs/ops/shannon.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
java_release: 17
postgres_version: 15.4
config_mapping_mode: lightbend_config
config_file_name:
Expand Down
6 changes: 6 additions & 0 deletions .dx/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
strip_empty_ends: false
changed_when: true
when: image_status is changed
- name: Capture env
ansible.builtin.include_vars:
file: envs/ops/{{ opsenv }}.yaml
name: ops
- name: Create images
ansible.builtin.include_role:
name: image
Expand All @@ -58,6 +62,8 @@
image_home: "{{ playbook_dir }}/../apps/{{ app }}"
image_context: target/docker-context
image_push: "{{ focus == 'solution' }}"
image_args:
JAVA_RELEASE: "{{ ops.java_release }}"
loop: "{{ image_status.results|select('changed')|map(attribute='app') }}"
loop_control:
loop_var: app
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions .dx/roles/image/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
image_tag: latest
image_context: .
image_push: false
image_args: {}
3 changes: 3 additions & 0 deletions .dx/roles/image/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
docker build {{ image_context }}
-f Dockerfile
-t {{ image_name }}:{{ image_tag }}
{% for key, value in image_args.items() %}
--build-arg {{ key }}={{ value }}
{% endfor %}
chdir: "{{ image_home }}"
strip_empty_ends: false
changed_when: true
Expand Down
2 changes: 0 additions & 2 deletions .dx/toolchain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
ansible.builtin.include_vars:
file: envs/dev/{{ devenv }}/vars.yaml
name: dev

- name: Capture maven version
ansible.builtin.command:
cmd: mvn --version --quiet
Expand All @@ -19,7 +18,6 @@
- maven_version.stdout is version(dev.maven_version.min, '>=', version_type='semver')
- maven_version.stdout is version(dev.maven_version.max, '<', version_type='semver')
msg: "{{ dev.maven_version.min }} <= maven < {{ dev.maven_version.max }}"

- name: Capture docker version
ansible.builtin.command:
cmd: docker version --format {{'{{.Server.Version}}'}}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/toolchain-sanity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ jobs:
name: ${{ matrix.devenv.name }}
tools: python java
token: ${{ secrets.GITHUB_TOKEN }}
- run: ansible-playbook codebase.yaml -e focus=toolchain
- run: >
ansible-playbook codebase.yaml
-e focus=toolchain
working-directory: .dx
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ansible-playbook binaries.yaml -e focus=toolchain
- run: >
ansible-playbook binaries.yaml
-e devenv=${{ matrix.devenv.name }}
-e focus=toolchain
working-directory: .dx
env:
GITHUB_ACTOR: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<mapstruct.version>1.5.5.Final</mapstruct.version>
<skipTests>false</skipTests>
<skipUnits>${skipTests}</skipUnits>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -85,7 +86,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>17</release>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
Expand Down
3 changes: 2 additions & 1 deletion apps/sepuling/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM eclipse-temurin:17-jdk-alpine
ARG JAVA_RELEASE
FROM eclipse-temurin:${JAVA_RELEASE}-jre-alpine
RUN addgroup -S bezmen && adduser -S bezmen -G bezmen
USER bezmen:bezmen
WORKDIR /home/bezmen
Expand Down
2 changes: 1 addition & 1 deletion libs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<mockito.version>5.6.0</mockito.version>
<skipTests>false</skipTests>
<skipUnits>${skipTests}</skipUnits>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -325,7 +326,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<release>17</release>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
Expand Down

0 comments on commit 1937e87

Please sign in to comment.