From e74088e85b5779fcadd84debd102bf2bfea3a898 Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Sun, 15 Nov 2026 10:27:56 +0000 Subject: [PATCH] Deploy devcontainer generator to user local bin with Ansible --- AGENTS.md | 5 ++ README.md | 3 + .../devcontainer_generator/defaults/main.yml | 4 ++ .../devcontainer_generator/tasks/main.yml | 64 +++++++++++++++++++ ansible/site.yml | 9 +++ docs/project-devcontainers.md | 22 +++++++ 6 files changed, 107 insertions(+) create mode 100644 ansible/roles/devcontainer_generator/defaults/main.yml create mode 100644 ansible/roles/devcontainer_generator/tasks/main.yml diff --git a/AGENTS.md b/AGENTS.md index de13083..326580a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -612,3 +612,8 @@ validated exports of older historical data will use a dedicated Atlas NFS datase - Focused validation: `go -C cmd/devcontainer test ./...`. - Real engine builds, host credential forwarding and Fedora SELinux/Podman checks require target-host validation; do not report generator tests as runtime evidence. + +- `devcontainer_generator` builds the CLI natively on Fedora graphical desktops + and development workstations and installs it in `~/.local/bin/devcontainer`. + Validate with `ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator --check --diff`; + check mode skips compilation and binary installation explicitly. diff --git a/README.md b/README.md index d8a8918..861d517 100644 --- a/README.md +++ b/README.md @@ -900,3 +900,6 @@ Generate a reusable language environment for an existing project with `devcontainer ~/src/project --language python --agents codex,cline`. Git and selected coding-agent configuration are shared from the development host. See [profiles, host requirements and validation](docs/project-devcontainers.md). + +Deploy `~/.local/bin/devcontainer` on a Fedora desktop/workstation with +`ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator -K`. diff --git a/ansible/roles/devcontainer_generator/defaults/main.yml b/ansible/roles/devcontainer_generator/defaults/main.yml new file mode 100644 index 0000000..2916d15 --- /dev/null +++ b/ansible/roles/devcontainer_generator/defaults/main.yml @@ -0,0 +1,4 @@ +--- +devcontainer_generator_go_binary: /usr/bin/go +devcontainer_generator_install_go: true +devcontainer_generator_build_dir: "{{ user_home }}/.cache/infra/devcontainer-generator" diff --git a/ansible/roles/devcontainer_generator/tasks/main.yml b/ansible/roles/devcontainer_generator/tasks/main.yml new file mode 100644 index 0000000..9c52272 --- /dev/null +++ b/ansible/roles/devcontainer_generator/tasks/main.yml @@ -0,0 +1,64 @@ +--- +- name: Install Go compiler for the devcontainer generator + ansible.builtin.dnf: + name: golang + state: present + when: devcontainer_generator_install_go | bool + +- name: Ensure devcontainer generator directories exist + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0755" + loop: + - "{{ user_home }}/.local/bin" + - "{{ devcontainer_generator_build_dir }}" + +- name: Copy devcontainer generator sources + ansible.builtin.copy: + src: "{{ playbook_dir }}/../cmd/devcontainer/" + dest: "{{ devcontainer_generator_build_dir }}/src/" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: preserve + +- name: Build devcontainer generator for the target host + ansible.builtin.command: + argv: + - "{{ devcontainer_generator_go_binary }}" + - build + - -trimpath + - -buildvcs=false + - -o + - "{{ devcontainer_generator_build_dir }}/devcontainer" + - . + chdir: "{{ devcontainer_generator_build_dir }}/src" + become_user: "{{ username }}" + environment: + GOCACHE: "{{ devcontainer_generator_build_dir }}/go-cache" + GOTOOLCHAIN: local + GOPROXY: "off" + GOSUMDB: "off" + CGO_ENABLED: "0" + # Compilation refreshes a cached artifact; copy below reports installation changes. + changed_when: false + when: not ansible_check_mode + +- name: Install devcontainer generator in the user PATH + ansible.builtin.copy: + src: "{{ devcontainer_generator_build_dir }}/devcontainer" + remote_src: true + dest: "{{ user_home }}/.local/bin/devcontainer" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0755" + when: not ansible_check_mode + +- name: Explain devcontainer generator check-mode behavior + ansible.builtin.debug: + msg: >- + Check mode validates package and source deployment only. Compilation and + installation of {{ user_home }}/.local/bin/devcontainer require a normal run. + when: ansible_check_mode diff --git a/ansible/site.yml b/ansible/site.yml index 7e99ddf..99c6e1c 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -152,3 +152,12 @@ roles: - profile_workstation_dev_wsl + +- name: Deploy project devcontainer generator + hosts: platform_fedora + become: true + tags: [devcontainer_generator] + + roles: + - role: devcontainer_generator + when: "'graphical_desktop' in group_names or 'workstation_dev_fedora' in group_names" diff --git a/docs/project-devcontainers.md b/docs/project-devcontainers.md index 36cefda..0f7456c 100644 --- a/docs/project-devcontainers.md +++ b/docs/project-devcontainers.md @@ -17,6 +17,28 @@ devcontainer ~/src/my-project --language python --agents codex,cline devcontainer ~/src/my-project --language c-cpp --agents none ``` +## Ansible deployment + +On ikaros, nymph or deadalus, from the local `infra` checkout: + +```sh +ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator -K +``` + +Replace the limit with `nymph` or `deadalus` as appropriate. The task installs +Fedora's Go compiler, copies the sources into the user's build cache, compiles +natively without downloading Go modules, and installs `~/.local/bin/devcontainer` +with mode `0755`. Subsequent runs update the executable only when its contents +change. Rebuilds use the Go cache. The role targets Fedora graphical desktops +and Fedora development workstations; it does not start any containers. + +Check mode validates packages and source deployment but skips compilation and +binary installation, and reports that limitation explicitly: + +```sh +ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator --check --diff +``` + Profiles: `c-cpp`, `go`, `rust`, `python`, `node`, `java`, `infra`. They generate `.devcontainer/devcontainer.json` and `Dockerfile`. Open the project in local VS Code (in Fedora WSL on deadalus) and choose **Reopen in Container**. The generator