-
Notifications
You must be signed in to change notification settings - Fork 3
Code refactor; adds more tests #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kenorb
wants to merge
87
commits into
master
Choose a base branch
from
dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
e42e1d4
Sets 10 minutes by default for timeout
kenorb 4bb0b3d
Add devcontainer configuration for Ansible role development
kenorb 3e31d81
Add GitHub Copilot extensions to devcontainer configuration
kenorb cb2d9eb
Add Dependabot configuration for weekly devcontainer updates
kenorb e6ef0d0
Add .ansible to .gitignore
kenorb 424610d
Fix indentation in Dependabot configuration for devcontainers
kenorb cefd0fc
Refactor devcontainer and Dependabot configuration for clarity and co…
kenorb b03ad7b
pre-commit update
kenorb 7d2205f
Installs pip packages via requirements file
kenorb f6b5a17
Adds molecule/requirements.txt
kenorb 33b0c7a
Refs #13. Probably fixes problem with Windows commands under Unix.
nseam b34a2e8
Adds newline at end of file
kenorb e533ca1
Sets wine_release to stable
kenorb eec1f42
Change stdout callback to default and set callback result format to yaml
kenorb 52226fc
Updates molecule/requirements.txt
kenorb b34132f
Adds .png files to .gitignore [no-ci]
kenorb 254ca82
Bump ea31337.metatrader version to v1.0.0 in all requirements files
kenorb b230707
Create .coderabbit.yaml
kenorb 146d293
Adds missing document start "---"
kenorb abce5c9
Improves .yamllint [no-ci]
kenorb 1fbcd50
Sets ea31337.metatrader to v1.0.1
kenorb 2963423
Adds back line-length and truthy rules for .yamllint
kenorb cef7037
Adds vscode-github-actions extension
kenorb 22a79ea
Update molecule workflow to enable debug mode conditionally on failure
kenorb f0b5218
Removes meta/requirements.txt [no-ci]
kenorb f17b975
Adds Pipfile and lock file [no-ci]
kenorb 5d07ed3
Updates requirements file [no-ci]
kenorb 4ce0f15
Removes redundant requirements files
kenorb e13a7a6
Updates requirements.txt
kenorb 865c5fe
Updates Pipfile.lock [no-ci]
kenorb 646f3d2
Adds .markdownlint.yaml
kenorb f9195ed
Ignores *.html files
kenorb b9fe519
Corrects copilot-instructions.md
kenorb 43cd798
Updates devcontainer.json
kenorb 9d2e3b7
Updates pre-commit/action to v3.0.1
kenorb 4e5bb47
Improves molecule test report
kenorb edf8ee8
Adds paths-ignore for molecule workflow
kenorb 1fe86e4
Improves molecule provisioner config options
kenorb c2cff72
Adds code-review.prompt.md [no-ci]
kenorb fd81463
Increases timeout to 120
kenorb 4f11b5a
Sets metatrader to v1.0.1 version
kenorb c34606c
Sets oneline as default Ansible screen output [no-ci]
kenorb b96951e
Updates meta/main.yml
kenorb 22443e8
Adds .ansible-lint
kenorb 3e3eb9d
Improves .coderabbit.yaml
kenorb 3814059
Minor changes
kenorb 1da09c9
Adds ansible.cfg
kenorb 26a8964
Adds tests
kenorb 20eef9f
Enhances configuration and playbook for Docker containers, adds suppo…
kenorb 0aad6dd
Adds rhysd/actionlint pre-commit repo
kenorb fbed1be
Adds .vscode/tasks.json
kenorb 06bacec
Adds actionlint matcher configuration for enhanced linting support
kenorb be01b5c
Adds reviewdog workflow configuration for actionlint
kenorb daf3e14
Refines paths-ignore patterns in GitHub Actions workflow to exclude Y…
kenorb 0c9e49c
Adds features/actionlint:
kenorb 708a926
Refines paths-ignore patterns in Molecule workflow and updates ANSIBL…
kenorb 4107d36
Refactors Docker container playbook to streamline Python installation…
kenorb c644ddb
Updates adrienverge/yamllint
kenorb b84bdd1
Updates pre-commit configuration to include additional hooks and upgr…
kenorb 8cc497b
Enhances documentation and license information:
kenorb 19bf270
Improves devcontainer configuration
kenorb c66d57d
Fixes typo in ignore_title_patterns and adds path instructions for YA…
kenorb 5d555f5
Update documentation links in ansible.cfg and enhance comments in req…
kenorb b809386
Add Ansible linting rules and enhance YAML guidelines
kenorb 7ac4a9e
Refine paths-ignore patterns in Molecule and Test workflows for consi…
kenorb 8503a5e
Refactor converge.yml to streamline role inclusion and variable defin…
kenorb b26e0af
Refactor docker-containers.yml to improve container configuration and…
kenorb 0ba0fc7
Update main.yml to enhance security by marking sensitive fields with …
kenorb d139036
To resolve the jinja-statements-delimiter lint errors, replace {%- an…
kenorb 8cbcc2b
Update metatrader role version to v1.0.2 in requirements.yml
kenorb c86a597
Improves meta/main.yml
kenorb 3431ea4
Improves README with installation steps using ansible-galaxy
kenorb 9a2ef6c
Narrows down community.general version
kenorb 32b804f
Removes confusing part in copilot-instructions.md
kenorb 16a6ff6
Updates ea31337.metatrader role to v1.0.3
kenorb 69fd2f1
Fix repository URL format in requirements.yml
kenorb ee2f8ba
Adds ansible-role-* to .gitignore
kenorb 8a31a04
Various dev fixes
kenorb 88f6d16
devcontainer.json: Code improvements
kenorb 8ee46ab
Improves molecule prepare playbook and update provisioner settings
kenorb adbe0cc
Merges reviewdog workflow to check
kenorb 8b94586
Enhances pre-commit configuration by adding black and flake8 hooks; r…
kenorb 9f33395
Removes installing Python as it is already handled during image build
kenorb 1f6007c
Fixes typo in ansible_host
kenorb 43d39ab
Removes EOL Linux distributions from meta/main.yml
kenorb b5491c8
Minor fixes
kenorb 80155bd
Sync changes across molecule.yml
kenorb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| # .ansible-lint | ||
| exclude_paths: | ||
| - "*.yml.swp" | ||
| - .ansible/ | ||
| - .cache/ # implicit unless exclude_paths is defined in config | ||
| # Ansible-lint does not automatically load rules that have the 'opt-in' tag. | ||
| # You must enable opt-in rules by listing each rule 'id' below. | ||
| enable_list: | ||
| - args | ||
| - empty-string-compare # opt-in | ||
| - no-log-password # opt-in | ||
| - no-same-owner # opt-in | ||
| # - name[prefix] # opt-in | ||
| # add yaml here if you want to avoid ignoring yaml checks when yamllint | ||
| # library is missing. Normally its absence just skips using that rule. | ||
| - yaml | ||
| mock_roles: | ||
| - community.docker.docker_image | ||
| verbosity: 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| --- | ||
| # CodeRabbit configuration | ||
| chat: | ||
| auto_reply: true | ||
| early_access: true | ||
| reviews: | ||
| auto_review: | ||
| base_branches: | ||
| - "dev*" | ||
| - "main" | ||
| - "master" | ||
| drafts: false | ||
| enabled: true | ||
| ignore_title_keywords: | ||
| - "WIP" | ||
| - "DO NOT MERGE" | ||
| high_level_summary: true | ||
| path_filters: | ||
| - "**/*.j2" | ||
| - "**/*.md" | ||
| - "**/*.py" | ||
| - "**/*.yaml" | ||
| - "**/*.yml" | ||
| - "defaults/**" | ||
| - "meta/**" | ||
| - "molecule/**" | ||
| - "tasks/**" | ||
| - "vars/**" | ||
| path_instructions: | ||
| - path: "**/*.yml" | ||
| instructions: | | ||
| - For Ansible files, review the YAML code against the Ansible best practices and point out any mismatches. | ||
| - Ensure keys are in lexicographical order when possible. | ||
| poem: true | ||
| request_changes_workflow: false | ||
| review_status: true | ||
| tools: | ||
| actionlint: | ||
| enabled: true | ||
| gitleaks: | ||
| enabled: true | ||
| hadolint: | ||
| enabled: true | ||
| markdownlint: | ||
| enabled: true | ||
| shellcheck: | ||
| enabled: true | ||
| yamllint: | ||
| enabled: true | ||
| version: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
| // README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu | ||
| { | ||
|
|
||
| // "build": { | ||
| // "dockerfile": "Dockerfile", | ||
| // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 | ||
| // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. | ||
| // "args": { "VARIANT": "ubuntu-22.04" } | ||
| // }, | ||
|
|
||
| // Configure tool-specific properties. | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "DavidAnson.vscode-markdownlint", | ||
| "GitHub.copilot", | ||
| "GitHub.copilot-chat", | ||
| "elagil.pre-commit-helper", | ||
| "formulahendry.code-runner", | ||
| "formulahendry.code-runner-copilot", | ||
| "github.vscode-github-actions", | ||
| "ms-python.python", | ||
| "vscodevim.vim" | ||
| ], | ||
| } | ||
| }, | ||
| // Features to add to the dev container. More info: https://containers.dev/features. | ||
| "features": { | ||
| // "ghcr.io/maks1ms/devcontainers-features/wine:0": {}, | ||
| "ghcr.io/devcontainers-contrib/features/actionlint:1": {}, | ||
| "ghcr.io/devcontainers-contrib/features/node-asdf:0": {}, | ||
| "ghcr.io/devcontainers-extra/features/pipx-package:1": {}, | ||
| "ghcr.io/devcontainers/features/docker-in-docker:2": {}, | ||
| "ghcr.io/devcontainers/features/python:1": {}, | ||
| "ghcr.io/guiyomh/features/vim:0": {}, | ||
| "ghcr.io/jungaretti/features/make:1": {}, | ||
| "ghcr.io/prulloac/devcontainer-features/pre-commit:1": {}, | ||
| "ghcr.io/jungaretti/features/ripgrep:1": {} | ||
| }, | ||
|
|
||
| // Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
| // "forwardPorts": [], | ||
|
|
||
| // Use 'postCreateCommand' to run commands after the container is created. | ||
| // "postCreateCommand": "uname -a", | ||
|
|
||
| // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
| "image": "mcr.microsoft.com/devcontainers/base:jammy", | ||
| "name": "ansible-role-mt-runner", | ||
| // Install dependencies and pre-commit hooks. | ||
| "postCreateCommand": "pip install -r .devcontainer/requirements.txt && pre-commit install", | ||
|
|
||
| // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
| "remoteUser": "vscode", | ||
| "onCreateCommand": "sudo apt update && sudo apt install -y gh pipx && pipx install --include-deps ansible" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Python's requirements | ||
| # Usage: pip install -r requirements.txt | ||
| ansible | ||
| ansible-lint | ||
| docker>=7.1 | ||
| jinja2-cli | ||
| molecule | ||
| molecule-docker | ||
| pipenv | ||
| pre-commit | ||
| requests==2.31.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "problemMatcher": [ | ||
| { | ||
| "owner": "actionlint", | ||
| "pattern": [ | ||
| { | ||
| "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$", | ||
| "file": 1, | ||
| "line": 2, | ||
| "column": 3, | ||
| "message": 4, | ||
| "code": 5 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # Copilot Instructions for ansible-role-mt-runner | ||
|
|
||
| You are expected to be an expert in: | ||
|
|
||
| - Ansible | ||
| - Python | ||
| - Jinja2 | ||
| - Molecule | ||
| - Linux (Alpine, Debian/Ubuntu, Nix) | ||
| - YAML | ||
|
|
||
| ## Code Standards | ||
|
|
||
| - Avoid writing trailing whitespace | ||
| - Follow PEP 8 for Python. | ||
| - Include docstrings and type hints where applicable | ||
| - Maintain consistent YAML indentation | ||
| - Optimize for readability first, performance second | ||
| - Prefer modular, DRY approaches and list comprehensions when appropriate | ||
| - Use environment variables for configuration, never hardcode sensitive info | ||
| - Write clean, documented, error-handling code with appropriate logging | ||
|
|
||
| ## General Approach | ||
|
|
||
| - Be accurate, thorough and terse | ||
| - Cite sources at the end, not inline | ||
| - Provide immediate answers with clear explanations | ||
| - Skip repetitive code in responses; use brief snippets showing only changes | ||
| - Suggest alternative solutions beyond conventional approaches | ||
| - Treat the user as an expert | ||
|
|
||
| ## Ansible Guidelines | ||
|
|
||
| - Ensure idempotency in all tasks | ||
| - Ensure indentation is correct, especially for YAML files | ||
| - Follow standard role structure: tasks/, handlers/, templates/, defaults/, meta/ | ||
| - Use ansible-lint and write Molecule tests for verification | ||
| - Use descriptive task names and include helpful comments | ||
|
|
||
| ## Ansible Linting | ||
|
|
||
| Ensure enforcing the following rules: | ||
|
|
||
| - fqcn[keyword]: Avoid `collections` keyword by using FQCN for all plugins, modules, roles and playbooks | ||
|
|
||
| ## YAML Guidelines | ||
|
|
||
| Ensure the following rules are strictly followed: | ||
|
|
||
| - yaml[empty-lines]: Avoid too many blank lines | ||
| - yaml[indentation]: Avoid wrong indentation | ||
| - yaml[line-length]: No long lines (max. 120 characters) | ||
| - yaml[new-line-at-end-of-file]: Enforce new line character at the end of file | ||
| - yaml[truthy]: Truthy value should be one of [false, true] | ||
| - Ensure items are in lexicographical order when possible. | ||
| - When writing inline code, add a new line at the end to maintain proper indentation | ||
|
|
||
| ## Project Specifics | ||
|
|
||
| This role installs and runs trading platform with distribution-specific approaches: | ||
|
|
||
| - **Alpine Linux**: Uses apk package manager | ||
| - **Debian/Ubuntu**: Uses apt package manager | ||
| - **Nix**: Uses nix-env in lightweight Nix environments | ||
|
|
||
| Notes: | ||
|
|
||
| - Project utilizes Codespaces with config file at .devcontainer/devcontainer.json | ||
| and requirements at .devcontainer/requirements.txt | ||
| - GitHub Actions are used to validate the code by running | ||
| pre-commit checks (see .pre-commit-config.yaml file) and Molecule (molecule/). | ||
| - Service management uses supervisord across platforms. | ||
| - Formatting rules are defined in .yamllint (YAML) and .markdownlint.yaml (Markdown) files. | ||
|
|
||
| ### Key Variables | ||
|
|
||
| Variables are defined in defaults/main.yml and vars/main.yml files. | ||
|
|
||
| Notes: | ||
|
|
||
| - On variable changes, update main.yml and README.md files accordingly. | ||
|
|
||
| ### Testing Approach | ||
|
|
||
| - Use Molecule with Docker driver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # To get started with Dependabot version updates, you'll need to specify which | ||
| # package ecosystems to update and where the package manifests are located. | ||
| # Please see the documentation for more information: | ||
| # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
| # https://containers.dev/guide/dependabot | ||
| --- | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "devcontainers" | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Ansible Role Code Review Guidelines | ||
|
|
||
| Your goal is to review Ansible role code | ||
| to ensure it meets high-quality standards and follows best practices. | ||
|
|
||
| ## Ensure Code Quality | ||
|
|
||
| - Follow PEP 8 for Python. | ||
| - Maintain consistent YAML indentation. | ||
| - Optimize for readability first, performance second. | ||
| - Ensure idempotency in all Ansible tasks. | ||
| - Use environment variables for configuration, never hardcode sensitive info. | ||
| - Write clean, documented, error-handling code with appropriate logging. | ||
|
|
||
| ## Check for Linting and Formatting | ||
|
|
||
| - Ensure YAML files adhere to [.yamllint](../../.yamllint) rules. | ||
| - Ensure Markdown files adhere to [.markdownlint.yaml](../../.markdownlint.yaml) rules. | ||
| - Ensure Ansible playbooks and roles pass `ansible-lint`. | ||
|
|
||
| ## Review Ansible Role Structure | ||
|
|
||
| - Follow standard role structure: | ||
|
|
||
| - [tasks/](../../tasks/) | ||
| - [handlers/](../../handlers/) | ||
| - [templates/](../../templates/) | ||
| - [defaults/](../../defaults/) | ||
| - [meta/](../../meta/) | ||
|
|
||
| - Use descriptive task names and include helpful comments. | ||
| - Ensure indentation is correct, especially for arguments used for Ansible modules. | ||
|
|
||
| ## Verify Variables and Defaults | ||
|
|
||
| - Ensure variables are defined in | ||
| [defaults/main.yml](../../defaults/main.yml) and [vars/main.yml](../../vars/main.yml). | ||
| - Update [README.md](../../README.md) with any changes to variables. | ||
| - Ensure variables are used consistently across tasks and playbooks. | ||
|
|
||
| ## Check for Idempotency | ||
|
|
||
| - Ensure all tasks are idempotent and do not cause unnecessary changes on repeated runs. | ||
|
|
||
| ## Review Molecule Tests | ||
|
|
||
| - Ensure Molecule scenarios are defined and cover all supported platforms. | ||
| - Verify that Molecule tests are comprehensive and validate the role's functionality. | ||
| - Check [molecule/](../../molecule/) directory for test configurations. | ||
|
|
||
| ## Ensure Proper Error Handling | ||
|
|
||
| - Write error-handling code with appropriate logging. | ||
| - Ensure tasks fail gracefully and provide meaningful error messages. | ||
|
|
||
| ## Check for Dependencies | ||
|
|
||
| - Ensure all dependencies are listed in | ||
| [.devcontainer/requirements.txt](../../.devcontainer/requirements.txt) and [requirements.yml](../../requirements.yml). | ||
| - Verify that the role does not have any missing dependencies. | ||
|
|
||
| ## Review GitHub Actions | ||
|
|
||
| - Ensure GitHub Actions workflows are correctly configured to run pre-commit checks and Molecule tests. | ||
| - Verify that the workflows cover all necessary validation steps. | ||
| - Check [.github/workflows/](../) directory for workflow configurations. | ||
|
|
||
| ## Documentation | ||
|
|
||
| - Ensure the [README.md](../../README.md) file is up-to-date | ||
| and provides clear instructions for installation, usage, and variables. | ||
| - Include any additional documentation as needed for clarity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requests package is pinned to version 2.31.0, which has known security vulnerabilities (CVE-2023-32681). Consider updating to a newer version (2.32.0 or later) that addresses these security issues.