Skip to content

fix(image): run lifecycle commands inside the container via bash - #205

Merged
c-vigo merged 3 commits into
feature/70-remote-devc-orchestrationfrom
bugfix/204-postattach-error-crun-getcwd
Feb 25, 2026
Merged

c-vigo merged 3 commits into
feature/70-remote-devc-orchestrationfrom
bugfix/204-postattach-error-crun-getcwd

Conversation

@c-vigo

@c-vigo c-vigo commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Description

Ensure devcontainer lifecycle hooks execute reliably in downstream workspaces by invoking hook scripts through /bin/bash in devcontainer.json. Add integration coverage for all three lifecycle commands (postCreate, postStart, postAttach) so command format regressions are caught by tests.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • assets/workspace/.devcontainer/devcontainer.json
    • Update postCreateCommand, postStartCommand, and postAttachCommand to run scripts via /bin/bash.
    • Keep existing script paths unchanged while making command execution more robust.
  • tests/test_integration.py
    • Update expectations for postAttachCommand and postCreateCommand to include /bin/bash.
    • Add test_devcontainer_json_post_start_command to validate postStartCommand uses the same bash-wrapped format.
  • CHANGELOG.md
    • Add an Unreleased ### Fixed entry for issue #204 describing the lifecycle-command fix and user-visible error resolved.

Changelog Entry

Fixed

  • Devcontainer lifecycle commands fail in mock-up folders with crun getcwd error (#204)
    • Run post-create, post-start, and post-attach commands via /bin/bash in devcontainer.json for stable command resolution on attach
    • Prevent attach-time failure where OCI runtime reports getcwd: No such file or directory
    • Update tests in test-integration.py

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

Added/updated integration assertions in tests/test_integration.py:

  • postAttachCommand expected value includes /bin/bash
  • postCreateCommand expected value includes /bin/bash
  • new postStartCommand assertion

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 (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • 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

Closes #204

Refs: #204

Pointing directly to the script file sometimes leads to execution problems.

Refs: #204
Update `post_create` and `post_attach` tests
Add missing `post_start` test

Refs: #204
@c-vigo c-vigo linked an issue Feb 25, 2026 that may be closed by this pull request
3 tasks
@c-vigo
c-vigo merged commit afc668f into feature/70-remote-devc-orchestration Feb 25, 2026
1 check passed
@c-vigo
c-vigo deleted the bugfix/204-postattach-error-crun-getcwd branch February 25, 2026 14:16
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.

[BUG] postAttachCommand fails in mock-up workspace with crun getcwd error

1 participant