Skip to content

Release Candidate 0.1 for the vigOS Development Environment - #6

Merged
c-vigo merged 71 commits into
mainfrom
dev
Dec 9, 2025
Merged

c-vigo merged 71 commits into
mainfrom
dev

Conversation

@c-vigo

@c-vigo c-vigo commented Nov 26, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR introduces the vigOS Development Environment - a standardized, production-ready development container image designed for Python-based projects. This is the first official release (v0.1) of the devcontainer system, providing a complete, reproducible development environment with integrated tooling and automation.

The vigOS devcontainer provides:

  • Standardized Python 3.12 development environment with minimal overhead (~450 MB)
  • One-command project initialization using init-workspace script
  • Automated Git configuration and commit signing setup
  • Pre-configured development tools (pre-commit, ruff, uv)
  • GitHub CLI integration for seamless workflow
  • VS Code devcontainer template with Docker Compose orchestration
  • Comprehensive three-tiered testing suite (image, integration, registry tests)

Related Issue(s)

Closes #2
Closes #3

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Test updates

Changes Made

Core Infrastructure

  • Containerfile with Python 3.12 base image (Debian Trixie)
  • System tools installation (git, gh, curl, openssh-client, ca-certificates)
  • Python environment with uv, pre-commit, and ruff
  • init-workspace script for project initialization
  • Multi-architecture support (AMD64, ARM64)

Devcontainer Template

  • VS Code devcontainer.json configuration
  • Docker Compose orchestration (docker-compose.yml)
  • Support for docker-compose.override.yml for custom mounts
  • Post-attach automation scripts
  • Automatic Git configuration synchronization from host
  • Focused devcontainer README.md with version tracking and lifecycle documentation
  • User-specific workspace.code-workspace.example for multi-root VS Code workspaces

Git & GitHub Integration

  • Automated git configuration copying from host
  • SSH commit signing setup with signature verification
  • Pre-commit hooks initialization
  • GitHub issue templates (bug_report.yml, feature_request.yml, task.yml)
  • Pull request template
  • GitHub CLI integration

Development Tools & Automation

  • Makefile with build, test, push, pull, clean targets
  • Setup script for development environment initialization
  • Build script with multi-architecture support
  • Push/pull scripts for registry operations
  • Automatic README.md updates with version and image size during releases

Testing Infrastructure

  • Comprehensive test suite (conftest.py)
  • Image tests (test_image.py) - 8 test classes verifying container image
  • Integration tests (test_integration.py) - 13 test classes verifying devcontainer deployment
  • Registry tests (test_registry.py) - validates push/pull/clean workflows and README updates
  • Optimized registry tests using minimal Containerfile (10-20s builds vs 2min)

Documentation

  • README.md with usage and features
  • CONTRIBUTE.md with development workflow
  • TESTING.md with test strategy
  • CHANGELOG.md with version history and GitHub release links
  • .devcontainer/README.md - focused documentation for devcontainer lifecycle, mounts, and workspace configuration

Testing

  • All tests pass locally (make test - runs image, integration, and registry tests)
  • Image tests pass (make test-image)
  • Integration tests pass (make test-integration)
  • Registry tests pass (make test-registry)
  • Manual testing performed (describe below)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (README.md, CONTRIBUTE.md, etc.)
  • I have updated the CHANGELOG.md in the [Unreleased] section
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Release Proposal: v0.1

This PR proposes the first official release (0.1) of the vigOS Development Environment.

Release Artifacts:

  • Container Image: ghcr.io/vig-os/devcontainer:0.1
  • Platforms: linux/amd64, linux/arm64
  • Release Date: 2025-11-26

Release Process (after approval):

make push VERSION=0.1

This will create git tag, build multi-architecture images, push to GHCR, create GitHub release, and automatically update both main README.md and devcontainer README.md with version, release link, and date.

Architecture Decisions

  1. Docker Compose over devcontainer.json volumes: More flexibility for volume mounting
  2. Session-scoped test fixtures: Reduces test execution time significantly
  3. Multi-stage authentication: Supports multiple auth methods for flexibility
  4. Minimal base image: Keeps size under 450 MB while providing full functionality
  5. Automatic README updates: Push script updates version and image size automatically in both main README and devcontainer README
  6. Optimized registry tests: Uses minimal Containerfile when TEST_REGISTRY is set, skips full test suite in registry test mode
  7. Build folder approach: README updates happen in build/ folder during push, keeping source files clean
  8. User-specific workspace files: workspace.code-workspace is gitignored, users copy from example

Known Limitations

  • Multi-architecture builds require QEMU on Linux
  • Registry tests require Docker/Podman registry support
  • SSH commit signing requires host-side key setup

