1
1
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_gitea.git synced 2024-08-16 11:39:50 +02:00

andding jinja2 linter and improve template

+ update yamllint
+ update ansible-lint
+ add j2lint
+ lint j2 template
This commit is contained in:
L3D 2023-10-21 02:16:13 +02:00
parent ec13147f2b
commit 38599ae607
No known key found for this signature in database
GPG key ID: AD65B920933B4B20
7 changed files with 72 additions and 24 deletions

View file

@ -11,14 +11,15 @@ jobs:
steps: steps:
- name: 'checkout git repo' - name: 'checkout git repo'
uses: actions/checkout@v4.1.0 uses: actions/checkout@v4.1.1
with: with:
lfs: true lfs: true
submodules: false submodules: true
fetch-depth: 0 fetch-depth: 0
- name: Run ansible-lint - name: Run ansible-lint
uses: ansible-actions/ansible-lint-action@v0.0.3 uses: ansible-actions/ansible-lint-action@v1.0.1
with: with:
target: "./" target: "./"
python_dependency: "jmespath" collections_yml: 'requirements.yml'
python_dependency: 'jmespath'

22
.github/workflows/j2lint-check.yml vendored Normal file
View file

@ -0,0 +1,22 @@
---
name: Jinja2 Linting check
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
name: Jinja2 Linting
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Run j2lint
uses: ansible-actions/j2lint-action@v0.0.1
with:
target: "./"

22
.github/workflows/yamllint-check.yml vendored Normal file
View file

@ -0,0 +1,22 @@
---
name: Yamllint check
# yamllint disable-line rule:truthy
on: [push, pull_request]
jobs:
build:
name: Yamllint
runs-on: ubuntu-latest
steps:
- name: 'checkout git repo'
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Run yamllint
uses: ansible-actions/yamllint-action@v0.0.1
with:
target: "./"

View file

