Skip to content

Commit

Permalink
OPSEXP-1754 Add some generic pre-commit hooks (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn authored Oct 7, 2022
1 parent 8ce9e02 commit 3bdc969
Show file tree
Hide file tree
Showing 79 changed files with 122 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
text eol=lf
text eol=lf
4 changes: 2 additions & 2 deletions .github/actions/pipenv/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ description: 'Install python packages with pipenv'

runs:
using: "composite"
steps:
steps:
- name: Install pipenv
shell: bash
run: pip install --user pipenv
- name: Install packages from Pipfile
shell: bash
run: pipenv install --deploy --dev
run: pipenv install --deploy --dev
1 change: 0 additions & 1 deletion .github/workflows/community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,3 @@ jobs:
max_attempts: 3
retry_wait_seconds: 10
command: cd roles/${{ matrix.role.name }} && pipenv run molecule test

2 changes: 1 addition & 1 deletion .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
with:
python-version-file: '.python-version'

- uses: pre-commit/action@v3.0.0
- uses: pre-commit/action@v3.0.0
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# project specifics
# project specifics
configuration_files/ssl_certificates/
configuration_files/keystores/
dtas
Expand Down
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-json
- id: check-xml
- id: check-merge-conflict
- id: fix-byte-order-marker
- id: mixed-line-ending
args: ["--fix=lf"]
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.18.0
hooks:
- id: djlint-jinja

- repo: https://github.com/jackdewinter/pymarkdown
rev: v0.9.6
hooks:
Expand Down
2 changes: 1 addition & 1 deletion configuration_files/alfresco-global.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Add your properties here
# Add your properties here
2 changes: 1 addition & 1 deletion docs/SECRETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ that must be handled as secrets:

```yml
acs_environment:
JAVA_TOOL_OPTIONS:
JAVA_TOOL_OPTIONS:
- -Dmetadata-keystore.password=<your-keystore-password>
- -Dmetadata-keystore.metadata.password=<your-keystore-password>
```
Expand Down
8 changes: 4 additions & 4 deletions docs/resources/acs-ha.puml
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,28 @@ storage "NFS" as nfs

note top of repolb
This is a single point of failure
so customers may wish to replace
so customers may wish to replace
this with Nginx Plus and use its
HA features.
end note

note top of searchlb
This is a single point of failure
so customers may wish to replace
so customers may wish to replace
this with Nginx Plus and use its
HA features.
end note

note top of transformlb
This is a single point of failure
so customers may wish to replace
so customers may wish to replace
this with Nginx Plus and use its
HA features.
end note

note top of synclb
This is a single point of failure
so customers may wish to replace
so customers may wish to replace
this with Nginx Plus and use its
HA features.
end note
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/ansible-overview.puml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ User -> playbook
playbook --> host1
playbook --> hostN

@enduml
@enduml
2 changes: 1 addition & 1 deletion docs/resources/deployment-type-local.puml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ playbook -down-> role1 : local
playbook -down-> role2 : local


@enduml
@enduml
2 changes: 1 addition & 1 deletion docs/resources/deployment-type-ssh.puml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ playbook -down-> host1role1 : ssh
playbook -down-> host2role2 : ssh


@enduml
@enduml
2 changes: 1 addition & 1 deletion docs/resources/playbook-overview.puml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ rectangle "Playbook" as playbook #Ivory {
}
}