Review Focus Areas

Please pay special attention to:

  1. Testing Strategy: Is the three-tiered approach comprehensive enough?
  2. Documentation: Are setup instructions clear for new contributors?
  3. init-workspace Script: Does the user experience feel smooth?
  4. Release Process: Is v0.1 ready for public release?

Quick Demo

# Build development image locally
make build

# One-command project initialization
podman run -it --rm -v "./:/workspace" ghcr.io/vig-os/devcontainer:dev /root/assets/init-workspace.sh

# Open in VS Code
code .

# Use Command Palette: "Dev Containers: Reopen in Container"

c-vigo and others added 30 commits November 24, 2025 15:18
- project setup
- image manipulation (build, test, push, pull, clean)
- makefile as entry point
- no need for template backup and restore
- bundle all image assets under assets/
- based on python3.12 trixie
- minimal development tools (git, ssh, gh, uv, pre-commit)
- self-initializing script
- during image build phase, initialize the hooks in the assets folder
- this speeds up significantly testing and deployment
- Create README.md, CONTRIBUTE.md, and CHANGELOG.md
- Move tests/README.md to TESTING.md
- Fix documentation references and linting errors
- Fix old help message in Makefile
- Add issue templates using GitHub Forms (YAML) format
  - Bug report template with environment details and reproduction steps
  - Feature request template with problem statement and impact analysis
  - Task template with acceptance criteria and priority dropdown
- Add pull request template with testing checklist and change type classification
- Templates include HTML comments for guidance and align with project workflow
- Add docker-compose.yml template with devcontainer service configuration
- Update devcontainer.json to use dockerComposeFile instead of direct image/mounts
- Move container configuration (image, volumes, environment) to docker-compose.yml
- Update TestDevContainerJson: remove image test, add dockerComposeFile and service tests
- Add TestDevContainerDockerCompose class with comprehensive docker-compose.yml tests
- update tests
- update setup script
Changed devcontainer to mount projects into /workspace/<project_name>
subdirectory rather than directly to /workspace.

Key changes:
- Set workspaceFolder to /workspace/{{SHORT_NAME}}
- Mount using relative path (..) to subdirectory in docker-compose volumes
- Update scripts path to match new structure
- Remove redundant env vars from docker-compose
- Remove PRE_COMMIT_HOME from base image (now project-specific)
- Update tests
Implements support for mounting additional folders using standard Docker
Compose override files. This enables e.g. multi-project development, shared
libraries, and reference material mounting without modifying committed
configuration.

New files:
- MOUNTS.md: Comprehensive documentation with examples
- docker-compose.override.yml.example: Template with common patterns
- .devcontainer/.gitignore: Ignores user-specific override files

Changes:
- README.md: Added mounting section with quick start
- conftest.py: Test fixture creates and tests override functionality
- test_integration.py: 4 integration tests verify mount operations

Features:
- Standard Docker Compose override pattern
- Per-developer customization (gitignored)
- Full integration test coverage
- Documentation with troubleshooting guide

Closes #3
[BREAKING] Add multi-project support via subdirectory mounting and compose overrides
Add GitHub templates for issues and pull requests
The script was using 'return 1' outside of a function, which is invalid
in bash and won't properly exit the script with an error code. Changed
to 'exit 1' to properly signal an error condition when pre-commit
installation fails.
- Add EXPECTED_VERSIONS dictionary at module level to define all tool versions
- Update all version checks to use variables from EXPECTED_VERSIONS
- Fix inconsistency: pre-commit test comment said 4.3.0 but checked 4.5.0
- Makes version testing more maintainable and less fragile
- When tool versions change, only EXPECTED_VERSIONS needs updating

This resolves confusion about expected versions and makes the test suite
easier to maintain when dependencies are updated.
The pre-commit hook in assets/workspace/.githooks/pre-commit was
referencing service 'dev', but the actual service name defined in
docker-compose.yml is 'devcontainer'. This caused the hook to fail
when executed from outside the container.

Changed 'podman compose run --rm dev' to 'podman compose run --rm
devcontainer' to match the actual service name.
The variable ssh_agent_added was only assigned inside conditional blocks
(lines 263, 268) but referenced on line 271. If both conditions were
false (SSH mount already exists AND environment variable already set),
the variable would be undefined, causing a NameError.

Fixed by initializing ssh_agent_added to False before the conditional
checks, ensuring it always has a defined value when referenced.
@gerchowl

gerchowl commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

Build time

No clue, I tried with --force and it is still fast in my test. Maybe the problem is the "find" command in line 100 of init_workspace.sh?

