Thank you for your interest in contributing to OpsScript Gate! We welcome bug reports, compatibility test fixtures, feature suggestions, and pull requests.
OpsScript Gate requires Python 3.10+ and a standard virtual environment.
# Clone the repository
git clone https://github.com/Mresyzz/opsscript-gate.git
cd opsscript-gate
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install package in editable mode with test dependencies
pip install -e .[test]The test suite separates mocked unit tests from Docker integration tests:
- Unit tests: Use mocking and do not require a running Docker daemon.
- Integration tests: Labeled with
@pytest.mark.integrationand run against real Docker containers.
# Run unit tests (recommended for daily development)
pytest -v -m "not integration"
# Run full test suite including live Docker integration tests
pytest -vPull requests should pass the unit test suite.
Any changes affecting the container runner should preserve these constraints:
- Unprivileged execution:
- Containers must not run with
privileged=True. cap_dropmust remain["ALL"].security_optmust include["no-new-privileges:true"].
- Containers must not run with
- Read-only script mount:
- Target scripts must remain read-only (
:ro). - Do not mount additional host filesystem paths into test containers.
- Target scripts must remain read-only (
- Timeout & cleanup:
- Containers reaching timeout limits should be terminated with
container.kill(). - Container removal in
finallyblocks must be preserved.
- Containers reaching timeout limits should be terminated with
- Non-interactive execution:
- Standard input should remain detached (
stdin_open=False,tty=False,</dev/null). - Keep non-interactive environment variables (
DEBIAN_FRONTEND=noninteractive,CI=true).
- Standard input should remain detached (
- Scope:
- Avoid emulating complex init systems (like systemd) inside containers; the runner focuses on standard script execution, command availability, and exit codes.
To propose or add a new distribution image:
- Ensure the official image is available on Docker Hub and is publicly accessible.
- Confirm the image contains
/bin/shfor minimal POSIX execution. - Add a representative compatibility test fixture in
tests/fixtures/demonstrating standard behavior. - Ensure the image does not require interactive initialization.
- Fork the repository and create a descriptive feature branch from
main. - Make your modifications, adhering to standard Python formatting (PEP 8) and type hints.
- Add or update unit tests in
tests/test_runner.pyverifying both success and failure paths. - Verify tests pass locally:
pytest -v -m "not integration". - Open a Pull Request against the
mainbranch with a clear summary of changes.