From ccb4a0daa69551594b43d4457499d725a1d41be5 Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Sun, 8 Nov 2026 21:30:41 +0100 Subject: [PATCH] Replace OpenCode Desktop with Cline and add ecaas devcontainer setup --- README.md | 32 +++-- ansible/inventory/group_vars/all.yml | 8 ++ .../inventory/group_vars/desktop_gnome.yml | 4 +- ansible/inventory/group_vars/fedora.yml | 14 +-- .../inventory/group_vars/workstation_dev.yml | 6 + ansible/inventory/host_vars/deadalus.yml | 2 + ansible/inventory/host_vars/ikaros.yml | 2 +- .../packages_fedora/tasks/cline_desktop.yml | 42 +++++++ ansible/roles/packages_fedora/tasks/main.yml | 10 +- .../tasks/opencode_desktop.yml | 42 ------- .../tasks/cline_desktop.yml | 56 +++++++++ .../profile_desktop_gnome/tasks/main.yml | 5 + .../files/ecaas-devcontainer.Dockerfile | 35 ++++++ .../tasks/ecaas_devcontainer.yml | 109 ++++++++++++++++++ .../tasks/ecaas_git.yml | 65 +++++++++++ .../tasks/main.yml | 5 + .../templates/ecaas-devcontainer.json.j2 | 47 ++++++++ ansible/templates/workstation/.gitconfig.j2 | 33 ++++-- docs/deadalus-ecaas-devcontainer.md | 86 ++++++++++++++ 19 files changed, 521 insertions(+), 82 deletions(-) create mode 100644 ansible/roles/packages_fedora/tasks/cline_desktop.yml delete mode 100644 ansible/roles/packages_fedora/tasks/opencode_desktop.yml create mode 100644 ansible/roles/profile_desktop_gnome/tasks/cline_desktop.yml create mode 100644 ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile create mode 100644 ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml create mode 100644 ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_git.yml create mode 100644 ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 create mode 100644 docs/deadalus-ecaas-devcontainer.md diff --git a/README.md b/README.md index b47d09a..683e553 100644 --- a/README.md +++ b/README.md @@ -620,34 +620,32 @@ only in the entry for the agent being removed, then run: ansible-playbook ansible/site.yml --limit deadalus --tags ai_agents --check --diff ``` -### OpenCode Desktop on Fedora +### Cline Desktop on Fedora -`packages_fedora` also installs the [official OpenCode Desktop RPM](https://opencode.ai/download) -on the Fedora/GNOME workstations `ikaros` and `nymph`. WSL, Fedora IoT, Void, -and servers are excluded. This is independent of the npm-managed OpenCode CLI; -its configuration, credentials, and lifecycle flags remain unchanged. +The [official Cline Desktop RPM](https://cline.bot/desktop) is managed on the +Fedora/GNOME workstations `ikaros` and `nymph`. WSL, Fedora IoT, Void and servers +are excluded. The GNOME profile pins `Cline.desktop` in the position of an old +OpenCode favorite, or appends it if there was no OpenCode favorite. Other +favorites keep their order. Run the playbook from an active GNOME session. The version and per-architecture SHA-256 digests are pinned in `ansible/inventory/group_vars/fedora.yml`; update both together from the official -[GitHub release](https://github.com/anomalyco/opencode/releases). -Confirm the current Desktop version through the official download page, not -GitHub's `/releases/latest` endpoint alone: on 2026-11-01 the official RPM download -resolved to 2.2.5 while GitHub's `latest` still selected 1.19.5. The 1.x Desktop -can reject free models and require an upgrade. Desktop is pinned to 2.2.5; -the separately managed CLI remains unchanged. -Upstream RPMs are unsigned, so only this DNF task disables signature checking, -after verifying the downloaded RPM against its pinned checksum. No repository -signature policy is changed. Set `opencode_desktop_enabled: false` to stop managing -installation without uninstalling the application. +[Desktop release](https://github.com/cline/cline/releases/tag/desktop-v0.0.49). +Only the checksum-verified local RPM installation disables DNF signature +checking; no repository policy is changed. The Cline VS Code extension and +npm-managed CLIs are independent of this app. ```bash -ansible-playbook ansible/site.yml --limit ikaros --tags opencode_desktop --check --diff -ansible-playbook ansible/site.yml --limit ikaros --tags opencode_desktop -K +ansible-playbook ansible/site.yml --limit ikaros --tags cline_desktop --check --diff +ansible-playbook ansible/site.yml --limit ikaros --tags cline_desktop -K ``` Run locally on each workstation (`ansible_connection: local`); use `--limit nymph` on the laptop. With a cold RPM cache, check mode reports that dependency resolution is not validated; the real run downloads, verifies, and installs the package. +Once Cline is installed, any previously installed OpenCode Desktop RPM can be +retired once with `sudo rpm -e opencode`. This does not remove the npm CLI or +user data; package removal is not part of ongoing convergence. ### Thunderbird iCloud profile on Fedora diff --git a/ansible/inventory/group_vars/all.yml b/ansible/inventory/group_vars/all.yml index 622f803..8fabfb9 100644 --- a/ansible/inventory/group_vars/all.yml +++ b/ansible/inventory/group_vars/all.yml @@ -103,6 +103,9 @@ gemini_cli_deploy_enabled: true gemini_cli_uninstall_enabled: false claude_code_install_enabled: false claude_code_uninstall_enabled: true +cline_install_enabled: true +cline_deploy_enabled: false +cline_uninstall_enabled: false # npm registry requests can be interrupted transiently. Keep retries bounded # so persistent proxy, DNS, or registry failures still fail the play clearly. @@ -140,6 +143,11 @@ ai_agents: install_enabled: "{{ gemini_cli_install_enabled }}" deploy_enabled: "{{ gemini_cli_deploy_enabled }}" uninstall_enabled: "{{ gemini_cli_uninstall_enabled }}" + cline: + npm_package: cline + install_enabled: "{{ cline_install_enabled }}" + deploy_enabled: "{{ cline_deploy_enabled }}" + uninstall_enabled: "{{ cline_uninstall_enabled }}" github_copilot: npm_package: "@github/copilot" install_enabled: false diff --git a/ansible/inventory/group_vars/desktop_gnome.yml b/ansible/inventory/group_vars/desktop_gnome.yml index a9af0dd..631172e 100644 --- a/ansible/inventory/group_vars/desktop_gnome.yml +++ b/ansible/inventory/group_vars/desktop_gnome.yml @@ -4,7 +4,8 @@ desktop_environment: gnome desktop_sessions_enabled: [] desktop_default_session: gnome emacs_enabled: true -opencode_desktop_enabled: true +cline_desktop_enabled: true +cline_desktop_launcher: Cline.desktop # Fedora Workstation/GNOME desktop applications. Keep this profile separate from # workstation_* so nymph can remain a desktop laptop rather than a dev workstation. @@ -139,5 +140,6 @@ vscode_extensions: - ms-vscode.remote-server - redhat.vscode-xml - redhat.vscode-yaml + - saoudrizwan.claude-dev - vscodevim.vim vscode_settings: null diff --git a/ansible/inventory/group_vars/fedora.yml b/ansible/inventory/group_vars/fedora.yml index 4523039..1f305ba 100644 --- a/ansible/inventory/group_vars/fedora.yml +++ b/ansible/inventory/group_vars/fedora.yml @@ -63,14 +63,14 @@ fedora_dev_packages: fedora_flatpak_remote_name: flathub fedora_flatpak_remote_url: https://dl.flathub.org/repo/flathub.flatpakrepo -opencode_desktop_version: "2.2.5" +cline_desktop_version: "0.0.49" # Digests published with the official GitHub release; update with the version. -opencode_desktop_rpm_checksums: - x86_64: sha256:4feb27fe98df9b7579abd31a790d331e9aff87c95f67081beefa2aaaa76ebada - aarch64: sha256:e84b1e03e2b4fb337ddfe015b6457a7aa0dfe171338be08e643ad66b1657033a -opencode_desktop_rpm_url: >- - https://github.com/anomalyco/opencode/releases/download/v{{ opencode_desktop_version }}/opencode-desktop-linux-{{ ansible_facts['architecture'] }}.rpm -opencode_desktop_rpm_path: "/var/cache/opencode-desktop-{{ opencode_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm" +cline_desktop_rpm_checksums: + x86_64: sha256:e10036a036ee531451695559e2c96feceb3d621408a6615bdd708ffcf9e778ab + aarch64: sha256:aec36edb594bdc400b0c2275230f29de6814a78ad60add4938347d20cfb93b74 +cline_desktop_rpm_url: >- + https://github.com/cline/cline/releases/download/desktop-v{{ cline_desktop_version }}/Cline_{{ cline_desktop_version }}_{{ ansible_facts['architecture'] }}.rpm +cline_desktop_rpm_path: "/var/cache/cline-desktop-{{ cline_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm" chatgpt_desktop_enabled: false chatgpt_desktop_supported_fedora_versions: diff --git a/ansible/inventory/group_vars/workstation_dev.yml b/ansible/inventory/group_vars/workstation_dev.yml index d6a6dc2..e7d8187 100644 --- a/ansible/inventory/group_vars/workstation_dev.yml +++ b/ansible/inventory/group_vars/workstation_dev.yml @@ -1,6 +1,12 @@ --- emacs_enabled: true +workstation_git_https_cas: + - url: https://gitlab.ecaas.datacenter.comune.roma + certificate: ecaas.datacenter.comune.roma.crt + - url: https://gitlab.datacenter.comune.roma + certificate: datacenter.comune.roma.crt + workstation_user_directories: - path: "{{ user_home }}/.config" mode: "0755" diff --git a/ansible/inventory/host_vars/deadalus.yml b/ansible/inventory/host_vars/deadalus.yml index 259431b..9813c31 100644 --- a/ansible/inventory/host_vars/deadalus.yml +++ b/ansible/inventory/host_vars/deadalus.yml @@ -1,6 +1,8 @@ --- hostname: deadalus workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO +workstation_ecaas_workspace: "{{ user_home }}/Work/ecaas" +workstation_ecaas_git_required_ca: ecaas.datacenter.comune.roma.crt # Codex is not installed or configured on WSL; remove the managed npm package. codex_install_enabled: false diff --git a/ansible/inventory/host_vars/ikaros.yml b/ansible/inventory/host_vars/ikaros.yml index 45698bc..0e796a4 100644 --- a/ansible/inventory/host_vars/ikaros.yml +++ b/ansible/inventory/host_vars/ikaros.yml @@ -254,7 +254,7 @@ gnome_gsettings_settings: - schema: org.gnome.shell key: favorite-apps value: >- - ['org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'com.spotify.Client.desktop', 'net.thunderbird.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'chatgpt.desktop', 'ai.opencode.desktop.desktop', 'com.microsoft.VSCode.desktop', 'org.gnome.Ptyxis.desktop', 'virt-manager.desktop'] + ['org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'com.spotify.Client.desktop', 'net.thunderbird.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'chatgpt.desktop', 'Cline.desktop', 'com.microsoft.VSCode.desktop', 'org.gnome.Ptyxis.desktop', 'virt-manager.desktop'] - schema: org.gnome.shell key: remember-mount-password value: "true" diff --git a/ansible/roles/packages_fedora/tasks/cline_desktop.yml b/ansible/roles/packages_fedora/tasks/cline_desktop.yml new file mode 100644 index 0000000..6d9d326 --- /dev/null +++ b/ansible/roles/packages_fedora/tasks/cline_desktop.yml @@ -0,0 +1,42 @@ +--- +- name: Validate Cline Desktop architecture on Fedora + ansible.builtin.assert: + that: + - ansible_facts['architecture'] in cline_desktop_rpm_checksums + fail_msg: "No verified Cline Desktop RPM for {{ ansible_facts['architecture'] }}." + +- name: Check for cached Cline Desktop RPM + ansible.builtin.stat: + path: "{{ cline_desktop_rpm_path }}" + get_checksum: false + register: cline_desktop_rpm_cache + +- name: Download verified Cline Desktop RPM + ansible.builtin.get_url: + url: "{{ cline_desktop_rpm_url }}" + dest: "{{ cline_desktop_rpm_path }}" + checksum: "{{ cline_desktop_rpm_checksums[ansible_facts['architecture']] }}" + owner: root + group: root + mode: "0644" + # get_url only sends HEAD in check mode and cannot populate a cold cache. + when: not ansible_check_mode + +- name: Install Cline Desktop on Fedora + ansible.builtin.dnf: + name: "{{ cline_desktop_rpm_path }}" + state: present + # Upstream ships an unsigned RPM. The download above verifies its pinned + # SHA-256; do not disable signature checks in system repository settings. + disable_gpg_check: true + when: not ansible_check_mode or cline_desktop_rpm_cache.stat.exists + +- name: Explain Cline Desktop cold-cache check-mode limitation + ansible.builtin.debug: + msg: >- + A real run will download and SHA-256 verify Cline Desktop + {{ cline_desktop_version }} before ensuring it is installed. + The RPM is not cached, so this dry run cannot validate DNF dependencies. + when: + - ansible_check_mode + - not cline_desktop_rpm_cache.stat.exists diff --git a/ansible/roles/packages_fedora/tasks/main.yml b/ansible/roles/packages_fedora/tasks/main.yml index eb40952..ab2e422 100644 --- a/ansible/roles/packages_fedora/tasks/main.yml +++ b/ansible/roles/packages_fedora/tasks/main.yml @@ -168,12 +168,12 @@ loop_control: label: "{{ item.key }}" -- name: Manage OpenCode Desktop on Fedora graphical workstations - tags: [packages, opencode_desktop] - ansible.builtin.import_tasks: opencode_desktop.yml +- name: Manage Cline Desktop on Fedora GNOME workstations + tags: [packages, cline_desktop] + ansible.builtin.import_tasks: cline_desktop.yml when: - - "'graphical_desktop' in group_names" - - opencode_desktop_enabled | default(false) | bool + - "'desktop_gnome' in group_names" + - cline_desktop_enabled | default(false) | bool - name: Validate ChatGPT desktop architecture on Fedora tags: [packages, chatgpt] diff --git a/ansible/roles/packages_fedora/tasks/opencode_desktop.yml b/ansible/roles/packages_fedora/tasks/opencode_desktop.yml deleted file mode 100644 index ec32e20..0000000 --- a/ansible/roles/packages_fedora/tasks/opencode_desktop.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- name: Validate OpenCode Desktop architecture on Fedora - ansible.builtin.assert: - that: - - ansible_facts['architecture'] in opencode_desktop_rpm_checksums - fail_msg: "No verified OpenCode Desktop RPM for {{ ansible_facts['architecture'] }}." - -- name: Check for cached OpenCode Desktop RPM - ansible.builtin.stat: - path: "{{ opencode_desktop_rpm_path }}" - get_checksum: false - register: opencode_desktop_rpm_cache - -- name: Download verified OpenCode Desktop RPM - ansible.builtin.get_url: - url: "{{ opencode_desktop_rpm_url }}" - dest: "{{ opencode_desktop_rpm_path }}" - checksum: "{{ opencode_desktop_rpm_checksums[ansible_facts['architecture']] }}" - owner: root - group: root - mode: "0644" - # get_url only sends HEAD in check mode and cannot populate a cold cache. - when: not ansible_check_mode - -- name: Install OpenCode Desktop on Fedora - ansible.builtin.dnf: - name: "{{ opencode_desktop_rpm_path }}" - state: present - # Upstream ships an unsigned RPM. The download above verifies its pinned - # SHA-256; do not disable signature checks in system repository settings. - disable_gpg_check: true - when: not ansible_check_mode or opencode_desktop_rpm_cache.stat.exists - -- name: Explain OpenCode Desktop cold-cache check-mode limitation - ansible.builtin.debug: - msg: >- - A real run will download and SHA-256 verify OpenCode Desktop - {{ opencode_desktop_version }} before ensuring it is installed. - The RPM is not cached, so this dry run cannot validate DNF dependencies. - when: - - ansible_check_mode - - not opencode_desktop_rpm_cache.stat.exists diff --git a/ansible/roles/profile_desktop_gnome/tasks/cline_desktop.yml b/ansible/roles/profile_desktop_gnome/tasks/cline_desktop.yml new file mode 100644 index 0000000..652e6da --- /dev/null +++ b/ansible/roles/profile_desktop_gnome/tasks/cline_desktop.yml @@ -0,0 +1,56 @@ +--- +- name: Find the installed Cline Desktop launcher + ansible.builtin.stat: + path: "/usr/share/applications/{{ cline_desktop_launcher }}" + get_checksum: false + register: cline_desktop_launcher_stat + +- name: Verify Cline Desktop installed its expected launcher + ansible.builtin.assert: + that: cline_desktop_launcher_stat.stat.isreg | default(false) + fail_msg: "Cline Desktop did not install {{ cline_desktop_launcher }}." + when: not ansible_check_mode + +- name: Find the GNOME account for the Cline favorite + ansible.builtin.getent: + database: passwd + key: "{{ username }}" + when: cline_desktop_launcher_stat.stat.isreg | default(false) + +- name: Update only the Cline and OpenCode entries in GNOME favorites + become_user: "{{ username }}" + environment: + HOME: "{{ user_home }}" + XDG_RUNTIME_DIR: "/run/user/{{ ansible_facts.getent_passwd[username][1] }}" + DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ ansible_facts.getent_passwd[username][1] }}/bus" + when: cline_desktop_launcher_stat.stat.isreg | default(false) + block: + - name: Read the current GNOME favorites for Cline Desktop + ansible.builtin.command: + argv: [gsettings, get, org.gnome.shell, favorite-apps] + register: cline_gnome_favorites_current + changed_when: false + check_mode: false + + - name: Pin the Cline Desktop launcher without reordering other favorites + ansible.builtin.command: + argv: + - gsettings + - set + - org.gnome.shell + - favorite-apps + - "{{ cline_gnome_favorites_desired | to_json }}" + vars: + cline_gnome_favorites_existing: "{{ cline_gnome_favorites_current.stdout | regex_replace('^@as ', '') | from_yaml }}" + cline_gnome_favorites_desired: >- + {%- set ns = namespace(apps=[]) -%} + {%- for app in cline_gnome_favorites_existing -%} + {%- set launcher = cline_desktop_launcher + if app in ['ai.opencode.desktop.desktop', 'opencode-desktop.desktop'] else app -%} + {%- if launcher != cline_desktop_launcher or launcher not in ns.apps -%} + {%- set ns.apps = ns.apps + [launcher] -%} + {%- endif -%} + {%- endfor -%} + {{ ns.apps if cline_desktop_launcher in ns.apps else ns.apps + [cline_desktop_launcher] }} + when: cline_gnome_favorites_desired != cline_gnome_favorites_existing + changed_when: true diff --git a/ansible/roles/profile_desktop_gnome/tasks/main.yml b/ansible/roles/profile_desktop_gnome/tasks/main.yml index 0584903..6d5b4d1 100644 --- a/ansible/roles/profile_desktop_gnome/tasks/main.yml +++ b/ansible/roles/profile_desktop_gnome/tasks/main.yml @@ -288,3 +288,8 @@ - name: Configure native VS Code tags: [vscode] ansible.builtin.import_tasks: vscode.yml + +- name: Pin Cline Desktop in GNOME + tags: [cline_desktop] + ansible.builtin.import_tasks: cline_desktop.yml + when: cline_desktop_enabled | default(false) | bool diff --git a/ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile b/ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile new file mode 100644 index 0000000..ea80abc --- /dev/null +++ b/ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile @@ -0,0 +1,35 @@ +ARG MAVEN_VERSION=3.9.16 +FROM docker.io/library/maven:${MAVEN_VERSION}-eclipse-temurin-11 AS maven +FROM docker.io/library/node:22.23.4-bookworm-slim AS node +# Java 21 runs the language servers only. The final image keeps Java 11 on PATH. +FROM mcr.microsoft.com/devcontainers/java:21-bookworm AS ide +FROM mcr.microsoft.com/devcontainers/java:11-bookworm +USER root +COPY --from=ide /usr/lib/jvm/msopenjdk-current/ /opt/jdk-21/ +COPY --from=maven /usr/share/maven/ /usr/share/maven/ +COPY --from=node /usr/local/bin/node /usr/local/bin/node +COPY --from=node /usr/local/lib/node_modules/npm/ /usr/local/lib/node_modules/npm/ +RUN ln -s /usr/share/maven/bin/mvn /usr/local/bin/mvn \ + && ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ + && ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \ + && java -version \ + && /opt/jdk-21/bin/java -version \ + && mvn -v \ + && npm install --global --no-audit --no-fund @anthropic-ai/claude-code@2.1.312 cline@3.0.74 \ + && npm cache clean --force +RUN apt-get update \ + && apt-get install -y --no-install-recommends bash-completion ca-certificates curl fzf git git-lfs gnupg openssh-client zoxide \ + && arch="$(dpkg --print-architecture)" \ + && case "$arch" in \ + amd64) sha256=ea4f0222950ee750a3d38dd80d03bce4cee07a3f63928fc47548383bcaf23093 ;; \ + arm64) sha256=0edc36cf514f1bd84becac3e94ee8ae9f8818c6a1f99f7b2ee67b362afa253d3 ;; \ + *) echo "Unsupported architecture for delta: $arch" >&2; exit 1 ;; \ + esac \ + && curl -fsSL --retry 3 "https://github.com/dandavison/delta/releases/download/0.19.2/git-delta_0.19.2_${arch}.deb" -o /tmp/git-delta.deb \ + && echo "$sha256 /tmp/git-delta.deb" | sha256sum -c - \ + && apt-get install -y --no-install-recommends /tmp/git-delta.deb \ + && rm -rf /var/lib/apt/lists/* /tmp/git-delta.deb +COPY --chown=vscode:vscode bashrc /home/vscode/.bashrc +USER vscode +# Keep this file writable so VS Code can register its Git credential helper. +RUN git config --file /home/vscode/.gitconfig include.path /run/ecaas-git/gitconfig diff --git a/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml b/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml new file mode 100644 index 0000000..483b9ad --- /dev/null +++ b/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml @@ -0,0 +1,109 @@ +--- +- name: Refuse to deploy the ecaas workspace outside WSL + ansible.builtin.assert: + that: + - "'wsl2' in (ansible_facts.kernel | default('') | lower)" + - ansible_facts.distribution | default('') == 'Fedora' + fail_msg: Run this deployment from the Fedora WSL 2 distribution on deadalus. + +- name: Prepare the ecaas workspace and private configuration + vars: + ecaas_agent_state: "{{ user_home }}/.local/state/ecaas-devcontainer" + ecaas_git_available_cas: >- + {{ ecaas_git_ca_probe.results | selectattr('stat.isreg', 'defined') | + selectattr('stat.isreg') | map(attribute='item') | list }} + ecaas_agent_config: + - src: .claude/settings.json + dest: claude/settings.json + - src: .claude/CLAUDE.md + dest: claude/CLAUDE.md + - src: .claude/rules + dest: claude/rules + - src: .claude/skills + dest: claude/skills + - src: .config/ai/bootstrap.md + dest: ai/bootstrap.md + - src: .cline/data/globalState.json + dest: cline/data/globalState.json + - src: .cline/data/settings/global-settings.json + dest: cline/data/settings/global-settings.json + - src: .cline/rules + dest: cline/rules + - src: .cline/skills + dest: cline/skills + block: + - name: Prepare the ecaas Git configuration + ansible.builtin.import_tasks: ecaas_git.yml + + - name: Ensure the ecaas dev container directory exists + ansible.builtin.file: + path: "{{ workstation_ecaas_workspace }}/.devcontainer" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0755" + + - name: Ensure private ecaas agent state directories exist + ansible.builtin.file: + path: "{{ ecaas_agent_state }}{{ item }}" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0700" + loop: + - "" + - /ai + - /claude + - /cline + - /cline/data + - /cline/data/settings + + - name: Locate supported WSL agent configuration + ansible.builtin.stat: + path: "{{ user_home }}/{{ item.src }}" + follow: false + get_checksum: false + get_mime: false + loop: "{{ ecaas_agent_config }}" + register: ecaas_agent_config_sources + + - name: Seed missing private agent settings without importing credential stores + ansible.builtin.copy: + src: "{{ user_home }}/{{ item.item.src }}{{ '/' if item.stat.isdir | default(false) else '' }}" + dest: "{{ ecaas_agent_state }}/{{ item.item.dest }}" + remote_src: true + mode: preserve + force: false + local_follow: false + become_user: "{{ username }}" + when: + - item.stat.isreg | default(false) or item.stat.isdir | default(false) + - not ansible_check_mode + loop: "{{ ecaas_agent_config_sources.results }}" + no_log: true + diff: false + + - name: Deploy the ecaas dev container configuration + ansible.builtin.template: + src: ecaas-devcontainer.json.j2 + dest: "{{ workstation_ecaas_workspace }}/.devcontainer/devcontainer.json" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" + backup: true + + - name: Deploy the ecaas dev container build files + ansible.builtin.copy: + src: "{{ item.src }}" + dest: "{{ workstation_ecaas_workspace }}/.devcontainer/{{ item.dest }}" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" + backup: true + loop: + - src: ecaas-devcontainer.Dockerfile + dest: Dockerfile + - src: "{{ playbook_dir }}/../dotfiles/common/.bashrc" + dest: bashrc + loop_control: + label: "{{ item.dest }}" diff --git a/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_git.yml b/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_git.yml new file mode 100644 index 0000000..20d24c3 --- /dev/null +++ b/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_git.yml @@ -0,0 +1,65 @@ +--- +- name: Locate the Git CA files configured for the workstation + ansible.builtin.stat: + path: "{{ user_home }}/.local/share/certs/{{ item.certificate }}" + follow: true + get_checksum: false + get_mime: false + loop: "{{ workstation_git_https_cas }}" + loop_control: + label: "{{ item.certificate }}" + register: ecaas_git_ca_probe + +- name: Require the ecaas Git CA before deploying the dev container + ansible.builtin.assert: + that: + - workstation_ecaas_git_required_ca in (ecaas_git_available_cas | map(attribute='certificate') | list) + fail_msg: "Install the existing workstation CA at {{ user_home }}/.local/share/certs/{{ workstation_ecaas_git_required_ca }} first." + +- name: Verify the available Git CA files are public PEM certificates + ansible.builtin.shell: | + if grep -q -- 'PRIVATE KEY-----' "$ECAAS_GIT_CA"; then + exit 1 + fi + openssl x509 -in "$ECAAS_GIT_CA" -noout + environment: + ECAAS_GIT_CA: "{{ user_home }}/.local/share/certs/{{ item.item.certificate }}" + become_user: "{{ username }}" + check_mode: false + changed_when: false + when: item.stat.isreg | default(false) + loop: "{{ ecaas_git_ca_probe.results }}" + loop_control: + label: "{{ item.item.certificate }}" + +- name: Ensure the private ecaas Git configuration directory exists + ansible.builtin.file: + path: "{{ ecaas_agent_state }}/git" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0700" + +- name: Render the workstation Git configuration for the ecaas container + ansible.builtin.template: + src: "{{ playbook_dir }}/templates/workstation/.gitconfig.j2" + dest: "{{ ecaas_agent_state }}/git/gitconfig" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0600" + vars: + workstation_git_in_devcontainer: true + workstation_git_container_cas: "{{ ecaas_git_available_cas }}" + no_log: true + diff: false + +- name: Deploy the workstation Git ignore and delta theme files + ansible.builtin.copy: + src: "{{ playbook_dir }}/../dotfiles/workstation/{{ item }}" + dest: "{{ ecaas_agent_state }}/git/{{ item }}" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" + loop: + - .gitignore_global + - .themes.gitignore diff --git a/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml b/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml index 405c0b2..5220345 100644 --- a/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml +++ b/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml @@ -1,4 +1,9 @@ --- +- name: Deploy the ecaas Java 11 dev container + ansible.builtin.import_tasks: ecaas_devcontainer.yml + when: workstation_ecaas_workspace is defined + tags: [ecaas_devcontainer] + - name: Ensure Windows Emacs authoring directories exist tags: [dotfiles, dotfiles:workstation, emacs, wsl] ansible.builtin.file: diff --git a/ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 b/ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 new file mode 100644 index 0000000..f15c31e --- /dev/null +++ b/ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 @@ -0,0 +1,47 @@ +{ + "name": "ecaas — Java 11", + "build": { + "dockerfile": "Dockerfile", + "args": { + "MAVEN_VERSION": {{ workstation_mise_maven_version | to_json }} + } + }, + "remoteUser": "vscode", + "updateRemoteUserUID": true, + "containerEnv": { + "CLAUDE_CONFIG_DIR": "/home/vscode/.claude" + }, + "mounts": [ + {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/git,target=/run/ecaas-git,readonly') | to_json }}, +{% for ca in ecaas_git_available_cas %} + {{ ('type=bind,source=' ~ user_home ~ '/.local/share/certs/' ~ ca.certificate ~ ',target=/run/ecaas-git-ca/' ~ ca.certificate ~ ',readonly') | to_json }}, +{% endfor %} + {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/ai,target=/home/vscode/.config/ai,readonly') | to_json }}, + {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/claude,target=/home/vscode/.claude') | to_json }}, + {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/cline,target=/home/vscode/.cline') | to_json }} + ], + "forwardPorts": [8080], + "customizations": { + "vscode": { + "extensions": [ + "vscjava.vscode-java-pack", + "vmware.vscode-boot-dev-pack", + "redhat.vscode-xml", + "redhat.vscode-yaml", + "anthropic.claude-code", + "saoudrizwan.claude-dev" + ], + "settings": { + "java.jdt.ls.java.home": "/opt/jdk-21", + "spring-boot.ls.java.home": "/opt/jdk-21", + "java.configuration.runtimes": [ + { + "name": "JavaSE-11", + "path": "/usr/lib/jvm/msopenjdk-current", + "default": true + } + ] + } + } + } +} diff --git a/ansible/templates/workstation/.gitconfig.j2 b/ansible/templates/workstation/.gitconfig.j2 index a20b5e5..4ab9aca 100644 --- a/ansible/templates/workstation/.gitconfig.j2 +++ b/ansible/templates/workstation/.gitconfig.j2 @@ -1,8 +1,10 @@ +{% set in_container = workstation_git_in_devcontainer | default(false) %} +{% set git_support_dir = '/run/ecaas-git' if in_container else '~' %} [init] defaultBranch = main [core] - excludesfile = ~/.gitignore_global + excludesfile = {{ git_support_dir }}/.gitignore_global pager = delta [user] @@ -24,11 +26,21 @@ [merge] conflictstyle = diff3 - tool = bobide + tool = {{ 'vscode' if in_container else 'bobide' }} [mergetool] prompt = false +{% if in_container %} +[mergetool "vscode"] + cmd = code --wait --merge \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" + +[diff] + tool = vscode + +[difftool "vscode"] + cmd = code --wait --diff \"$LOCAL\" \"$REMOTE\" +{% else %} [mergetool "bobide"] cmd = bobide --reuse-window --wait $MERGED @@ -37,6 +49,7 @@ [difftool "bobide"] cmd = bobide --reuse-window --wait --diff $LOCAL $REMOTE +{% endif %} [color] ui = always @@ -79,7 +92,7 @@ gcunreachablenow = gc --prune=now [include] - path = ~/.themes.gitignore + path = {{ git_support_dir }}/.themes.gitignore [delta] features = catppuccin-mocha navigate @@ -88,14 +101,16 @@ tabs = 4 side-by-side = true -[http "https://gitlab.ecaas.datacenter.comune.roma"] +{% for ca in workstation_git_container_cas | default(workstation_git_https_cas) %} +[http "{{ ca.url }}"] +{% if not in_container %} sslBackend = openssl - sslCAInfo = ~/.local/share/certs/ecaas.datacenter.comune.roma.crt - -[http "https://gitlab.datacenter.comune.roma"] - sslBackend = openssl - sslCAInfo = ~/.local/share/certs/datacenter.comune.roma.crt +{% endif %} + sslCAInfo = {{ '/run/ecaas-git-ca' if in_container else '~/.local/share/certs' }}/{{ ca.certificate }} +{% endfor %} +{% if not in_container %} [credential] helper = store +{% endif %} diff --git a/docs/deadalus-ecaas-devcontainer.md b/docs/deadalus-ecaas-devcontainer.md new file mode 100644 index 0000000..ff3a1c7 --- /dev/null +++ b/docs/deadalus-ecaas-devcontainer.md @@ -0,0 +1,86 @@ +# ecaas Java 11 dev container on deadalus + +From the AnsiblePlaybook checkout **in Fedora WSL 2 on deadalus**: + +```sh +ansible-playbook ansible/site.yml --limit deadalus --tags ecaas_devcontainer -K +``` + +This creates `~/Work/ecaas/.devcontainer/` and deploys `devcontainer.json`, +`Dockerfile` and `bashrc`, backing up previous versions if they change. It does +not clone or modify application sources, change VS Code's Windows settings, or +start Docker containers. The Docker context selection remains in the local +WSL/VS Code setup. + +Confirm that `docker context show` is `default` and `docker info` shows the local +Fedora engine. Open `~/Work/ecaas` using `code .` from Fedora and select +**Dev Containers: Reopen in Container** (or **Rebuild Container** if already open). +Do not use the production context to build or open the workspace. + +The container uses Java 11 for the application and Maven, and Java 21 only for +the Java and Spring language servers. VS Code installs the Java and Spring Boot +extension packs, XML, YAML, Claude Code and Cline inside the container. The Java +pack includes Maven, the Java debugger and test integration. Prefer the project's +Maven wrapper where present. Node is provided for the Claude and Cline CLIs. + +Git is installed in the container. The image uses the repository's portable Bash +configuration: prompt with Git status, aliases, history search, completion, +`fzf` and `zoxide`. The image +does not load the WSL host's Mise hook, production aliases, or Bash history. +Run the deploy and rebuild the container to pick up changes to the shared Bash +configuration. + +## Git, HTTPS, and SSH + +The image provides Git, Git LFS, delta, OpenSSH and GnuPG. It includes the +managed workstation Git configuration from a read-only mount at runtime, +with VS Code rather than Bob as the diff and merge tool. Git identity and +signing configuration stay outside the workspace and image layers. + +Before deploying, ensure the existing WSL certificate +`~/.local/share/certs/ecaas.datacenter.comune.roma.crt` is available. The +playbook checks and mounts that file read-only. It also mounts +`datacenter.comune.roma.crt` from the same directory if present. These files +are scoped to their GitLab URLs in Git; the image does not disable TLS +verification or add the internal certificates to its global trust store. +Recreate the container after replacing a certificate on the host. + +Open the project from Fedora WSL so VS Code Dev Containers can reuse WSL's +HTTPS credential helper (including an existing `.git-credentials` used by +`credential.helper=store`) and forward the SSH agent if configured. GPG +signing remains enabled and needs the work key available through the GPG +agent. No credential file, SSH private key, or GPG private key is copied or +mounted by the playbook. Do not forward a production SSH identity to this +development workspace. + +To verify GitLab access from the container without changing the repo, run +`git ls-remote origin HEAD` after checking that `origin` is the expected +GitLab repository. + +## Agent configuration and smoke test + +Claude and Cline seed only the supported settings, instructions, rules and +skills present in the Fedora home into `~/.local/state/ecaas-devcontainer/` +on the host. The initial import does not overwrite existing container settings +or synchronize later changes back to WSL. Rules and skills imported from WSL +must be trusted; host paths and tools referenced by them may need adaptation. +Dedicated credential stores, provider files, VS Code global storage, and MCP +configuration are not imported. Do not embed secrets in the settings or rules +being imported. Sign in or configure providers inside the container when +prompted; legacy Cline settings kept only in VS Code are not migrated. +The state directory is private and must not be committed. Neither the Docker +socket nor the full host home is mounted. + +From the integrated terminal inside the Dev Container, verify: + +```sh +java -version +mvn -v +git --version +delta --version +claude --version +cline --version +``` + +Both Java and Maven should report Java 11. Run the project's Maven tests and +check that the Spring Boot Dashboard, Java debugger and both AI panels open.