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