From 47c9b98ea3fb91833d6d0847fa4345fa23593a97 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 13 Nov 2026 21:32:38 +0000 Subject: container: the host, built from the program's own install The image is two stages: one compiles, runs the suite and installs into a staging root, the other is the host and receives that staging root whole. The reason for the copy-whole is that the paths in the image are then the paths `make install` produces - including the hook symlink and its relative target - rather than a second list of destinations kept in a Dockerfile, which is how an image and a build start to disagree about where the hook is. The build stage is Alpine so the binary is musl-linked like the rest of the runtime image; a glibc binary would fail as "no such file" about a file that is plainly there. `make test` runs in that stage, so an image built from a tree whose tests fail does not get to exist. The lighttpd config, sshd config, CGI shim, cgitrc and the two operator tools come from the shell implementation, with the comments corrected: there is no refcheck any more, and the hook the comments point at is now a symlink to this binary. Nothing about the wiring changed, which is the point - the C program drops into a host that was already built around one hook and one policy file. --- ci/build.yaml | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 ci/build.yaml (limited to 'ci') diff --git a/ci/build.yaml b/ci/build.yaml new file mode 100644 index 0000000..e8db98c --- /dev/null +++ b/ci/build.yaml @@ -0,0 +1,88 @@ +resources: +- name: repo + type: git + source: + uri: ssh://git@git.jnsn.dev:52502/~/git-host-c.git + branch: main + private_key: ((vbump.repo-key)) +- name: final-image + type: registry-image + icon: docker + source: + repository: registry.jnsn.dev/git-host-c + username: ((vbump.username)) + password: ((vbump.password)) + tag: latest + +jobs: +- name: update-pipeline + plan: + - get: repo + trigger: true + - set_pipeline: self + file: repo/ci/build.yaml + +# The whole point of a C rewrite was to have one binary with no moving parts, so +# the gate is: compile it under the strictest warnings the compiler has, run the +# unit suite and the behavioural suite, and run both again under the sanitizers. +# Alpine, because that is the libc the image is built against - a suite that +# passes against glibc and segfaults on musl has told us nothing. +# +# The container suite (../git-host-integration) is deliberately not here: it +# needs a container runtime inside the build, and a suite that fails because the +# sandbox cannot mount an overlay is not a signal about the policy. +- name: test + plan: + - get: repo + trigger: true + - task: build-and-test + config: + platform: linux + image_resource: + type: registry-image + source: + repository: alpine + tag: "3.22" + inputs: + - name: repo + run: + path: sh + args: + - -ec + - | + apk add --no-cache build-base git >/dev/null + cd repo + make clean + make WARN="-Wall -Wextra -Wpedantic -Werror" 2>&1 | tail -3 + make test | tail -1 + make clean + make sanitizer | tail -1 + printf 'install: ' + make install DESTDIR=/tmp/stage >/dev/null && \ + readlink /tmp/stage/usr/local/share/git-host/hooks/pre-receive + +- name: build-container + plan: + - get: repo + trigger: true + passed: [test] + privileged: true + config: + platform: linux + image_resource: + type: registry-image + source: + repository: concourse/oci-build-task + inputs: + - name: repo + outputs: + - name: image + params: + CONTEXT: repo + DOCKERFILE: repo/container/Dockerfile + UNPACK_ROOTFS: "true" + run: + path: build + - put: final-image + params: + image: image/image.tar -- cgit v1.2.3