Repository navigation
ac: make apply scripts work and keep the bootstrap's output on failure - #1205
Merged
Merged
Conversation
Two gaps found while testing the ac provider end to end on macOS 26 with `container` 0.1.0: - `onctl create -a <script>` failed on every image. The apply step runs scripts through `sudo -E` and tails their log with GNU `tail --pid`; stock OCI images have no sudo (ubuntu: exit 127) and alpine's busybox tail rejects `-s 0.1`. The bootstrap now installs sudo next to sshd on every package manager branch, plus bash and coreutils on alpine, and puts the container's hostname in /etc/hosts so sudo doesn't warn "unable to resolve host" on each call. - When the init process exited, Deploy said "see `container logs <name>`" and then removed the container, so the hint pointed at nothing. The error now carries the last lines of the container's output instead. Claude-Session: https://claude.ai/code/session_01NUW51KkwXcguxMVi6t2Wwf
cdalar
enabled auto-merge (squash)
October 21, 2026 08:32
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1205 +/- ##
==========================================
+ Coverage 39.94% 41.25% +1.31%
==========================================
Files 67 69 +2
Lines 7333 7560 +227
==========================================
+ Hits 2929 3119 +190
- Misses 4404 4441 +37 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1204, from testing the
acprovider end to end on macOS 26.6.2 withcontainer0.1.0. The lifecycle (create/ls/ssh/pause/resume/destroy, non-rootac.vm.username) works as that PR describes; two things did not.onctl create -a <script>failed on every image. The apply step (tools.applyCommand) runs scripts throughsudo -Eand tails their log with GNUtail --pid -s 0.1. Stockubuntu:24.04has nosudo(exit 127) and alpine's busyboxtailrejects-s 0.1. The shipped action scripts (docker.sh, ...) callsudothemselves too. The bootstrap now installssudonext to sshd on every package-manager branch (apk/apt-get/dnf), plusbashandcoreutilson alpine, and adds the container's hostname to/etc/hostsso sudo doesn't print "unable to resolve host" on every call. Images that already ship sshd but not sudo get sudo too.container logs <name>" and then removed the container, so the hint pointed at nothing. The error now carries the last 20 lines of the container's output instead.Nothing here contradicts #1204: it promised any OCI image gets sshd on first boot and did not test
-a.Testing
go test ./...,go vet,golangci-lint run: clean. Tests updated: the bootstrap-exit test now checks the error carries the container's output (plus a no-output variant), and the bootstrap test pins the sudo/bash/coreutils installs.ubuntu:24.04andalpine:3.20: sshd listening,sudo -n truesucceeds quietly,bashpresent,tail --versionis GNU coreutils on both.onctl createwith a busybox image (no package manager): fails in ~11s, the error includes the bootstrap's own message, and no container is left behind.onctl create -athrough ssh with the new binary. After the rebuild, every ssh dial from the freshly built unsigned binary failed withconnect: no route to hostwhilessh/ncfrom the same shell reached the guest; the system log shows macOS Local Network authorization requests (tccd) for the new binary at those times, and a binary built from unchangedmainfails the same way in this terminal session. That is a host permission for the rebuilt binary, not provider behaviour; before the rebuild, the same-aflow reached the guest and failed only on the missingsudo.Not changed
onctl resumereturns as soon as the container has an address, before sshd listens; an immediateonctl sshcan time out. fc behaves the same, so left as is.createprints a green check after an apply script exits non-zero (generic to all providers).🤖 Generated with Claude Code
https://claude.ai/code/session_01NUW51KkwXcguxMVi6t2Wwf