Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from UCL-MIRSG/use-mirsg-configs
Browse files Browse the repository at this point in the history
Tidy up repo before first release
  • Loading branch information
p-j-smith authored Oct 20, 2023
2 parents 927b2bc + 1fb4bca commit 4fe3371
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 123 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/add-issue-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Add issue to project

on:
issues:
types:
- opened

jobs:
add-issue-to-project:
runs-on: ubuntu-latest
steps:
- uses: UCL-MIRSG/.github/actions/[email protected]
with:
app-id: ${{ secrets.APP_ID }}
app-pem: ${{ secrets.APP_PEM }}
40 changes: 8 additions & 32 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,16 @@
---
name: Pre-commit checks
name: Linting

on:
pull_request:
push:
branches:
- main
- main
- "renovate/**"
pull_request:

jobs:
build:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV

- name: Cache pre-commit install
uses: actions/cache@v3
- uses: UCL-MIRSG/.github/actions/[email protected]
with:
path: |
${{ env.pythonLocation }}
~/.cache/pre-commit
key: |
pre-commit-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install dependencies
run: pip install pre-commit

- name: Install pre-commit hooks
run: pre-commit install

- name: Run pre-commit
run: pre-commit run --all-files --color always
pre-commit-config: ./.pre-commit-config.yaml
25 changes: 4 additions & 21 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "mirsg.tomcat"
name: Molecule Test
on:
pull_request:
push:
Expand All @@ -14,28 +14,11 @@ jobs:
molecule_scenario:
- centos7
- rocky8

env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v2
- name: Run `molecule test`
uses: UCL-MIRSG/.github/actions/[email protected]
with:
python-version: 3.9

- name: Install test dependencies
run: |
sudo apt-get update && sudo apt-get -y install rsync
python3 -m pip install --upgrade pip
python3 -m pip install ansible ansible-lint molecule molecule-plugins[docker] docker requests==2.29.0
- name: Run role tests
run: >-
molecule --version &&
ansible --version &&
molecule --debug test -s ${{ matrix.molecule_scenario }}
scenario: ${{ matrix.molecule_scenario }}
34 changes: 3 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- repo: https://github.com/UCL-MIRSG/.github
rev: v0.21.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.1
hooks:
- id: forbid-tabs
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
exclude: ".yml$"
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.0
hooks:
- id: check-github-workflows
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v6.16.2
hooks:
- id: ansible-lint
args: ["-p", "."]
- id: mirsg-hooks
4 changes: 4 additions & 0 deletions .renovaterc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>UCL-MIRSG/.github//renovate/default-config.json"]
}
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
Ansible Role: mirsg.java
=========
# Ansible Role: mirsg.java

A role for install and configuring Java.

Role Variables
--------------
## Role Variables

`java` - A dictionary containing:
`java_profile_d`: Defaults to "/etc/profile.d".

`profile_d`: Defaults to "/etc/profile.d".
`java_home`: Defaults to "/usr/lib/jvm/jre"

`home`: Defaults to "/usr/lib/jvm/jre"
`java_package`: Defaults to "java-1.8.0-openjdk-devel"

`package`: Defaults to "java-1.8.0-openjdk-devel"

`keystore_path`: Defaults to "/usr/lib/jvm/jre/lib/security/cacerts/"

Example Playbook
----------------
## Example Playbook

Including an example of how to use your role (for instance, with variables
passed in as parameters) is always nice for users too:

```yaml
- hosts: servers
roles:
- { role: mirsg.java }
- { role: mirsg.java }
```
License
-------
## License
BSD
Author Information
------------------
## Author Information
This role was created by the [Medical Imaging Research Software
Group](https://www.ucl.ac.uk/advanced-research-computing/expertise/research-software-development/medical-imaging-research-software-group)
Expand Down
10 changes: 4 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
# defaults file for ../ansible-role-install-java
java:
profile_d: "/etc/profile.d"
home: "/usr/lib/jvm/jre"
package: "java-1.8.0-openjdk-devel"
keystore_path: "/usr/lib/jvm/jre/lib/security/cacerts/"
java_profile_d: "/etc/profile.d"
java_home: "/usr/lib/jvm/jre"
java_package: "java-1.8.0-openjdk-devel"
java_keystore_path: "/usr/lib/jvm/jre/lib/security/cacerts/"
2 changes: 0 additions & 2 deletions handlers/main.yml

This file was deleted.

3 changes: 2 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ galaxy_info:
# - 7
# - 99.99

galaxy_tags: []
galaxy_tags:
[]
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
Expand Down
4 changes: 2 additions & 2 deletions molecule/resources/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

pre_tasks:
- name: Wait for systemd to complete initialization.
ansible.builtin.command: systemctl is-system-running
ansible.builtin.command: systemctl is-system-running # noqa: command-instead-of-module
register: systemctl_status
until: >
'running' in systemctl_status.stdout or
Expand All @@ -15,7 +15,7 @@
delay: 5
when: ansible_service_mgr == 'systemd'
changed_when: false
failed_when: systemctl_status.rc > 1
failed_when: systemctl_status.rc > 0

roles:
- role: mirsg.java
4 changes: 0 additions & 4 deletions renovate.json

This file was deleted.

10 changes: 5 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: ensure Java version {{ java.package }} is installed
- name: Ensure correct Java version is installed - {{ java_package }}
ansible.builtin.package:
name: "{{ java.package }}"
name: "{{ java_package }}"
state: installed

- name: Set JAVA_HOME through shell script
ansible.builtin.template:
src: "java_home.sh.j2"
dest: "{{ java.profile_d }}/java_home.sh"
mode: 0644
when: java.home is defined and java.home != ''
dest: "{{ java_profile_d }}/java_home.sh"
mode: "0644"
when: java_home is defined and java_home != ''
2 changes: 1 addition & 1 deletion templates/java_home.sh.j2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export JAVA_HOME="{{ java.home }}"
export JAVA_HOME="{{ java_home }}"

0 comments on commit 4fe3371

Please sign in to comment.