Skip to content

Commit 42939b7

Browse files
author
Francisco Javier Tsao Santín
authored
Merge pull request #128 from idealista/develop
Release 5.2.0
2 parents 86dbe09 + 765974f commit 42939b7

28 files changed

Lines changed: 392 additions & 140 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch
44

55
## [Unreleased](https://github.com/idealista/java_role/tree/develop)
66

7+
## [5.2.0](https://github.com/idealista/java_role/tree/5.2.0) (2020-06-04)
8+
[Full Changelog](https://github.com/idealista/java_role/compare/5.1.0...5.2.0)
9+
### Changed
10+
- *[#39](https://github.com/idealista/java_role/issues/39) Improved adding extra repositories* @frantsao
11+
### Fixed
12+
- Fix OpenJDK 8 in Debian 8 installation (removed unwanted OpenJDK 7 package)
13+
714
## [5.1.0](https://github.com/idealista/java_role/tree/5.1.0) (2020-05-20)
815
[Full Changelog](https://github.com/idealista/java_role/compare/5.0.0...5.1.0)
916
### Changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ Create or add to your roles dependency file (e.g requirements.yml):
4242
```yml
4343
- src: http://github.com/idealista/java_role.git
4444
scm: git
45-
version: 5.1.0
45+
version: 5.2.0
4646
name: java
4747
```
4848
4949
or using [Ansible Galaxy](https://galaxy.ansible.com/idealista/java_role/) as origin if you prefer:
5050
5151
```yml
5252
- src: idealista.java_role
53-
version: 5.1.0
53+
version: 5.2.0
5454
name: java
5555
```
5656
@@ -124,6 +124,7 @@ CentOS 7 | `11` (default)
124124
CentOS 8 | `1.8.0`
125125
CentOS 8 | `11` (default)
126126

127+
Other OpenJDK implementations out of GNU/Linux distributions streams are not officially supported, but it's easy use this role too adding extra repositories (see group vars in AdoptOpenJDK and Corretto molecule tests).
127128
## Testing
128129

129130
```sh

defaults/main.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
---
2-
3-
# OpenJDK implementation
4-
java_open_jdk_package: openjdk-{{ java_open_jdk_version_major }}-jdk-headless
5-
java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-openjdk-amd64
2+
java_open_jdk_apt_extra_packages: []
63
java_open_jdk_home: /usr/lib/jvm/{{ java_open_jdk_home_dir }}
7-
java_open_jdk_default_java_home: /usr/lib/jvm/default-java
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Molecule managed
2+
3+
{% if item.registry is defined %}
4+
FROM {{ item.registry.url }}/{{ item.image }}
5+
{% else %}
6+
FROM {{ item.image }}
7+
{% endif %}
8+
9+
RUN mkdir -p /usr/share/man/man1
10+
11+
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
12+
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python36 sudo python3-dnf bash && dnf clean all; \
13+
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
14+
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
15+
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi

molecule/adoptopenjdk/converge.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
3+
- name: Converge
4+
hosts: openjdk
5+
roles:
6+
- java_role
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
java_open_jdk_apt_extra_packages:
3+
- python-apt
4+
- apt-transport-https
5+
java_open_jdk_version_major: 8
6+
# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations
7+
8+
# For Debian family
9+
java_required_repositories_openjdk:
10+
- deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main
11+
java_required_libs_openjdk: []
12+
java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-amd64
13+
14+
# For RHEL family
15+
# java_required_repositories_openjdk:
16+
# - { name: "AdoptOpenJDK", baseurl: "http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/$releasever/$basearch" }
17+
# java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot
18+
19+
java_required_key_repositories_openjdk:
20+
- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
21+
java_open_jdk_package: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot
22+
java_open_jdk_home: /usr/lib/jvm/{{ java_open_jdk_home_dir }}

molecule/adoptopenjdk/molecule.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
dependency:
3+
name: galaxy
4+
driver:
5+
name: docker
6+
7+
lint: |
8+
yamllint .
9+
ansible-lint .
10+
11+
platforms:
12+
- name: openjdk-adopt-test
13+
groups:
14+
- openjdk
15+
image: ${DOCKER_IMAGE_BASE:-debian:buster-slim}
16+
17+
provisioner:
18+
name: ansible
19+
inventory:
20+
links:
21+
group_vars: ./group_vars
22+
scenario:
23+
name: adoptopenjdk
24+
verifier:
25+
name: ansible
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
file:
4+
{{ java_open_jdk_home }}/lib:
5+
exists: true
6+
filetype: directory
7+
package:
8+
{% if java_open_jdk_version is defined and java_open_jdk_version is not sameas None and java_open_jdk_version != "" %}
9+
{{ java_open_jdk_package }}:
10+
installed: true
11+
versions:
12+
- {{ java_open_jdk_version }}
13+
{% else %}
14+
{{ java_open_jdk_package }}:
15+
installed: true
16+
{% endif %}

molecule/adoptopenjdk/verify.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
# This is an example playbook to execute goss tests.
3+
# Tests need distributed to the appropriate ansible host/groups
4+
# prior to execution by `goss validate`.
5+
#
6+
# The goss ansible module is installed with molecule. The ANSIBLE_LIBRARY
7+
# path is updated appropriately on `molecule verify`.
8+
9+
# Details about ansible module:
10+
# - https://github.com/indusbox/goss-ansible
11+
12+
- name: Verify
13+
hosts: all
14+
vars:
15+
goss_version: v0.3.11
16+
goss_sha256sum: 7a751c102abac61fd8dff45f87f36c3732cb5158e1414ab78e6877864fc2f7a4
17+
goss_arch: amd64
18+
goss_dst: /usr/local/bin/goss
19+
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
20+
goss_test_directory: /tmp
21+
goss_format: documentation
22+
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}"
23+
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"
24+
25+
tasks:
26+
- name: Download and install goss
27+
get_url:
28+
url: "{{ goss_url }}"
29+
dest: "{{ goss_dst }}"
30+
mode: 0755
31+
32+
- name: Copy tests to remote
33+
template:
34+
src: "{{ item }}"
35+
dest: "{{ goss_test_directory }}/{{ item | basename }}"
36+
with_fileglob:
37+
- "{{ playbook_dir }}/tests/test_*.yml"
38+
39+
- name: Register test files
40+
shell: "ls {{ goss_test_directory }}/test_*.yml"
41+
register: test_files
42+
43+
- name: Execute Goss tests
44+
command: "goss -g {{ item }} validate --format {{ goss_format }}"
45+
register: test_results
46+
with_items: "{{ test_files.stdout_lines }}"
47+
ignore_errors: true
48+
49+
- name: Display details about the goss results
50+
debug:
51+
msg: "{{ item.stdout_lines }}"
52+
with_items: "{{ test_results.results }}"
53+
54+
- name: Fail when tests fail
55+
fail:
56+
msg: "Goss failed to validate"
57+
when: item.rc != 0
58+
with_items: "{{ test_results.results }}"

molecule/corretto/Dockerfile.j2

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Molecule managed
2+
3+
{% if item.registry is defined %}
4+
FROM {{ item.registry.url }}/{{ item.image }}
5+
{% else %}
6+
FROM {{ item.image }}
7+
{% endif %}
8+
9+
RUN mkdir -p /usr/share/man/man1
10+
11+
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
12+
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python36 sudo python3-dnf bash && dnf clean all; \
13+
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
14+
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \
15+
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; fi

0 commit comments

Comments
 (0)