Skip to content

Commit

Permalink
Merge branch 'davestephens:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bcurran3 authored Jul 6, 2024
2 parents 0dcb359 + eaf2d66 commit b79da11
Show file tree
Hide file tree
Showing 819 changed files with 28,583 additions and 4,608 deletions.
5 changes: 4 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
skip_list:
- risky-file-permissions
- role-name
- fqcn-builtins
- name[missing]
- key-order[task]
- name[template]

exclude_paths:
- roles/bertvv.samba
- roles/geerlingguy.docker
- roles/geerlingguy.docker_arm
- roles/geerlingguy.nfs
19 changes: 19 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
kind: pipeline
name: default

steps:
- name: check ansible syntax
image: plugins/ansible:3
settings:
playbook: nas.yml
galaxy: requirements.yml
inventory: tests/inventories/integration_testing/inventory
syntax_check: true

- name: lint
image: python:3
commands:
- pip3 install ansible yamllint==1.27.1 ansible-lint==6.5
- ansible-lint nas.yml
- yamllint .
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first PR against Ansible-NAS, please read our contributor guidelines - https://github.com/davestephens/ansible-nas/blob/master/CONTRIBUTING.md.
1. If this is your first PR against Ansible-NAS, please read our contributor guidelines - https://github.com/davestephens/ansible-nas/blob/main/CONTRIBUTING.md.
2. Ensure you have tested new functionality using tests/test-vagrant.sh.
3. If the PR is unfinished, add `WIP:` at the beginning of the title or use the Github Draft PR feature.
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -18,15 +18,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the codebase
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python 3
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install test dependencies
run: pip3 install ansible yamllint==1.27.1 ansible-lint==6.5
run: pip3 install ansible yamllint==1.30.0 ansible-lint==6.14.6

- name: Ansible-lint
run: ansible-lint nas.yml
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Deploy to GitHub Pages

on:
push:
branches:
- main

jobs:
lint:
name: Lint Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint docs
uses: articulate/actions-markdownlint@v1
with:
version: 0.32.2

deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: website/package-lock.json

- name: Install dependencies
run: npm ci

- name: Build website
run: npm run build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./website/build
38 changes: 38 additions & 0 deletions .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Test Website Deployment

on:
pull_request:
branches:
- main

jobs:
lint:
name: Lint Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint docs
uses: articulate/actions-markdownlint@v1
with:
version: 0.32.2

test-deploy:
name: Test deployment
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache-dependency-path: website/package-lock.json

- name: Install dependencies
run: npm ci

- name: Build website
run: npm run build
48 changes: 30 additions & 18 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,39 @@ name: Integration

# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
schedule:
- cron: '0 23 * * *'
workflow_dispatch:


jobs:
test:
name: Test
runs-on: ubuntu-22.04
generate-matrix:
name: Generate test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out the codebase
uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Generate Test Matrix
id: set-matrix
shell: bash
run: "tests/github-test-matrix.sh"

- name: Set up Python 3
uses: actions/setup-python@v2
test:
name: "Test ${{ matrix.role }}"
needs: generate-matrix
runs-on: ubuntu-latest
strategy:
matrix:
role: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- name: Molecule Test
uses: gofrolist/molecule-action@dfbfd1af6a77523c8a937a1532f92808065a00a4
with:
python-version: '3.x'

- name: Install Ansible
run: pip3 install ansible

- name: Install roles
run: ansible-galaxy install -r requirements.yml

- name: Run playbook
run: ansible-playbook -i tests/inventories/integration_testing/inventory nas.yml -b
molecule_options: --base-config ../../tests/molecule/base.yml
molecule_command: test
molecule_working_dir: ${{ matrix.role }}
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ inventories
roles/bertvv.samba
roles/geerlingguy.docker
roles/geerlingguy.nfs
website/.docusaurus
website/node_modules

# Vim
[._]sw[a-p]
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
repos:
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v6.5.0
rev: v6.14.6
hooks:
- id: ansible-lint
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.27.1
rev: v1.30.0
hooks:
- id: yamllint
- repo: https://github.com/igorshubovych/markdownlint-cli
Expand Down
39 changes: 39 additions & 0 deletions .vscode/ansible-nas.json.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// Place your ansible-nas workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }

