diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..917d02b --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,10 @@ +--- +# Same profile as the environment repo. The production profile enforces +# var-naming[no-role-prefix]: every role variable carries the role name as a prefix. +profile: production + +exclude_paths: + - .gitea + - .venv + - changelogs + - images diff --git a/.gitea/actionlint.yaml b/.gitea/actionlint.yaml new file mode 100644 index 0000000..ca61a2b --- /dev/null +++ b/.gitea/actionlint.yaml @@ -0,0 +1,8 @@ +# Runner labels used by the workflows, so actionlint accepts them. These belong +# to the Collection's own runner (scoped to the mortis org); the production +# labels (docker, ubuntu-lxc, molecule) are deliberately not listed, so a +# workflow that names one fails actionlint. +self-hosted-runner: + labels: + - kamino-docker + - kamino-molecule diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f32dc6a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,82 @@ +default_install_hook_types: [pre-commit, commit-msg] + +repos: + - repo: https://github.com/compilerla/conventional-pre-commit + rev: v4.4.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] + + - repo: https://github.com/gitleaks/gitleaks + rev: v8.30.1 + hooks: + - id: gitleaks + stages: ['pre-commit'] + + - repo: https://github.com/adrienverge/yamllint + rev: v1.38.0 + hooks: + - id: yamllint + args: [--strict] + stages: ['pre-commit'] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-toml + stages: ['pre-commit'] + - id: check-merge-conflict + stages: ['pre-commit'] + + # Blocking. .gitea/actionlint.yaml declares the runner labels. The workflows use the + # github.* contexts (Gitea aliases them), because actionlint does not know gitea.*. + # actionlint runs shellcheck over run: blocks when shellcheck is on PATH. + - repo: https://github.com/rhysd/actionlint + rev: v1.7.12 + hooks: + - id: actionlint + args: [-config-file, .gitea/actionlint.yaml] + files: ^\.gitea/workflows/.*\.ya?ml$ + stages: ['pre-commit'] + + # ansible-lint and the changelog lint run from PATH (language: system): their + # versions are the pins in requirements-dev.txt, installed into a virtualenv by + # CI and locally. ansible-lint is the slowest hook, so fail_fast stops the run + # once it fails (a global fail_fast would hide every other failure). + - repo: local + hooks: + # REUSE compliance (licence files, SPDX data, REUSE.toml; docs/licensing.md in the + # environment repo). The wrapper tolerates only unused licence texts, see its docstring. + - id: reuse-lint + name: REUSE compliance + description: reuse lint, tolerating unused licence texts until the roles arrive + entry: python3 scripts/reuse_lint.py + language: system + pass_filenames: false + always_run: true + stages: ['pre-commit'] + + - id: antsibull-changelog-lint + name: Changelog fragments lint + description: antsibull-changelog lint over changelogs/ + entry: antsibull-changelog lint + language: system + files: ^(changelogs/|galaxy\.yml$) + stages: ['pre-commit'] + pass_filenames: false + + - id: ansible-lint + name: ansible-lint + description: ansible-lint production profile, offline + entry: ansible-lint --offline --nocolor + language: system + files: ^(roles/|plugins/|meta/|galaxy\.yml$|\.ansible-lint$|\.yamllint$) + stages: ['pre-commit'] + pass_filenames: false + require_serial: true + fail_fast: true + + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..256c308 --- /dev/null +++ b/.yamllint @@ -0,0 +1,25 @@ +--- +extends: default + +ignore: | + .venv/** + # Written and rewritten by antsibull-changelog, which does not indent sequences. + changelogs/config.yaml + +rules: + trailing-spaces: + level: error + comments: + # https://github.com/prettier/prettier/issues/6780 + min-spaces-from-content: 1 + # https://github.com/adrienverge/yamllint/issues/384 + comments-indentation: false + document-start: disable + line-length: + max: 160 + braces: + min-spaces-inside: 0 + max-spaces-inside: 1 + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml new file mode 100644 index 0000000..d4f9724 --- /dev/null +++ b/changelogs/changelog.yaml @@ -0,0 +1,2 @@ +ancestor: null +releases: {} diff --git a/changelogs/config.yaml b/changelogs/config.yaml new file mode 100644 index 0000000..7fbb468 --- /dev/null +++ b/changelogs/config.yaml @@ -0,0 +1,37 @@ +add_plugin_period: true +changelog_nice_yaml: false +changelog_sort: alphanumerical +changes_file: changelog.yaml +changes_format: combined +ignore_other_fragment_extensions: true +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +output: +- file: CHANGELOG.rst + format: rst +prelude_section_name: release_summary +prelude_section_title: Release Summary +sanitize_changelog: true +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: mortis.kamino +trivial_section_name: trivial +use_fqcn: true +vcs: auto diff --git a/changelogs/fragments/.gitkeep b/changelogs/fragments/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/changelogs/fragments/scaffold.yml b/changelogs/fragments/scaffold.yml new file mode 100644 index 0000000..05df43e --- /dev/null +++ b/changelogs/fragments/scaffold.yml @@ -0,0 +1,2 @@ +trivial: + - Initial repository scaffolding, CI workflows and the molecule base image definition. diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..6d902d9 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,10 @@ +# Pinned tooling for lint and build, used by CI (.gitea/workflows) and locally: +# python3 -m venv .venv && . .venv/bin/activate && pip install -r requirements-dev.txt +# ansible-core and ansible-lint match the environment repo's runner image +# (hosts/group_vars/all/ci_python_tools.yml there). Renovate bumps these pins. +ansible-core==2.19.14 +ansible-lint==26.6.0 +pre-commit==4.6.2 +antsibull-changelog==0.35.2 +galaxy-importer==0.4.44 +reuse==6.2.0