From bfb3507c5bc80fdc6c443357a233b73dfd8a78e0 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 20 Feb 2020 07:33:37 -0800 Subject: [PATCH] Add ensure-java role Change-Id: Ibaf45bd09a47d55ce21af34763563c20f9396cd2 --- doc/source/java-roles.rst | 4 ++++ doc/source/roles.rst | 1 + roles/ensure-java/README.rst | 10 ++++++++++ roles/ensure-java/defaults/main.yaml | 1 + roles/ensure-java/tasks/main.yaml | 5 +++++ test-playbooks/ensure-java.yaml | 6 ++++++ zuul-tests.d/java-jobs.yaml | 14 ++++++++++++++ 7 files changed, 41 insertions(+) create mode 100644 doc/source/java-roles.rst create mode 100644 roles/ensure-java/README.rst create mode 100644 roles/ensure-java/defaults/main.yaml create mode 100644 roles/ensure-java/tasks/main.yaml create mode 100644 test-playbooks/ensure-java.yaml create mode 100644 zuul-tests.d/java-jobs.yaml diff --git a/doc/source/java-roles.rst b/doc/source/java-roles.rst new file mode 100644 index 000000000..8ee56cbbd --- /dev/null +++ b/doc/source/java-roles.rst @@ -0,0 +1,4 @@ +Java Roles +========== + +.. zuul:autorole:: ensure-java diff --git a/doc/source/roles.rst b/doc/source/roles.rst index 5efe2388f..e6598fc57 100644 --- a/doc/source/roles.rst +++ b/doc/source/roles.rst @@ -12,6 +12,7 @@ Roles deprecated-roles galaxy-roles go-roles + java-roles js-roles launchpad-roles puppet-roles diff --git a/roles/ensure-java/README.rst b/roles/ensure-java/README.rst new file mode 100644 index 000000000..08eeb4328 --- /dev/null +++ b/roles/ensure-java/README.rst @@ -0,0 +1,10 @@ +Ensure that Java is installed + +Installs the specified version of the JDK. + +**Role Variables** + +.. zuul:rolevar:: java_version + :default: 8 + + Version of Java to install. diff --git a/roles/ensure-java/defaults/main.yaml b/roles/ensure-java/defaults/main.yaml new file mode 100644 index 000000000..9ed782db2 --- /dev/null +++ b/roles/ensure-java/defaults/main.yaml @@ -0,0 +1 @@ +java_version: 8 diff --git a/roles/ensure-java/tasks/main.yaml b/roles/ensure-java/tasks/main.yaml new file mode 100644 index 000000000..a0d436629 --- /dev/null +++ b/roles/ensure-java/tasks/main.yaml @@ -0,0 +1,5 @@ +- name: Install JDK + become: true + package: + name: openjdk-{{ java_version }}-jdk + state: present diff --git a/test-playbooks/ensure-java.yaml b/test-playbooks/ensure-java.yaml new file mode 100644 index 000000000..fd73370fb --- /dev/null +++ b/test-playbooks/ensure-java.yaml @@ -0,0 +1,6 @@ +- hosts: all + roles: + - ensure-java + tasks: + - name: Print java version + command: java -fullversion diff --git a/zuul-tests.d/java-jobs.yaml b/zuul-tests.d/java-jobs.yaml new file mode 100644 index 000000000..411bb1b0c --- /dev/null +++ b/zuul-tests.d/java-jobs.yaml @@ -0,0 +1,14 @@ +- job: + name: zuul-jobs-test-ensure-java + description: Test the ensure-java role + files: + - roles/ensure-java/.* + - test-playbooks/ensure-java.yaml + run: test-playbooks/ensure-java.yaml + +- project: + check: + jobs: &id001 + - zuul-jobs-test-ensure-java + gate: + jobs: *id001