Skip to content

Commit

Permalink
Merge pull request #141 from idealista/develop
Browse files Browse the repository at this point in the history
Release 6.1.0
  • Loading branch information
vicsufer authored Sep 11, 2020
2 parents 549b169 + 2dea99f commit a49b051
Show file tree
Hide file tree
Showing 26 changed files with 157 additions and 56 deletions.
5 changes: 5 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
rules:
line-length: disable
exclude_paths:
- molecule/adoptopenjdk/tests
- molecule/corretto/tests
- molecule/default/tests

9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:
- secure: WuOSbycFJIECLpysMXvNOYckr004ufS10PoboOldE/7yJPtAwKE6KIVdHLNQ942j70+GU3y18/UErMyY0mjyZl9zzQRhvQKpyGuKniTCCIDgxydhMP/Ik3+DHslG3szfTmbjo1bJ2+uRFLOxTgY7pnxebJbW3i7AKSEpK9XQY0GzGhJzazqJJeylMsC/gTOQFza2clPe1so5b5CoedbK3/Ued82dlDgb/bqY5rlyYvx/qdbNRl5kVdH/YWLWR2xdl1WffL91Lbh/YtqgLAeZuJJsza6dHvjKlFAiVFMuWxX3GBYgcdmxnL+vzy9Ldp4FiFi1B+amSjCQsQ8HB3vJqCAhWBs1pvHE4xlM7Pxaoz+Zz5Iwnb0LwQvwu+ehitHBpHTmKG1s3wVVPAx0xArZuN5fsn9vW/HAyoVM3AkI6jOjlgTEYVMCJSr/+fLvGwjzuhYoHLQfI8R6S4A71xz6n6xU8LoLrbg9V6ypfyNSuEsBD/W+H9cE8cmqiJftMnExj0dQMXDGp0b6gpFLgPo4L5d5szPgcLGTpmwcyRTTGDymjS5veDxIhwVtUQif78PlwIJ/Ky+2M/qREnSkt8OcAtv8msqvfTGfiQIHsWu/kHsRFctVfidBmLTU6KRSxwXhe+br67HsBuYKp6aGtubYE0QGwM+gn5UnIzAy6+5OmTo=
- secure: jnMLyXO4BXHo5OWGDsgtTnKBoiV+EG5Qd7w+a0RfkJu/SeqW/pm7NOnGqWDxKUdf9UREtKvCO26ZdciC2DwmjOVsSH5KVnvS7fr2QvPalHNJhi8IHkSOi5BP4DUIFlJowBKCGMTftNUJCiZq5tq8GnnwR9eaQg0WqhqcSmRA/dIyN4MycayGhqt/+9gaTiOaiKrun7esAUnizszXOj8P0QBLxjAiXIfDmwUfe6z7vHRaf96L/T5tpDcRd00jxm+QYlsN8zIxYK5CguPwl/ip2jRAdkq2KA8MT5tL7qaqkqAKzzaetHKbSigzuzER8Wua5Qc3JZajI9YMayvJSrow3fXDmGg+T4XYJgRe87HtIO3IwHclvtfsYgrD1kYhLm+jo2czm8uQIKdQZqVkZ8lJxhV24yZ76Xa0ysEzmHXbV2HHmNYud2Kuh8CYPA+M9yB8icwoc58IqOOfj7/N8Siv5oypSuWmEHZdkhPVkPBY4Qq7aDMGy4/Uzy+yu4V++6oJrXZMAKKlDnuMayZylEaN+CLjZnDFDjusYDkTZRoNo1Bt5EiEb0AZQ19caVW0kRD0rseRa/Af/DYJswTo6AyXs4Tk2B4Mm/0XYGhku4QKZw6In3/FxTHxF16y9GZMv1T/0xRXpkmFYYHJE/4vhhsN0shTRNe+9b+tc/zvd5a3/3g=
jobs:
# openjdk
- DOCKER_IMAGE_BASE=debian:stretch-slim DOCKER_TAG_TO_PUBLISH=8-stretch-openjdk-headless
- DOCKER_IMAGE_BASE=debian:stretch-slim JDK_MAJOR=8 JDK_VERSION=8u265-b01-0+deb9u1 DOCKER_TAG_TO_PUBLISH=8u265-stretch-openjdk-headless
- DOCKER_IMAGE_BASE=debian:stretch-slim JDK_MAJOR=11 JDK_VERSION=11.0.6+10-1~bpo9+1 DOCKER_TAG_TO_PUBLISH=11.0.6-stretch-openjdk-headless
Expand All @@ -33,8 +34,14 @@ env:
- DOCKER_IMAGE_BASE=amd64/ubuntu:focal JDK_MAJOR=8 JDK_VERSION=8u265-b01-0ubuntu2~20.04 DOCKER_TAG_TO_PUBLISH=8u265-focal-openjdk-headless
- DOCKER_IMAGE_BASE=centos:7 JDK_MAJOR=11 JDK_VERSION=11.0.8.10 DOCKER_TAG_TO_PUBLISH=11.0.8.10-centos7-openjdk-headless
- DOCKER_IMAGE_BASE=centos:8 JDK_MAJOR=11 JDK_VERSION=11.0.8.10 DOCKER_TAG_TO_PUBLISH=11.0.8.10-centos8-openjdk-headless
# adoptopenjdk
- DOCKER_IMAGE_BASE=debian:buster-slim JDK_VENDOR=adoptopenjdk JDK_MAJOR=8 JDK_VERSION=8u265-b01-3 DOCKER_TAG_TO_PUBLISH=8u265-buster-adoptopenjdk-headless
- DOCKER_IMAGE_BASE=centos:8 JDK_VENDOR=adoptopenjdk JDK_MAJOR=8 JDK_VERSION=8u265_b01 DOCKER_TAG_TO_PUBLISH=8u265-centos8-adoptopenjdk-headless
# corretto
- DOCKER_IMAGE_BASE=debian:buster-slim JDK_VENDOR=corretto JDK_MAJOR=1.8.0 JDK_VERSION=1:8.265.01-1 DOCKER_TAG_TO_PUBLISH=8u265-buster-corretto-headless
- DOCKER_IMAGE_BASE=centos:8 JDK_VENDOR=corretto JDK_MAJOR=1.8.0 JDK_VERSION=1.8.0_265.b01 DOCKER_TAG_TO_PUBLISH=8u265-centos8-corretto-headless
script:
- pipenv run molecule test
- pipenv run molecule test --scenario-name=${JDK_VENDOR:-default}
notifications:
webhooks:
- https://galaxy.ansible.com/api/v1/notifications/
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a ch

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


