refactor: move custom images into lib/azk-image.sh #80
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/azkaban!80
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/custom-image-lib"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The launcher
bin/azkabanhad grown past 2000 lines, a third of which isthe custom image subsystem: the approval of workspace Dockerfiles, tag
selection, base refresh, and the reuse and build of the per-workspace
images. Nothing else in the dispatcher reads that code's internals, and
it moves as one piece, so keeping it in the dispatcher mixed two
concerns in one file. The subsystem now lives in its own trusted
runtime library beside the host library, and the dispatcher keeps only
its call site.
This is a behavior-preserving refactor: what a launch shows, the engine
it invokes, the exit codes it returns, the approval records it writes,
and the images it builds stay exactly as before.
What changed
bin/azkabanintothe new
lib/azk-image.sh(441 lines, byte-identical block), with aheader stating its trusted-runtime status, in the style of
lib/azk-host.sh. The_azk_prefix and the shared helpers inbin/azkaban(_azk_die,_azk_find_runtime_file, and friends)stay where they are.
bin/azkabanlocates the file with_azk_find_runtime_file lib azk-image.sh 'image library'and sourcesit inside
_azk_mainright after the host library, because the movedfunctions read and set that function's locals. The loader is the same
fail-closed, symlink-rejecting, runtime-directory-anchored one the
host library uses, so the new file is only ever loaded as trusted
runtime code.
make_installed_runtimecopies it,
assert_publishedchecks it among the published runtimefiles, and
test_dispatch.shgains the missing and symlinkedimage-library cases on the host-library pattern.
AGENTS.mdand the trusted-code paragraph ofdocs/development.mdnow describe
lib/as holding the host-tool shims, the engineprobes, and the custom image subsystem.
install.shneeds no change: it already stageslib/whole andsyntax-checks and chmods it through
lib/*.shglobs.How to verify
From a fresh checkout of this branch (
refactor/custom-image-lib,tip
01e9109; basemasterataaf5ddb); no prerequisites beyond aBash with ShellCheck available, as
docs/development.mddescribes:make test TESTS=dispatchruns 13 tests with 0 failures, includingtest_missing_runtime_owned_image_library_is_rejectedandtest_symlinked_runtime_owned_image_library_is_rejected, whichdelete or symlink the installed
lib/azk-image.shand require thelaunch to abort with the matching diagnostic and no Podman
invocation. On the base, with only this branch's
test_dispatch.shcopied over, both fail with
unexpectedly succeeded, because thedispatcher there never looks for the file.
already pin it:
make test TESTS=custom_image_approval(9),custom_image_naming(3),custom_image_failures(5),custom_image_shared(11), andauto_pull(9) all pass with thesame counts on base and tip.
make test TESTS=install_publicationpasses 5/5 on the tip; on thebase, with the branch's
tests/helpers.shandtests/integration/install_helpers.shcopied over, the tests thatreach the new entry fail only on
the release lib/azk-image.sh differs from the source, because thefile does not exist there.
Checks already run on the tip:
make lint && .agents/hooks/shellcheck.sh repo && make testexits 0, with 330 tests and 0 failures (the baseruns 328; the difference is the two new dispatch tests). The networked
release gate
make test-e2ewas not run: it needs real rootless Podmanand stays outside verification; nothing the change touches reaches the
container build, so its result is expected to be unchanged.
Considerations
_azk_main's locals, so the library must besourced inside that function rather than at the top of the
dispatcher; the two new dispatch tests pin that loading contract from
the outside.
commit's subject was 54 characters against the 50-character rule and
was amended to 46 before this pull request.