Skip to content

Disable Ubuntu unattended-upgrades in image build; fix Pages root clean - #141

Merged
maxknv merged 2 commits into
mainfrom
ubuntu-unattended-upgrades-and-pages-clean
Aug 21, 2026
Merged

Disable Ubuntu unattended-upgrades in image build; fix Pages root clean#141
maxknv merged 2 commits into
mainfrom
ubuntu-unattended-upgrades-and-pages-clean

Conversation

@maxknv

@maxknv maxknv commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Bake unattended-upgrades removal (and disable the apt-daily* timers) into _ubuntu_setup_component, before its first apt-get. This stops stock Ubuntu background upgrades from holding the dpkg lock during the image build and, once the AMI is baked, at runner boot. Every Ubuntu image builder routes through this component, so scaffold-generated projects inherit the fix — no per-project workaround needed.
  • Bump the shared recipe_version (1.0.161.0.17) so a fresh AMI is actually built (baked component content changed; all recipes share the one version and must bump together).
  • Fix GH.publish_to_pages when clearing the Pages root: preserve the worktree's own .git link while removing its contents, otherwise the directory stops being a git working tree and every later git command fails.

Notes

  • purge carries || true and runs under the Image Builder set -e context, so a missing package or transient apt failure won't abort the build.

Bake `unattended-upgrades` removal into the Ubuntu image setup component so
stock background apt/snap upgrades can't hold the dpkg lock -- both during
the image build (racing our own apt-get) and, once the AMI is baked, at
runner boot (racing the agent's first heartbeat). Applies to every Ubuntu
image builder, including scaffold-generated ones. Bumps the shared recipe
version so a fresh AMI is built.

Also fix GH.publish_to_pages clearing the Pages root: preserve the
worktree's own .git link when cleaning, otherwise it stops being a git
working tree and every later git command fails.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@praktika-gh

praktika-gh Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Workflow [Praktika CI Advanced], commit [b7a8001]

Summary:


Code Review

Result: ⚠️ Issues found

What changed: Disables Ubuntu background apt upgrade units during image baking, adds a global dpkg lock timeout, purges unattended-upgrades, and bumps the shared image recipe version. It also preserves the Git worktree metadata when cleaning the root of a GitHub Pages publication.

GitHub Pages root cleaning

  • Root publication can still fail when the existing Pages branch contains a symbolic link to a directory, because Path.is_dir() follows the link while shutil.rmtree() rejects directory symlinks.

Comment thread praktika/infrastructure/native/image_builder.py
Address review: `systemctl disable --now <timer>` stops the timer unit only,
not the apt-daily{,-upgrade}.service instance a timer may have already
activated -- which keeps holding the dpkg lock. Stop those service units
explicitly, and set DPkg::Lock::Timeout globally via apt.conf.d so the purge
and the following apt-get update wait out any residual run instead of failing
instantly on a held lock (previously the timed-out purge was swallowed by
`|| true` and the lockless `apt-get update` then aborted the build).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread praktika/gh.py
for item in worktree.iterdir():
if item.name == ".git":
continue
if item.is_dir():

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.

Path.is_dir() follows symlinks, but shutil.rmtree() raises OSError: Cannot call rmtree on a symbolic link. Therefore, publishing with destination_dir="" and clean_destination=True fails if the existing Pages root contains a tracked symlink to a directory. Check item.is_symlink() first and unlink it, using rmtree only for real directories.

@maxknv
maxknv merged commit c8b359f into main Aug 21, 2026
22 checks passed
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