"Block When": {
"prefix": ["bw"],
"body": [
"- name: ${1:name}",
"\tblock:",
"\t\t$0",
"\twhen: ${2:condition}"
],
"description": "block with when condition"
},
"Assert That": {
"prefix": ["at"],
"body": [
"- name: ${1:name}",
"\tassert:",
"\t\tthat:",
"\t\t\t- $0"
],
"description": "assert that"
}
}
5 changes: 3 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"recommendations": [
"redhat.ansible",
"ybaumes.highlight-trailing-white-spaces",
"bungcip.better-toml"
"redhat.vscode-yaml",
"tamasfe.even-better-toml",
"ybaumes.highlight-trailing-white-spaces"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"yaml.schemaStore.enable": false
}
10 changes: 2 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,10 @@
"group": "test"
},
{
"label": "Serve docs locally (mkdocs serve)",
"label": "Run pytest",
"type": "shell",
"command": "mkdocs serve",
"command": "pytest --molecule-base-config=../../tests/molecule/base.yml",
"group": "test"
},
{
"label": "Deploy docs to GitHub (mkdocs gh-deploy)",
"type": "shell",
"command": "mkdocs gh-deploy",
"group": "build"
}
]
}
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Contributions of every kind have far-ranging consequences. Just as your work dep

## Patient

Asynchronous communication can come with its own frustrations, even in the most responsive of communities. Please remember that our community is largely built on volunteered time, and that questions, contributions, and requests for support may take some time to receive a response. Repeated "bumps" or "reminders" in rapid succession are not good displays of patience. Additionally, it is considered poor manners to ping a specific person with general questions. Pose your question to the community as a whole, and wait patiently for a response.
Asynchronous communication can come with its own frustrations, even in the most responsive of communities. Please remember that our community is totally built on volunteered time, and that questions, contributions, and requests for support may take some time to receive a response. Repeated "bumps" or "reminders" in rapid succession are not good displays of patience. Additionally, it is considered poor manners to ping a specific person with general questions. Pose your question to the community as a whole, and wait patiently for a response.

## Respectful

Expand Down
32 changes: 13 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,22 @@

Contributing to Ansible-NAS is easy! Add your functionality, then raise a pull request on GitHub. A few things to bear in mind:

* **Restrict pull requests to one piece of functionality or bugfix at a time.**
* Test your new functionality or bugfix using the included `tests/test-vagrant.sh` script to spin up a test VM.
* Run `ansible-lint` against the playbook before committing. (There is a VSCode task set up to run the right command for you)
* Ensure that your PR only changes files required for your functionality or bugfix. Random changes in other files will result in your PR being rejected

If you're adding a new application:
## Development Environment

* It must be structured in an [Ansible role](https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html).
* Ensure that the new application is disabled by default.
* Add a documentation page to `docs/applications/` - use an existing application as an example.
* Add to the list of Available Applications in `README.md`
* Add the frontend port to `docs/configuration/application_ports.md`, ensuring you've not clashed with an existing application.
* Development of Ansible-NAS is carried out in [JetBrains PyCharm](https://www.jetbrains.com/?from=Ansible-NAS) on Linux - you'll get some nice recommended extensions and task setups if you do the same.
* You'll need a working Python 3 environment, Docker (to run tests) and [pre-commit](https://pre-commit.com) installed - `pip install -r requirements-dev.txt`.

## Things to bear in mind
## General Stuff

* If you break the build with your PR, it'll need to be fixed before it's merged.
* Pull requests that unintentionally touch files, or that show files as removed then re-added will be rejected.
* Don't mess with line endings, or tabs vs. spaces.
* **Restrict pull requests to one piece of functionality or bugfix at a time.**
* Ensure that your changes aren't going to break the GitHub builds. You can run the Pre-commit checks manually (it's not yet configured to run on every commit) using the VSCode task.
* Ensure that your PR only changes files required for your functionality or bugfix. Random changes in other files will result in your PR being rejected.
* Don't mess with line endings, or change spaces for tabs. They're fine how they are.
* Please know that your efforts are appreciated, thanks! :+1:

## Development Environment
## Adding a new application

* Development of Ansible-NAS is carried out in [Visual Studio Code](https://code.visualstudio.com/) - you'll get some nice
recommended extensions and task setups if you do the same.
* You'll need a working Python 3 environment, and [pre-commit](https://pre-commit.com) installed - `pip install -r requirements-dev.txt`.
So you want to add a new application. Great!

* Start by looking at the `hello_world` example. Following this structure is the most likely way of getting your PR approved. Leaving out things the `hello_world` example includes (ie docs, tests) will definitely result in your PR being rejected.
* Add to the list of Available Applications in `README.md`
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2022 David Stephens
Copyright (c) 2017-2024 David Stephens

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit b79da11

Please sign in to comment.