@enduml
@enduml
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ readme: README.md
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- Sergiu Vidrascu
- Sergiu Vidrascu
- Lucian Suciu
- Andrei Ciubotaru
- Alexandre Chapellon
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ provisioner:
- -e
- "@tests/test-ssl.yml"
inventory:
links:
links:
group_vars: ../../group_vars
playbooks:
converge: ../../playbooks/acs.yml
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/vars-centos7.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MOLECULE_IT_IMAGE_ID: ami-0b850cf02cc00fdc8
MOLECULE_IT_EXTRA_VARS: 6.2.N-extra-vars.yml
MOLECULE_IT_TEST_CONFIG: tests/test-config-acs6-stack.json
MOLECULE_IT_PLATFORM: centos7
MOLECULE_IT_PLATFORM: centos7
2 changes: 1 addition & 1 deletion molecule/default/vars-ubuntu20.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MOLECULE_IT_IMAGE_ID: ami-081ff4b9aa4e81a08
MOLECULE_IT_EXTRA_VARS: tests/test-extra-vars.yml
MOLECULE_IT_TEST_CONFIG: tests/test-config.json
MOLECULE_IT_PLATFORM: ubuntu20
MOLECULE_IT_PLATFORM: ubuntu20
2 changes: 1 addition & 1 deletion molecule/multimachine/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ provisioner:
- -e
- "@tests/test-ssl.yml"
inventory:
links:
links:
group_vars: ../../group_vars
host_vars: ./host_vars
hosts: ./hosts.yml
Expand Down
4 changes: 2 additions & 2 deletions molecule/multimachine/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
filters:
"tag:Name": molecule_{{ lookup('ansible.builtin.env', 'MOLECULE_IT_PLATFORM') }}_repo_{{ lookup('ansible.builtin.env', 'BRANCH_NAME') }}_{{ lookup('ansible.builtin.env', 'BUILD_NUMBER') }}
register: molecule_ec2

- name: Create Shared contentstore
community.aws.efs:
state: present
Expand All @@ -30,7 +30,7 @@
Owner: Ops Readiness Team
Department: Engineering
Production: false
loop:
loop:
- "{{ molecule_yml.platforms | selectattr('name', 'in', groups.repository) | first }}"
register: contentstore

Expand Down
6 changes: 3 additions & 3 deletions playbooks/check-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
tasks:
- name: Fail if Ansible version is too old
ansible.builtin.fail:
msg:
msg:
- "Installed Ansible version ({{ ansible_version.major }}.{{ ansible_version.minor }}) is too old. Upgrade to at least 2.12."
- "Please refer to https://github.com/Alfresco/alfresco-ansible-deployment/blob/master/docs/deployment-guide.md#setup-a-control-node for detailed instructions."
when: (ansible_version.major < 2) or
(ansible_version.major == 2 and ansible_version.minor < 12)

- name: Check Jinja2 version
ansible.builtin.shell: |
ansible.builtin.shell: |
JINJA_VERSION=$(pip3 freeze | grep Jinja2 | sed 's/Jinja2==//g')
echo $JINJA_VERSION
register: jinja2_version
changed_when: false

- name: Fail if Jinja2 version is too old
ansible.builtin.fail:
msg:
msg:
- "Installed Jinja2 version ({{ jinja2_version.stdout }}) is too old. Upgrade to at least version 3."
- "Please refer to https://github.com/Alfresco/alfresco-ansible-deployment/blob/master/docs/deployment-guide.md#setup-a-control-node for detailed instructions."
when: (jinja2_version.stdout.split('.')[0] | int < 3)
4 changes: 2 additions & 2 deletions playbooks/handlers/uninstall-handlers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: yes
ansible.builtin.systemd:
daemon_reload: yes
4 changes: 2 additions & 2 deletions playbooks/platform-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
artifacts_path: "{{ download_location | default('/tmp/ansible_artefacts') }}"
become: no
tasks:
- name: To display warning
- name: To display warning
debug:
msg: '[WARNING]: This will remove the downloaded artifacts from your system'