{{IMAGE_TAG}}

  • did you use make build?
  • do the tests pass? in particular, TestDevContainerPlaceholders in test_integration.py

i had to, since its not pushed to ghcr.

devcontainer % make test
=============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.12.10, pytest-9.0.1, pluggy-1.6.0 -- /Users/larsgerchow/Projects/eXoma/devcontainer/.venv/bin/python3
cachedir: .pytest_cache
rootdir: /Users/larsgerchow/Projects/eXoma/devcontainer
configfile: pyproject.toml
plugins: docker-3.2.5, testinfra-10.2.2
collected 19 items                                                                                                                                                                

tests/test_image.py::TestSystemTools::test_git_installed PASSED                                                                                                             [  5%]
tests/test_image.py::TestSystemTools::test_git_version PASSED                                                                                                               [ 10%]
tests/test_image.py::TestSystemTools::test_curl_installed PASSED                                                                                                            [ 15%]
tests/test_image.py::TestSystemTools::test_curl_version PASSED                                                                                                              [ 21%]
tests/test_image.py::TestSystemTools::test_openssh_client_installed PASSED                                                                                                  [ 26%]
tests/test_image.py::TestSystemTools::test_gh_installed PASSED                                                                                                              [ 31%]
tests/test_image.py::TestSystemTools::test_gh_version PASSED                                                                                                                [ 36%]
tests/test_image.py::TestPythonEnvironment::test_python3_installed PASSED                                                                                                   [ 42%]
tests/test_image.py::TestPythonEnvironment::test_uv_installed FAILED                                                                                                        [ 47%]
tests/test_image.py::TestDevelopmentTools::test_pre_commit_installed PASSED                                                                                                 [ 52%]
tests/test_image.py::TestDevelopmentTools::test_ruff_installed FAILED                                                                                                       [ 57%]
tests/test_image.py::TestEnvironmentVariables::test_pythonunbuffered_set PASSED                                                                                             [ 63%]
tests/test_image.py::TestEnvironmentVariables::test_in_container_set PASSED                                                                                                 [ 68%]
tests/test_image.py::TestEnvironmentVariables::test_locale_set PASSED                                                                                                       [ 73%]
tests/test_image.py::TestFileStructure::test_workspace_directory_exists PASSED                                                                                              [ 78%]
tests/test_image.py::TestFileStructure::test_precommit_alias_in_bashrc PASSED                                                                                               [ 84%]
tests/test_image.py::TestFileStructure::test_assets_directory_exists PASSED                                                                                                 [ 89%]
tests/test_image.py::TestFileStructure::test_assets_workspace_structure PASSED                                                                                              [ 94%]
tests/test_image.py::TestFileStructure::test_workspace_template_pre_commit_hooks_initialized PASSED                                                                         [100%]