@ -1,4 +1,4 @@
[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/l3d/gitea) [![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.gitea.svg)](https://galaxy.ansible.com/ui/standalone/roles/l3d/gitea/)
[![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.gitea_license.svg)](LICENSE) [![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.gitea_license.svg)](LICENSE)
[![Maintainance](https://ansible.l3d.space/svg/l3d.gitea_maintainance.svg)](https://ansible.l3d.space/#l3d.gitea) [![Maintainance](https://ansible.l3d.space/svg/l3d.gitea_maintainance.svg)](https://ansible.l3d.space/#l3d.gitea)
@ -15,7 +15,7 @@ This role is also Part of the Ansible-Collection [l3d.git](https://galaxy.ansibl
The following code has been tested with the latest Debian Stable, it should work on Ubuntu and RedHat as well. The following code has been tested with the latest Debian Stable, it should work on Ubuntu and RedHat as well.
```yaml ```yaml
# ansible-galaxy install l3d.gitea # ansible-galaxy role install l3d.gitea
- name: "Install gitea" - name: "Install gitea"
hosts: git.example.com hosts: git.example.com
@ -385,11 +385,10 @@ This role uses the ``ansible.builtin`` and ``community.general`` ansible Collect
### Galaxy Collections ### Galaxy Collections
+ community.general + community.general
### Example requirements Installation ### Example requirements Installation
``` ```
ansible-galaxy install community.general ansible-galaxy collection install --update --role-file requirements.yml
pip3 install jmespath pip3 install --update jmespath
``` ```
## Contribute ## Contribute

4
requirements.yml Normal file
View file

@ -0,0 +1,4 @@
---
collections:
- name: community.general
source: https://galaxy.ansible.com

View file

@ -1,8 +1,8 @@
; this file is the configuration of your local gitea instance ; this file is the configuration of your local Gitea instance
; {{ ansible_managed }} ; {{ ansible_managed }}
; ;
; This file overwrites the default values from gitea. ; This file overwrites the default values from Gitea.
; undefined variables will use the default value from gitea. ; undefined variables will use the default value from Gitea.
; Cheat Sheet: https://docs.gitea.com/next/administration/config-cheat-sheet/ ; Cheat Sheet: https://docs.gitea.com/next/administration/config-cheat-sheet/
; ;
; -> https://docs.gitea.com/next/administration/config-cheat-sheet#overall-default ; -> https://docs.gitea.com/next/administration/config-cheat-sheet#overall-default
@ -90,7 +90,7 @@ APP_DATA_PATH = {{ gitea_home }}/data
PROTOCOL = {{ gitea_protocol }} PROTOCOL = {{ gitea_protocol }}
DOMAIN = {{ gitea_http_domain }} DOMAIN = {{ gitea_http_domain }}
ROOT_URL = {{ gitea_root_url }} ROOT_URL = {{ gitea_root_url }}
HTTP_ADDR = {{ gitea_http_listen }} HTTP_ADDR = {{ gitea_http_listen }}
HTTP_PORT = {{ gitea_http_port }} HTTP_PORT = {{ gitea_http_port }}
START_SSH_SERVER = {{ gitea_start_ssh | ternary('true', 'false') }} START_SSH_SERVER = {{ gitea_start_ssh | ternary('true', 'false') }}
SSH_DOMAIN = {{ gitea_ssh_domain }} SSH_DOMAIN = {{ gitea_ssh_domain }}
@ -102,7 +102,7 @@ CERT_FILE = {{ gitea_tls_cert_file }}
KEY_FILE = {{ gitea_tls_key_file }} KEY_FILE = {{ gitea_tls_key_file }}
{% endif %} {% endif %}
LANDING_PAGE = {{ gitea_landing_page }} LANDING_PAGE = {{ gitea_landing_page }}
{% if gitea_lfs_server_enabled | bool -%} {% if gitea_lfs_server_enabled | bool %}
LFS_START_SERVER = true LFS_START_SERVER = true
LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }}
{% endif %} {% endif %}
@ -194,14 +194,14 @@ ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_allow_only_external_registration | t
[mailer] [mailer]
ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }} ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }}
{% if gitea_mailer_enabled | bool %} {% if gitea_mailer_enabled | bool %}
PROTOCOL = {{ gitea_mailer_protocol }}
SMTP_ADDR = {{ gitea_mailer_smtp_addr }}
SMTP_PORT = {{ gitea_mailer_smtp_port }}
USE_CLIENT_CERT = {{ gitea_mailer_use_client_cert | ternary('true', 'false') }}
{% if gitea_mailer_use_client_cert | bool %} {% if gitea_mailer_use_client_cert | bool %}
CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }} CLIENT_CERT_FILE = {{ gitea_mailer_client_cert_file }}
CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }} CLIENT_KEY_FILE = {{ gitea_mailer_client_key_file }}
{% endif %} {% endif %}
PROTOCOL = {{ gitea_mailer_protocol }}
SMTP_ADDR = {{ gitea_mailer_smtp_addr }}
SMTP_PORT = {{ gitea_mailer_smtp_port }}
USE_CLIENT_CERT = {{ gitea_mailer_use_client_cert | ternary('true', 'false') }}
FORCE_TRUST_SERVER_CERT = {{ gitea_mailer_force_trust_server_cert | ternary('true', 'false') }} FORCE_TRUST_SERVER_CERT = {{ gitea_mailer_force_trust_server_cert | ternary('true', 'false') }}
USER = {{ gitea_mailer_user }} USER = {{ gitea_mailer_user }}
PASSWD = {{ gitea_mailer_password }} PASSWD = {{ gitea_mailer_password }}

View file

@ -62,5 +62,5 @@ transfer_custom_footer:
- 'files/gitea_footer/extra_links_footer.tmpl' - 'files/gitea_footer/extra_links_footer.tmpl'
- 'files/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl'
playbook_version_number: 51 # should be int playbook_version_number: 52 # should be int
playbook_version_path: 'do1jlr.gitea.version' playbook_version_path: 'do1jlr.gitea.version'