- name: Removing "{{ artifacts_path }}"
ansible.builtin.file:
path: "{{ artifacts_path }}"
state: "absent"
state: "absent"
2 changes: 1 addition & 1 deletion playbooks/prerequisite-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
vars:
checked_host: "{% if groups.syncservice | length == 0 %}127.0.0.1{% else %}{{ hostvars[groups.syncservice[0]].ansible_host | default('127.0.0.1') }}{% endif %}"
checked_port: "{{ ports_cfg.sync.http }}"
delegate_target: "{{ groups.syncservice | first }}"
delegate_target: "{{ groups.syncservice | first }}"
- name: check adw connection
include_tasks: "../roles/helper_modules/tasks/check_port.yml"
vars:
Expand Down
2 changes: 1 addition & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ roles:
- name: buluma.elastic_repo
version: v0.1.2
- name: buluma.elasticsearch
version: 1.0.2
version: 1.0.2
2 changes: 1 addition & 1 deletion roles/activemq/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ activemq_base: "{{ config_folder }}/activemq"
activemq_conf: "{{ config_folder }}/activemq/conf"
activemq_data: "{{ data_folder }}/activemq/data"
activemq_tmp: "{{ data_folder }}/activemq/tmp"
activemq_environment:
activemq_environment:
ACTIVEMQ_OPTS:
- -Xms128m
- -Xmx1g
Expand Down
2 changes: 1 addition & 1 deletion roles/activemq/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
enabled: true
state: started
daemon_reload: true

- name: restart-activemq
become: true
service:
Expand Down
2 changes: 1 addition & 1 deletion roles/activemq/templates/activemq.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ExecStart={{ binaries_folder }}/activemq.sh start
ExecStop={{ binaries_folder }}/activemq.sh stop

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion roles/activemq/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
# vars file for roles/activemq
activemq_home: "/opt/apache-activemq-{{ dependencies_version.activemq }}"
activemq_home: "/opt/apache-activemq-{{ dependencies_version.activemq }}"
4 changes: 2 additions & 2 deletions roles/adw/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- name: restart-nginx
become: true
service:
name: nginx
service:
name: nginx
state: restarted
daemon_reload: true
2 changes: 1 addition & 1 deletion roles/adw/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
tasks:
- name: "Include adw"
include_role:
name: "adw"
name: "adw"
2 changes: 1 addition & 1 deletion roles/adw/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ platforms:
provisioner:
name: ansible
inventory:
links:
links:
host_vars: host_vars
group_vars: ../../../../group_vars
verifier:
Expand Down
1 change: 0 additions & 1 deletion roles/adw/templates/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ http {
include /etc/nginx/conf.d/*.conf;

}

2 changes: 1 addition & 1 deletion roles/common/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
# handlers file for roles/common
# handlers file for roles/common
2 changes: 1 addition & 1 deletion roles/common/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ provisioner:
defaults:
pipelining: True
inventory:
links:
links:
group_vars: ../../../../group_vars
host_vars: host_vars
verifier:
Expand Down
1 change: 0 additions & 1 deletion roles/common/molecule/default/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ def test_logs_folder_exists(host, get_ansible_vars):
"""Check that logs folder exists"""
assert_that(host.file(get_ansible_vars["logs_folder"]).exists)
assert_that(host.file(get_ansible_vars["logs_folder"]).user, equal_to(get_ansible_vars["username"]))

2 changes: 1 addition & 1 deletion roles/common/vars/CentOS7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ utils:
- libselinux-python
- libsemanage-python
- gpg
- curl
- curl
2 changes: 1 addition & 1 deletion roles/common/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ utils:
- python3-selinux
- python3-semanage
- gpg
- curl
- curl
2 changes: 1 addition & 1 deletion roles/common/vars/RedHat7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ utils:
- libselinux-python
- libsemanage-python
- gpg
- curl
- curl
2 changes: 1 addition & 1 deletion roles/common/vars/RedHat8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ utils:
- python3-libselinux
- python3-libsemanage
- gpg
- curl
- curl
2 changes: 1 addition & 1 deletion roles/java/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ provisioner:
defaults:
pipelining: True
inventory:
links:
links:
group_vars: ../../../../group_vars
host_vars: host_vars
verifier:
Expand Down
2 changes: 1 addition & 1 deletion roles/java/templates/setenv.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

export JAVA_HOME="{{ java_home }}"
export PATH="${JAVA_HOME}/bin:${PATH}"
export PATH="${JAVA_HOME}/bin:${PATH}"
Loading

0 comments on commit 3bdc969

Please sign in to comment.