-
Notifications
You must be signed in to change notification settings - Fork 0
Building
make build # -> bin/podman-api, with the required build tags
make test # unit tests
make test-integration # unit + integration; needs a real podman socketAlways prefer the Makefile targets — they carry the build tags described
below. A plain go build ./... fails on a clean machine.
The podman v5 bindings transitively pull in the container storage graph
drivers (btrfs, devicemapper) and gpgme, all of which are CGO and
need system -dev headers. Without the right tags you get:
# go.podman.io/storage/drivers/btrfs
fatal error: btrfs/version.h: No such file or directory
# github.com/proglottis/gpgme
Package gpgme was not found in the pkg-config search path.
podman-api only uses the remote libpod client, so it never needs those drivers. We exclude them and swap gpgme for a pure-Go OpenPGP implementation with three build tags:
containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper
The Makefile defines them once as TAGS and the CI workflow mirrors them as
GO_TAGS — keep the two in sync.
Note:
go test -tagscannot mix space- and comma-separated tags. BecauseTAGSis space-separated, appendintegrationwith a space ("$(TAGS) integration"), not a comma.
With the tags, no system headers are needed at all — you can build a fully static binary:
CGO_ENABLED=0 go build \
-tags "containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" \
-o podman-api ./cmd/podman-apiGOOS=linux GOARCH=amd64 go build \
-tags "containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" \
-o podman-api ./cmd/podman-api.forgejo/workflows/ci.yaml runs two jobs on the self-hosted runner:
-
lint, test, build —
go vet/gofmt -l/go test -race/go build, all withGO_TAGS, insidegolang:1.26-bookworm. nodejs is installed beforeactions/checkoutbecause the JS-based actions need anodebinary the golang image doesn't ship. -
integration (podman-in-podman) — runs rootful podman nested inside a privileged
quay.io/podman/stablecontainer and runs the-tags=integrationsuite against it.
See Troubleshooting if either job fails.
- Provisioning a Podman Host to get a target to deploy to.
- Deploying for installing the resulting binary.