==================================================================================== FAILURES =====================================================================================
_____________________________________________________________________ TestPythonEnvironment.test_uv_installed _____________________________________________________________________
tests/test_image.py:97: in test_uv_installed
    assert expected in result.stdout, (
E   AssertionError: Expected uv 0.9.13, got: uv 0.9.14
E     
E   assert '0.9.13' in 'uv 0.9.14\n'
E    +  where 'uv 0.9.14\n' = CommandResult(backend=<testinfra.backend.podman.PodmanBackend object at 0x1016402c0>, exit_status=0, command=b'uv --version', _stdout=b'uv 0.9.14\n', _stderr=b'').stdout
____________________________________________________________________ TestDevelopmentTools.test_ruff_installed _____________________________________________________________________
tests/test_image.py:121: in test_ruff_installed
    assert expected in result.stdout, (
E   AssertionError: Expected ruff 0.14.6, got: ruff 0.14.7
E     
E   assert '0.14.6' in 'ruff 0.14.7\n'
E    +  where 'ruff 0.14.7\n' = CommandResult(backend=<testinfra.backend.podman.PodmanBackend object at 0x1016402c0>, exit_status=0, command=b'ruff --version', _stdout=b'ruff 0.14.7\n', _stderr=b'').stdout
============================================================================= short test summary info =============================================================================
FAILED tests/test_image.py::TestPythonEnvironment::test_uv_installed - AssertionError: Expected uv 0.9.13, got: uv 0.9.14
FAILED tests/test_image.py::TestDevelopmentTools::test_ruff_installed - AssertionError: Expected ruff 0.14.6, got: ruff 0.14.7
========================================================================== 2 failed, 17 passed in 20.11s ==========================================================================
make: *** [test-image] Error 1

make test doesnt run the integrations. maybe because already of the version mismatch?

make test-integrations fails hard.

============================================================================= short test summary info =============================================================================
FAILED tests/test_integration.py::TestDevContainerDockerCompose::test_docker_compose_yml_image - AssertionError: Expected image to be ghcr.io/vig-os/devcontainer:dev, got: ghcr.io/vig-os/devcontainer:{{IMAGE_TAG}}
FAILED tests/test_integration.py::TestDevContainerDockerCompose::test_docker_compose_yml_placeholders_replaced - AssertionError: {{IMAGE_TAG}} placeholder not replaced in docker-compose.yml
FAILED tests/test_integration.py::TestDevContainerPlaceholders::test_image_tag_replaced - AssertionError: {{IMAGE_TAG}} placeholder not replaced in docker-compose.yml
ERROR tests/test_integration.py::TestDevContainerUserConf::test_conf_directory_files - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDevContainerUserConf::test_files_copied_to_home - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDevContainerCLI::test_ssh_github_authentication - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDevContainerCLI::test_pre_commit_hook - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDevContainerCLI::test_git_commit_ssh_signature - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDevContainerCLI::test_github_cli_authentication - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDockerComposeOverride::test_override_mount_directory_exists - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDockerComposeOverride::test_override_mount_file_accessible - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDockerComposeOverride::test_override_mount_file_readable - Failed: devcontainer up failed
ERROR tests/test_integration.py::TestDockerComposeOverride::test_override_mount_list_directory - Failed: devcontainer up failed
==================================================================== 3 failed, 33 passed, 10 errors in 48.55s =====================================================================
make: *** [test-integration] Error 1

c-vigo and others added 12 commits December 3, 2025 12:13
- Create utils.sh with cross-platform helper functions:
  - sed_inplace: Handle BSD (macOS) vs GNU (Linux) sed differences
  - run_with_timeout: Cross-platform timeout command
  - get_iso_date: Consistent ISO 8601 date formatting
  - detect_os/get_sed_type: Detection and debugging utilities

- Update build.sh:
  - Use sed_inplace for reliable template replacement
  - Improve file handling with null-delimited find
  - Add sed type detection to debug output
  - Fix shellcheck warnings

- Update push.sh:
  - Fix broken sed -i command that was failing silently on macOS
  - Use sed_inplace and get_iso_date utilities
  - Remove error suppression (2>/dev/null || true)

- Update setup.sh:
  - Replace timeout command with run_with_timeout
  - Ensures compatibility on macOS where timeout is not available

This fixes the issue where {{IMAGE_TAG}} placeholders were not being
replaced during builds on macOS systems.
- Update Makefile pull target to support REGISTRY_TEST=1 mode with --tls-verify=false
- Modify test to call podman directly instead of through make to avoid output capturing issues
- Refactor pull target to meet checkmake max body length requirement
- All 8 registry tests now pass successfully

The issue was that podman needs --tls-verify=false to communicate with insecure
local registries (localhost with dynamic ports), and this flag wasn't being passed
when pulling images in test mode.
- update test fixture
- update image content test
- refurbish tests to check for placeholders
@c-vigo

c-vigo commented Dec 3, 2025

Copy link
Copy Markdown
Contributor Author

@gerchowl may I ask for one final run of make clean && make test

c-vigo and others added 8 commits December 3, 2025 16:55
The BUILT_PLATFORMS variable was initialized as an empty string and
concatenated with a leading space, resulting in a leading space in the
final string. When iterating with `for img_tag in $BUILT_PLATFORMS`,
the leading space caused an empty string to be the first iteration
value, leading to attempts to add an empty image name to the manifest
with `podman manifest add "$REPO:latest" ""`, which would fail.

Fix by conditionally adding the space only when BUILT_PLATFORMS is not
empty, ensuring the first image tag is added without a leading space.
Add a new post-create.sh script that runs when the container is created
for the first time, allowing users to customize their setup with project-
specific dependencies and tools.

Changes:
- Add assets/workspace/.devcontainer/scripts/post-create.sh script
- Configure postCreateCommand in devcontainer.json to call the script
- Update README.md to document the new lifecycle script
- Add test_setup_scripts_exist check for post-create.sh
- Add test_devcontainer_json_post_create_command to verify configuration
- Update test_image.py to include post-create.sh in expected files list

The post-create script provides a dedicated hook for one-time setup tasks
that should run only when the container is first created, complementing
the existing initialize.sh (host-side) and post-attach.sh (runs on every
attach) lifecycle hooks.
- uv from 0.9.15 to 0.9.16
- ruff from 0.14.7 to 0.14.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Mount project in a sub-folder /workspace/project_name Issue and PR templating

2 participants