Deploy devcontainer generator to user local bin with Ansible

This commit is contained in:
Fabio Scotto di Santolo
2026-11-15 10:27:56 +00:00
parent e2370ec91d
commit e74088e85b
6 changed files with 107 additions and 0 deletions

View File

@@ -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.

View File

@@ -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`.

View File

@@ -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"

View File

@@ -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

View File

@@ -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"

View File

@@ -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