kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Migrate kolibri-installer-debian into the Python monorepo

Open rtibbles opened this issue 5 months ago • 10 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Migrate kolibri-installer-debian from its standalone repo into platforms/ as a uv workspace member. It builds the Kolibri .deb (Launchpad PPAs + the self-hosted APT repo), not a wheel. Unlike kolibri-server, it is not being deprecated — it's the base Debian/Ubuntu installer for real users, so its publish path must migrate seamlessly.

Follows the kolibri-server migration (#14964) and the apt.learningequality.org APT repo (#14965) under #13720.

Complexity: High (publish CI) · Target branch: develop

Context

Standalone repo:

  • debian/ packaging, Dockerfile, Makefile, copy_from_pkg.sh, CHANGELOG (packaging changelog).
  • build_tools/: generate_changelog.py, manage_python.py, build.sh, python_versions.env.
  • scripts/: launchpad_copy.py, create_lp_creds.py.
  • pyproject.toml — version = "0.1.0", requires-python ≥3.10, deps distro-info + packaging, test extras pytest + vcrpy.
  • tests/.

The .deb version is generated from the Kolibri version (generate_changelog.py) plus a -0ubuntuN packaging-revision knob. The build_deb.yml and prerelease.yml reusables take a Kolibri tarball input (tar-url/tar-file-name).

main bundles a python-build-standalone interpreter into the .deb (debian#157). The monorepo builds the .deb from the v0.16.1 packaging (ref: v0.16.1), so migrating main changes the shipped .deb.

Publish CI:

  • prerelease.yml (reusable): build signed source → dput to kolibri-proposed → wait → copy to all supported Ubuntu series → wait.
    • Secrets: GPG_SIGNING_KEY, GPG_PASSPHRASE, LP_CREDENTIALS.
  • release_ppa.yml (reusable): promote kolibri-proposed → stable kolibri PPA.
  • release_ppa.yml also force-pushes a reprepro repo to gh-pages via a GitHub App token (LE_BOT_APP_ID/LE_BOT_PRIVATE_KEY).
  • Both check out repository: learningequality/kolibri-installer-debian by name.

Build / validation CI:

  • build_deb.yml (reusable): binary .deb, or the source package with source-package: true.
  • build_deb.yml is called …@v0.18.0 by the monorepo's pr_build_kolibri.yml and release_kolibri.yml deb jobs.
  • install_test.yml (reusable): installs the .deb across Ubuntu 16.04–24.04, arm64, no system python3, and an upgrade from 0.19.5.
  • pr_build.yml (on: pull_request): the only caller of install_test.yml and of the source-package build.
  • test.yml (pytest).
  • PR scaffolding, dependabot.yml.

Tooling shared with kolibri-server (platforms/debian-server/scripts/):

  • debian's launchpad_copy.py hardcodes kolibri-source (source) / kolibri (binary) and targets the current LTS via distro_info.
  • server's takes --package and targets the runner's series (lsb_release), as does its changelog's distribution.
  • debian's changelog generator builds the full history from GitHub releases + CHANGELOG.
  • server's renders a single entry from KOLIBRI_VERSION.

kolibri-server's postinst sources platforms/apt-repo/migrate-apt-source.sh to move github.io APT sources to apt.learningequality.org.

The Change

  • Move the repo into platforms/debian/.
  • Migrate the source repo's main as the baseline, bundled interpreter included.
  • Register it as a uv workspace member (shared lockfile), following platforms/debian-server/pyproject.toml: requires-python = ">=3.6, <3.15", [dependency-groups], package = false, ruff extend.
  • Preserve git history via git filter-repo --to-subdirectory-filter + merge --allow-unrelated-histories.
  • Migrate prerelease/release_ppa, keeping the Kolibri-tarball input (tar-url/tar-file-name).
  • Drop every cross-repo checkout of learningequality/kolibri-installer-debian.
  • Replace release_ppa's gh-pages job with a call to platform-apt-repo-publish.yml (deb-artifact-name).
  • Drop the LE_BOT_* secrets and the debian-repo-signing-key-id input.
  • Call debian's prerelease → promote → platform-apt-repo-publish.yml from release_kolibri.yml, mirroring server_release.
  • Install migrate-apt-source.sh with the kolibri package and call migrate_kolibri_apt_source from kolibri.postinst on configure, as server does.
  • Make seed_old_pages.sh create gh-pages from conf/distributions.in when the target repo has none (kolibri-server's Pages is workflow-deployed, with no branch).
  • Migrate build_deb.yml and install_test.yml.
  • Point the deb jobs in pr_build_kolibri.yml and release_kolibri.yml at the local build_deb.yml, dropping the @v0.18.0 pin and ref: v0.16.1.
  • Add the source-package build and install_test.yml to pr_build_kolibri.yml, against the PR's own .deb.
  • Do not migrate pr_build.yml.
  • Dedup onto debian's launchpad_copy.py, parameterized by source and binary package name.
  • Both packages target the current LTS.
  • Server's release workflow drops runner-series detection for the changelog distribution, wait-for-published and copy-to-series.
  • Dedup onto debian's changelog generator; server's copy is removed.
  • Collapse duplicated PR scaffolding and dependabot.yml into the monorepo's copies.
  • Prefix-name migrated workflow files (platform-debian-*.yml).
  • Add debian's pytest tests/ as a row in tox.yml's platform_tests matrix.

Out of Scope

  • Migrating other installers — separate per-repo tasks under #13720.
  • Archiving the source repo.
  • server/debian package consolidation — tracked in #141.
  • Building the .deb from the source tree instead of the Kolibri tarball input.
  • Arch-specific bundled Python in PPA builds (debian#158).
  • Behavioural changes to the Launchpad release DAG beyond the LTS targeting above.
  • Admin/infra (secrets, release environment, running seed_old_pages.sh for the cutover, unarchiving kolibri-server and switching its Pages source to gh-pages, transferring issues and open PR debian#100) — tracked on #13720.
  • Making the build/validation CI blocking — the WHL smoke-test fan-in remains the sole blocking gate.

Acceptance Criteria

Code migration

  • [ ] Content of the source repo's main at platforms/debian/.
  • [ ] One launchpad_copy.py + one changelog generator remain; server's copies gone.
  • [ ] Server's Launchpad pipeline uses them and targets the current LTS.
  • [ ] No workflow references learningequality/kolibri-installer-debian.
  • [ ] History + git blame preserved.
  • [ ] Passes pre-commit without per-file ignores.

Workspace integration

  • [ ] uv workspace member under uv sync --group dev --all-packages.

Publish / release pipeline

  • [ ] release_kolibri.yml runs debian's Launchpad prerelease (to kolibri-proposed, multi-series) and promote (proposed→stable).
  • [ ] release_kolibri.yml passes debian's built .deb to platform-apt-repo-publish.yml.
  • [ ] The gh-pages push and LE_BOT_* secrets are removed.
  • [ ] seed_old_pages.sh seeds a repo with no gh-pages branch, producing a signed stable repo holding the given .deb.

Build / validation CI

  • [ ] build_deb.yml and install_test.yml migrated and prefix-named.
  • [ ] pr_build_kolibri.yml and release_kolibri.yml deb jobs call build_deb.yml locally; no @v0.18.0 or ref: v0.16.1.
  • [ ] pr_build_kolibri.yml runs the source-package build and install_test.yml.
  • [ ] pr_build.yml is not migrated.
  • [ ] debian's pytest tests/ runs as a platform_tests row, in stage2_required_checks's needs:.
  • [ ] Duplicated PR scaffolding collapsed.

Runtime

  • [ ] The monorepo .deb passes every install_test.yml leg.
  • [ ] Upgrading kolibri rewrites an existing github.io/kolibri-installer-debian source to apt.learningequality.org.
  • [ ] The postinst leaves a Launchpad-PPA source untouched.
  • [ ] apt install kolibri from apt.learningequality.org works after installing kolibri-archive-keyring.

References

  • Source repository: https://github.com/learningequality/kolibri-installer-debian
  • uv workspaces: https://docs.astral.sh/uv/concepts/projects/workspaces/

AI usage

Used Claude Code to draft this issue from the migration-framework design; I drove scope and decisions. Claude read the source repo's workflows, Makefile and launchpad_copy.py, and compared them against the migrated platforms/debian-server/ and platforms/apt-repo/ on develop.

rtibbles avatar Jul 05 '26 00:07 rtibbles

Plan: Move kolibri-installer-debian main into platforms/debian/ with history, run its build/test/publish CI from the monorepo, and dedup the Launchpad tooling kolibri-server copied from it.

  • [ ] Import the source repo's history
  • [ ] Wire platforms/debian as a workspace member
  • [ ] Collapse duplicated scaffolding
  • [ ] One changelog generator
  • [ ] One launchpad_copy.py; server's Launchpad pipeline on it
  • [ ] Build and install-test the .deb from the monorepo
  • [ ] kolibri migrates github.io APT sources on configure
  • [ ] Launchpad publish and APT-repo publish from release_kolibri.yml
  • [ ] Seed a Pages repo that has no gh-pages branch
  • [ ] Self-review the produced code

Assumptions — the issue did not settle these; say so if one is wrong.

  • The shared generator heads the changelog with the build version, synthesizing an entry for non-release versions; if wrong, PR source-package builds fail on the orig-tarball name.
  • The generator drops GitHub releases newer than the build version; if wrong, a PR into an old release branch versions its .deb as a newer release.
  • kolibri-server's committed debian/changelog gets every Kolibri release after 0.5.1 prepended at build; if a single-entry changelog is wanted, the generator needs a no-history mode.
  • Debian's prerelease runs only for final releases, after block_release_step, mirroring server_release; if Kolibri betas should reach kolibri-proposed, drop its if.
  • A second release-environment approval sits between debian's prerelease and promote; if unwanted, promote runs as soon as all series publish.
  • One LP_CREDENTIALS serves both pipelines despite differing APP_NAMEs; if launchpadlib rejects that, one pipeline's login fails until credentials are regenerated.
  • The migration assertion runs only in the install test's upgrade leg; if fresh installs need it too, add it to every leg.

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Oct 01 '26 22:10 rtibblesbot

@rtibbles Blocked — these cannot be assumed either way:

  • Plan Task 9 (seed_old_pages.sh creating gh-pages when missing) and the platforms/apt-repo/README.md / platform-apt-repo-publish.yml:53-55 comment updates from Tasks 7–8 touch files outside this branch's diff, which the review pass may not modify. Land them on this branch anyway, or in a follow-up PR?

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Oct 02 '26 00:10 rtibblesbot

Land them on this branch anyway, please.

rtibbles avatar Oct 02 '26 00:10 rtibbles

@rtibbles Blocked — these cannot be assumed either way:

  • The kolibri .deb on this branch is ~155 MB (two bundled Pythons), over GitHub's 100 MiB per-file limit, so seed_old_pages.sh --repo kolibri-installer-debian cannot push to that repo's gh-pages. Pick one: ship a cutover .deb under 100 MiB for this repo, or move that site to an actions/deploy-pages artifact like kolibri-server's.

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Oct 02 '26 14:10 rtibblesbot

We will make both sites a deploy-pages action - we will need to update both actions on those repositories to just take the URL of a deb file to deploy, so that we can do the manual cutover once.

rtibbles avatar Oct 02 '26 15:10 rtibbles

@rtibbles Blocked — these cannot be assumed either way:

  • Nothing calls seed_old_pages.sh now that both old sites deploy from a .deb URL, yet the AC "seed_old_pages.sh seeds a repo with no gh-pages branch" still requires its create path. Drop the script, its test and that AC, or keep them?

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Oct 02 '26 15:10 rtibblesbot

I think as long as the updates to those repos also handle the cutover that seed_old_pages was responsible for, then we can drop it all.

rtibbles avatar Oct 02 '26 16:10 rtibbles

@rtibbles Blocked — these cannot be assumed either way:

  • Betas now upload to kolibri-proposed (as you asked), so an older-line patch shipped mid-beta (e.g. 0.19.6 after 0.20.0b1) is rejected there and never reaches the stable kolibri PPA. Accept that, or skip betas in deb_prerelease?

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Oct 02 '26 23:10 rtibblesbot

@rtibbles Blocked — these cannot be assumed either way:

  • Pi image zips now take the .deb's Debian version (kolibri-pi-image-0.20.0~alpha1.zip, was …-0.20.0a1.zip). The fix is in platforms/raspberry-pi/Makefile:69 / platform-pi-build_img.yml, outside this PR's files. Fix it on this branch, or file a follow-up?

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Oct 02 '26 23:10 rtibblesbot

Fix in this branch, this is absolutely fine!

rtibbles avatar Oct 03 '26 01:10 rtibbles