## [6.1.0](https://github.com/idealista/java_role/tree/6.1.0) (2020-09-11)
[Full Changelog](https://github.com/idealista/java_role/compare/6.0.0...6.1.0)
### Added
- *[#138](https://github.com/idealista/java_role/issues/138) Support for adoptopenjdk and corretto for buster/centos8* @vicsufer
- *[#138](https://github.com/idealista/java_role/issues/138) Create images at dockerhub for adoptopenjdk and corretto* @vicsufer
### Changed
- *[#138](https://github.com/idealista/java_role/issues/138) Adapt adoptopenjdk and corretto test scenarios for future supported platforms.
### Fixed
- *[#63](https://github.com/idealista/java_role/issues/63) Solve Ansible Galaxy Warnings* @vicsufer

## [6.0.0](https://github.com/idealista/java_role/tree/6.0.0) (2020-08-13)
[Full Changelog](https://github.com/idealista/java_role/compare/5.2.0...6.0.0)
### Changed
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ We publish every role version as a Docker image in Docker Hub: https://hub.docke
You can pull our images by executing:
```bash
docker pull idealista/jdk:${JDK_VERSION}-${DOCKER_IMAGE_BASE}-(openjdk-headless)
docker pull idealista/jdk:${JDK_VERSION}-${DOCKER_IMAGE_BASE}-${JDK_VENDOR}headless)
```

`JDK_VERSION:` Preferred JDK version.
`DOCKER_IMAGE`: Currently supporting: `stretch`/`buster` to select between Debian versions, `xenial`/`bionic`/`focal` to select between Ubuntu versions, and `7`/`8` to select a CentOS version.
`JDK_VENDOR`: Currently supporting `openjdk`/ `adoptopenjdk`/`corretto`

For instance:

Expand Down Expand Up @@ -122,13 +123,14 @@ CentOS 7 | `11` (default)
CentOS 8 | `1.8.0`
CentOS 8 | `11` (default)

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).
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 vars/ in AdoptOpenJDK and Corretto directories).
## Testing

```sh
$ pipenv sync
$ DOCKER_IMAGE_BASE=(debian:stretch-slim|debian:buster-slim|amd64/ubuntu:xenial|amd64/ubuntu:bionic|amd64/ubuntu:focal|centos:7|centos:8) JDK_MAJOR=(`java_open_jdk_version_major` see [.travis.yml](.travis.yml) file to check supported versions) JDK_VERSION=(`java_open_jdk_version` see [.travis.yml](.travis.yml) file to check supported versions) pipenv run molecule test
$ DOCKER_IMAGE_BASE=(debian:stretch-slim|debian:buster-slim|amd64/ubuntu:xenial|amd64/ubuntu:bionic|amd64/ubuntu:focal|centos:7|centos:8) JDK_VENDOR=(`java_jdk_version` openjdk|adoptopenjdk|corretto) JDK_MAJOR=(`java_open_jdk_version_major` see [.travis.yml](.travis.yml) file to check supported versions) JDK_VERSION=(`java_open_jdk_version` see [.travis.yml](.travis.yml) file to check supported versions) pipenv run molecule test
```
**Note:** JDK_VENDOR is an optional parameter, if not defined this role will use openjdk.
**Note:** JDK_VERSION is an optional parameter, if not defined this role will install the latest available package for the selected Java major release.
**Note:** debian9 (Debian Stretch) will be used as default linux distro if none is provided.

Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
java_jdk_vendor: openjdk

java_open_jdk_apt_extra_packages: []
java_open_jdk_home: /usr/lib/jvm/{{ java_open_jdk_home_dir }}
22 changes: 0 additions & 22 deletions molecule/adoptopenjdk/group_vars/openjdk/main.yml

This file was deleted.

9 changes: 7 additions & 2 deletions molecule/adoptopenjdk/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ platforms:
provisioner:
name: ansible
inventory:
links:
group_vars: ./group_vars
group_vars:
openjdk:
java_open_jdk_home: /usr/lib/jvm/{{ java_open_jdk_home_dir }}
java_jdk_vendor: adoptopenjdk
java_open_jdk_version: ${JDK_VERSION}
java_open_jdk_version_major: ${JDK_MAJOR}

scenario:
name: adoptopenjdk
verifier:
Expand Down
25 changes: 25 additions & 0 deletions molecule/adoptopenjdk/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"

tasks:
- name: Set JDK Vendor
set_fact:
java_jdk_vendor: adoptopenjdk

- name: Gather OS specific variables
include_vars: "../../vars/{{ java_jdk_vendor }}/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
# Using pattern described in Ansible Best Practices and Conventions (Appendix B), Ansible for Devops (p. 406)
# Allowing to 'override' variables that are defined using include_vars

- name: Setting OS specific variables
set_fact:
java_open_jdk_version: "{{ java_open_jdk_version if java_open_jdk_version is defined and java_open_jdk_version is not sameas None }}"
java_open_jdk_version_major: "{{ java_open_jdk_version_major if java_open_jdk_version_major is defined and java_open_jdk_version_major is not sameas None and java_open_jdk_version_major else __java_open_jdk_version_major }}" # noqa 204

- name: Setting OS specific variables (II)
set_fact:
java_open_jdk_home_dir: "{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir }}" # noqa 204
java_open_jdk_package: "{{ java_open_jdk_package if java_open_jdk_package is defined and java_open_jdk_package is not sameas None and java_open_jdk_package else __java_open_jdk_package }}" # noqa 204

- name: Setting specific variables
set_fact:
java_home: "{{ java_open_jdk_home }}"

- name: Download and install goss
get_url:
url: "{{ goss_url }}"
Expand All @@ -39,12 +62,14 @@
- name: Register test files
shell: "ls {{ goss_test_directory }}/test_*.yml"
register: test_files
changed_when: false

- name: Execute Goss tests
command: "goss -g {{ item }} validate --format {{ goss_format }}"
register: test_results
with_items: "{{ test_files.stdout_lines }}"
ignore_errors: true
changed_when: false

- name: Display details about the goss results
debug:
Expand Down
23 changes: 0 additions & 23 deletions molecule/corretto/group_vars/openjdk/main.yml

This file was deleted.

9 changes: 7 additions & 2 deletions molecule/corretto/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ platforms:
provisioner:
name: ansible
inventory:
links:
group_vars: ./group_vars
group_vars:
openjdk:
java_open_jdk_home: /usr/lib/jvm/{{ java_open_jdk_home_dir }}
java_jdk_vendor: corretto
java_open_jdk_version: ${JDK_VERSION}
java_open_jdk_version_major: ${JDK_MAJOR}

scenario:
name: corretto
verifier:
Expand Down
20 changes: 20 additions & 0 deletions molecule/corretto/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}"

tasks:
- name: Java | Gather OS specific variables
include_vars: "../../vars/{{ java_jdk_vendor }}/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
# Using pattern described in Ansible Best Practices and Conventions (Appendix B), Ansible for Devops (p. 406)
# Allowing to 'override' variables that are defined using include_vars

- name: Java | Setting OS specific variables
set_fact:
java_open_jdk_version: "{{ java_open_jdk_version if java_open_jdk_version is defined and java_open_jdk_version is not sameas None }}"
java_open_jdk_version_major: "{{ java_open_jdk_version_major if java_open_jdk_version_major is defined and java_open_jdk_version_major is not sameas None and java_open_jdk_version_major else __java_open_jdk_version_major }}" # noqa 204

- name: Java | Setting OS specific variables (II)
set_fact:
java_open_jdk_home_dir: "{{ java_open_jdk_home_dir if java_open_jdk_home_dir is defined and java_open_jdk_home_dir is not sameas None and java_open_jdk_home_dir else __java_open_jdk_home_dir }}" # noqa 204
java_open_jdk_package: "{{ java_open_jdk_package if java_open_jdk_package is defined and java_open_jdk_package is not sameas None and java_open_jdk_package else __java_open_jdk_package }}" # noqa 204

- name: Java | Setting specific variables
set_fact:
java_home: "{{ java_open_jdk_home }}"
- name: Download and install goss
get_url:
url: "{{ goss_url }}"
Expand All @@ -39,12 +57,14 @@
- name: Register test files
shell: "ls {{ goss_test_directory }}/test_*.yml"
register: test_files
changed_when: false

- name: Execute Goss tests
command: "goss -g {{ item }} validate --format {{ goss_format }}"
register: test_results
with_items: "{{ test_files.stdout_lines }}"
ignore_errors: true
changed_when: false

- name: Display details about the goss results
debug:
Expand Down
1 change: 1 addition & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ provisioner:
inventory:
group_vars:
openjdk:
java_jdk_vendor: openjdk
java_open_jdk_version: ${JDK_VERSION}
java_open_jdk_version_major: ${JDK_MAJOR}
scenario:
Expand Down
4 changes: 3 additions & 1 deletion molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

tasks:
- name: Java | Gather OS specific variables
include_vars: "../../vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
include_vars: "../../vars/{{ java_jdk_vendor }}/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
# Using pattern described in Ansible Best Practices and Conventions (Appendix B), Ansible for Devops (p. 406)
# Allowing to 'override' variables that are defined using include_vars

Expand Down Expand Up @@ -61,12 +61,14 @@
- name: Register test files
shell: "ls {{ goss_test_directory }}/test_*.yml"
register: test_files
changed_when: false

- name: Execute Goss tests
command: "goss -g {{ item }} validate --format {{ goss_format }}"
register: test_results
with_items: "{{ test_files.stdout_lines }}"
ignore_errors: true
changed_when: false

- name: Display details about the goss results
debug:
Expand Down
3 changes: 2 additions & 1 deletion packer/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"docker_username": "{{env `DOCKER_USERNAME`}}",
"docker_password": "{{env `DOCKER_PASSWORD`}}",
"docker_tag_to_publish": "{{env `DOCKER_TAG_TO_PUBLISH`}}",
"java_jdk_vendor": "{{env `JDK_VENDOR`}}",
"jdk_version": "{{env `JDK_VERSION`}}",
"jdk_major": "{{env `JDK_MAJOR`}}"
},
Expand Down Expand Up @@ -41,7 +42,7 @@
"playbook_file": "{{ template_dir }}/playbook.yml",
"extra_arguments": [
"--extra-vars",
"ansible_host={{user `ansible_host`}} ansible_connection={{user `ansible_connection`}} java_open_jdk_version={{user `jdk_version`}} java_open_jdk_version_major={{user `jdk_major`}}"
"ansible_host={{user `ansible_host`}} ansible_connection={{user `ansible_connection`}} java_jdk_vendor={{user `java_jdk_vendor`}} java_open_jdk_version={{user `jdk_version`}} java_open_jdk_version_major={{user `jdk_major`}}"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion tasks/install_openjdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- name: Java | Gather OS specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ java_jdk_vendor }}/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"

# Using pattern described in Ansible Best Practices and Conventions (Appendix B), Ansible for Devops (p. 406)
# Allowing to 'override' variables that are defined using include_vars
Expand Down
15 changes: 15 additions & 0 deletions vars/adoptopenjdk/CentOS-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
java_open_jdk_apt_extra_packages:
- python-apt
- apt-transport-https
__java_open_jdk_version_major: 8
# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations

__java_required_repositories_openjdk:
- { name: "AdoptOpenJDK", baseurl: "http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/$releasever/$basearch" }
__java_required_libs_openjdk: []
__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot

__java_required_key_repositories_openjdk:
- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
__java_open_jdk_package: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot
16 changes: 16 additions & 0 deletions vars/adoptopenjdk/Debian-10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
java_open_jdk_apt_extra_packages:
- python-apt
- apt-transport-https
__java_open_jdk_version_major: 8
# Supported major releases: 8 and from 11 to 14; hotspot and openj9 implementations

# For Debian family
__java_required_libs_openjdk: []
__java_required_repositories_openjdk:
- deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ {{ ansible_distribution_release }} main
__java_open_jdk_home_dir: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot-amd64

__java_required_key_repositories_openjdk:
- https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
__java_open_jdk_package: adoptopenjdk-{{ java_open_jdk_version_major }}-hotspot
13 changes: 13 additions & 0 deletions vars/corretto/CentOS-8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
__java_open_jdk_version_major: 1.8.0
# Supported versions: 8 (1.8.0 in RHEL), 11

__java_required_repositories_openjdk:
- { name: "AmazonCorretto", baseurl: "https://yum.corretto.aws/$basearch" }
__java_required_key_repositories_openjdk:
- https://yum.corretto.aws/corretto.key
__java_required_libs_openjdk: []
__java_open_jdk_package: java-{{ java_open_jdk_version_major }}-amazon-corretto-devel

__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-amazon-corretto
__java_open_jdk_home: /usr/lib/jvm/{{ java_open_jdk_home_dir }}
16 changes: 16 additions & 0 deletions vars/corretto/Debian-10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
java_open_jdk_apt_extra_packages:
- python-apt
- apt-transport-https

__java_open_jdk_version_major: 1.8.0
# Supported versions: 8 (1.8.0L), 11

__java_required_repositories_openjdk:
- deb https://apt.corretto.aws stable main
__java_required_key_repositories_openjdk:
- https://apt.corretto.aws/corretto.key
__java_required_libs_openjdk: []
__java_open_jdk_package: java-{{ java_open_jdk_version_major }}-amazon-corretto-jdk

__java_open_jdk_home_dir: java-{{ java_open_jdk_version_major }}-amazon-corretto
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit a49b051

Please sign in to comment.