This Docker environment provides a consistent development and testing environment for ngfw_pkgtools.
- Docker
- Docker Compose
make buildOr manually:
docker-compose -f docker-compose.dev.yml buildmake upOr manually:
docker-compose -f docker-compose.dev.yml up -dmake shellOr manually:
docker-compose -f docker-compose.dev.yml exec ngfw-pkgtools-dev /bin/bashOnce inside the container shell, you can run any script:
# Example: Run create-branch.py
./create-branch.py --help
# Example: Run with specific parameters
./create-branch.py --branch ngfw-1.0 --product ngfw --simulateRun unit tests with coverage:
make testOr manually:
docker-compose -f docker-compose.dev.yml exec ngfw-pkgtools-dev pytest -v --cov=lib --cov-report=term-missingRun specific tests:
# Run specific test file
docker-compose -f docker-compose.dev.yml exec ngfw-pkgtools-dev pytest tests/test_repoinfo.py -v
# Run specific test
docker-compose -f docker-compose.dev.yml exec ngfw-pkgtools-dev pytest tests/test_repoinfo.py::TestRepositoryInfo -vSee tests/README.md for more details on testing.
make formatmake lintThe Gerrit username is automatically configured from your environment:
# Set your Gerrit username (optional, defaults to $USER)
export GERRIT_USER=jsommerville
# Restart container to pick up the change
make down
make upThe username is used in Gerrit SSH URLs: ssh://<username>@gerrit.corp.arista.io:29418/efw/<repo>
If your scripts need to push to remote repositories, you may need to mount your git credentials:
-
Uncomment the volume mounts in
docker-compose.dev.yml:- ~/.gitconfig:/root/.gitconfig:ro - ~/.ssh:/root/.ssh:ro
-
Rebuild and restart:
make down make build make up
The Docker image includes:
- Python 3.7+ (from Debian Buster)
- Git - Version control
- GitPython - Python Git library
- PyYAML - YAML parsing
- requests - HTTP library
- pytest - Testing framework
- pytest-cov - Code coverage
- ruff - Python linter and formatter
To stop and remove containers:
make downTo remove everything including the image:
make clean/opt/untangle/ngfw_pkgtools- Working directory inside container- Volume mounted to your local directory for live code changes
docker-compose -f docker-compose.dev.yml logsThe container runs as root. If you encounter permission issues with generated files, you may need to adjust ownership after running commands.
Make sure you're running commands from the /opt/untangle/ngfw_pkgtools directory inside the container.