Skip to content

Update devcontainer to use Ansible. - #12

Merged
kenorb merged 2 commits into
masterfrom
opencode/dispatch-6e07ac-20260429144304
Apr 29, 2026
Merged

kenorb merged 2 commits into
masterfrom
opencode/dispatch-6e07ac-20260429144304

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Applied relevant changes from PR #50 to the current repository:

  1. Refactored Dev Container Provisioning:

    • Created .devcontainer/provision.yml: An Ansible playbook to handle system packages, Python requirements, and pre-commit hook installation.
    • Updated .devcontainer/devcontainer.json: Replaced postCreateCommand and shell-based onCreateCommand with a single onCreateCommand that runs the new Ansible playbook.
    • Removed obsolete configuration files: .devcontainer/apt-packages.txt and .devcontainer/requirements-ansible.txt.
  2. Optimized GitHub Workflows:

    • Updated .github/workflows/check.yml: Added paths-ignore for .devcontainer/** to prevent unnecessary workflow runs on dev container changes.

The new setup is more robust and leverages Ansible for consistent environment setup. Verification with ansible-lint passed for the new playbook.

Triggered by workflow_dispatch

New%20session%20-%202026-04-29T14%3A43%3A03.448Z
opencode session  |  github run

Co-authored-by: kenorb <kenorb@users.noreply.github.com>
@sourcery-ai

sourcery-ai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Switches devcontainer provisioning from ad-hoc shell commands to an Ansible playbook and excludes devcontainer changes from triggering the main CI workflow.

File-Level Changes

Change Details Files
Replace devcontainer shell-based provisioning with an Ansible playbook-driven setup.
  • Add provision.yml playbook to install apt packages, Python dependencies, Ansible via pipx, required Ansible collections, and pre-commit hooks in the devcontainer.
  • Update devcontainer.json to invoke the new Ansible playbook from onCreateCommand instead of using postCreateCommand and shell scripts.
  • Remove obsolete apt-packages and Ansible requirements text files that are superseded by the Ansible playbook and its requirements handling.
.devcontainer/provision.yml
.devcontainer/devcontainer.json
.devcontainer/apt-packages.txt
.devcontainer/requirements-ansible.txt
Prevent CI "check" workflow from running on devcontainer-only changes.
  • Add paths-ignore for .devcontainer/** to pull_request trigger in the check workflow configuration.
  • Add paths-ignore for .devcontainer/** to push trigger in the check workflow configuration.
.github/workflows/check.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider moving become: true from the play level down to only those tasks that actually need privilege escalation (e.g., apt and pip against system Python) so the default behavior is non-root and the playbook is easier to read and reason about.
  • In the Update apt cache task, you may want to add cache_valid_time to avoid unnecessarily refreshing the apt cache on every devcontainer provision and speed up repeated container starts.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider moving `become: true` from the play level down to only those tasks that actually need privilege escalation (e.g., `apt` and `pip` against system Python) so the default behavior is non-root and the playbook is easier to read and reason about.
- In the `Update apt cache` task, you may want to add `cache_valid_time` to avoid unnecessarily refreshing the apt cache on every devcontainer provision and speed up repeated container starts.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .devcontainer/provision.yml
@kenorb

kenorb commented Apr 29, 2026

Copy link
Copy Markdown
Member

/co ‎Add .devcontainer/README.md with relevant information.

Added comments for usage and guidelines in the Ansible playbook.
@kenorb
kenorb merged commit 96de527 into master Apr 29, 2026
2 of 5 checks passed
@kenorb
kenorb deleted the opencode/dispatch-6e07ac-20260429144304 branch April 29, 2026 15:01
@opencode-agent

Copy link
Copy Markdown
Contributor Author

fatal: couldn't find remote ref opencode/dispatch-6e07ac-20260429144304

opencode session  |  github run

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.

1 participant