Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ jobs:
strategy:
fail-fast: false
matrix:
image: [ "debian:12", "ubuntu:24.04" ]
image:
- debian@sha256:268fb24c39bca92d326dd83ea3abebe4a3f7751c804ffef23bb6d857dd343ff8 # debian:12
- ubuntu@sha256:73b999393d07f2bf65a40373778a44dc9a6d54ad7718d29247d8ff9413c4d6a8 # ubuntu:24.04
arch: [ "amd64", "arm64" ]
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
steps:
Expand All @@ -136,7 +138,7 @@ jobs:
# an unchanged archive. The value is arbitrary here: debbuild does not
# care, and the reproducible-deb-sources job checks the reproducibility.
SOURCE_DATE_EPOCH: "1700000000"
run: make deb-sources VERSION=0.0.0-dev
run: make obs-sources VERSION=0.0.0-dev

- name: Build the specs with debbuild and check the metadata
run: make integration-test-deb-rebuild ARCH=${{ matrix.arch }} DEB_REBUILD_IMAGE=${{ matrix.image }}
Expand All @@ -161,7 +163,34 @@ jobs:
# Raises the GitHub API rate limit for the release-asset digest
# lookups the payload staging makes, as build-packages does.
GITHUB_TOKEN: ${{ github.token }}
run: make check-reproducible-deb-sources-python
run: make check-reproducible-obs-sources-python

# The same generated specs, built with rpmbuild the way OBS builds the Fedora and EL repositories, then checked by the RPM metadata tests.
rpm-source-rebuild:
strategy:
fail-fast: false
matrix:
# Fedora, and the oldest rpm the specs have to parse under.
image:
- registry.fedoraproject.org/fedora@sha256:98b558564d3510363f0f706a44b1ee9de461b030373d741c5729ae3f24d8cb26 # fedora:44
- docker.io/almalinux/9-base@sha256:2edb3541b7909af131c4ca8ae2c8cb985b20c80364e1f1230de88fb1131a0228 # almalinux/9-base
arch: [ "amd64", "arm64" ]
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
steps:
- name: Check out the codebase.
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Write the sources
env:
GITHUB_TOKEN: ${{ github.token }}
SOURCE_DATE_EPOCH: "1700000000"
run: make obs-sources VERSION=0.0.0-dev

- name: Build the specs with rpmbuild and check the metadata
run: make integration-test-obs-rpm-rebuild ARCH=${{ matrix.arch }} RPM_REBUILD_IMAGE=${{ matrix.image }}

integration-tests:
needs: build-packages
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/obs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
SOURCE_DATE_EPOCH: ${{ matrix.package.source_date_epoch }}
run: |
make otel-config-check-all
go run ./cmd/build-spec/deb -component "$COMPONENT" -output build/deb-sources
go run ./cmd/build-spec/obs -component "$COMPONENT" -output build/obs-sources

- name: Upload, build, and release
env:
Expand All @@ -183,5 +183,5 @@ jobs:
fi
fi
go run ./cmd/obs-publish -project "$obs_project" -package "$PACKAGE" \
-dir "build/deb-sources/$PACKAGE" -timeout 200m \
-dir "build/obs-sources/$PACKAGE" -timeout 200m \
-message "$PACKAGE $VERSION from $GITHUB_REPOSITORY@$SHA" "${args[@]}"
11 changes: 7 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ make srpm-container # Same, running rpmbuild in a container instead
make srpm-sources # Generated spec + vendored source tarball only
make rpm-rebuild-container # Rebuild the SRPM into binary RPMs the way COPR does
# REBUILD_IMAGE=almalinux:9 to exercise the EL rpm
make deb-sources # debbuild specs + staged source archives for OBS (build/deb-sources/<package>/), each at its upstream version
make deb-sources-<component> # Same, for one component
make check-reproducible-deb-sources-<component> # Write one component's DEB sources twice and fail unless byte-identical
make obs-sources # Unified spec (debbuild and rpmbuild) + staged source archives for OBS (build/obs-sources/<package>/), each at its upstream version
make obs-sources-<component> # Same, for one component
make check-reproducible-obs-sources-<component> # Write one component's OBS sources twice and fail unless byte-identical
make deb-rebuild-container # Build those specs with debbuild the way OBS does
# DEB_REBUILD_IMAGE=ubuntu:24.04 to exercise the Ubuntu dpkg

Expand All @@ -30,6 +30,9 @@ make python-unit-tests # sitecustomize.py unit tests (throwaway venv, no
make pyproto-unit-tests # Vendored pyproto exporter test suites (throwaway venvs, no containers)
make integration-test-metadata # Fast metadata tests (no containers)
make integration-test-deb-rebuild # Same metadata tests over the debbuild output
make obs-rpm-rebuild-container # Build the same specs with rpmbuild the way OBS does
# RPM_REBUILD_IMAGE=docker.io/almalinux/9-base to exercise the EL rpm
make integration-test-obs-rpm-rebuild # RPM metadata tests over the rpmbuild output
make integration-tests # Full E2E tests (requires Podman/Docker)
make integration-test-deb-java # Single E2E test
make integration-test-deb-lifecycle # Package lifecycle tests (preload, config, install/remove)
Expand All @@ -45,7 +48,7 @@ make clean # Remove build/
- `.copr/Makefile` — COPR "make srpm" entry point; installs the tooling and delegates to `make srpm`
- `cmd/build-packages/` — CLI entry point; calls `packaging/builder/`
- `cmd/build-spec/rpm/` — source RPM spec generation and rpmbuild payload staging
- `cmd/build-spec/deb/` — debbuild spec and pre-staged source archive per component, for the OBS DEB build
- `cmd/build-spec/obs/` — unified spec and pre-staged source archive per component, built by debbuild and rpmbuild on OBS
- `cmd/package-metadata/` — CI build plans: package images (`-target images`) and OBS uploads (`-target obs`)
- `cmd/obs-publish/` + `packaging/obs/` — OBS API client that commits one package's sources, waits for every build of that revision, and releases it (used by `.github/workflows/obs.yml`)
- `packaging/changes/` — maps changed paths to the components they affect, shared by the image and OBS workflows
Expand Down
47 changes: 32 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Every `make` invocation in this document is then `gmake` instead.
.copr/Makefile COPR "make srpm" entry point (installs the tooling, then calls make srpm)
cmd/build-packages/ CLI entry point for building .deb and .rpm packages
cmd/build-spec/rpm/ CLI entry point for generating and staging the source RPM spec
cmd/build-spec/deb/ CLI entry point for writing the debbuild specs and source archives built on OBS
cmd/build-spec/obs/ CLI entry point for writing the specs and source archives built on OBS
cmd/package-metadata/ Per-component package metadata and build plans for CI (package images, OBS)
cmd/obs-publish/ CLI entry point for uploading, building, and releasing one package on OBS
cmd/otel-config-check/ Declarative-config validator shipped inside the Python package
Expand All @@ -38,8 +38,8 @@ packaging/
components.go Per-component definitions (injector, java, nodejs, dotnet, python, meta)
download.go Upstream artifact download helpers
spec.go RPM spec generation for the COPR build (projection of components.go)
debspec.go debbuild spec generation for the OBS build, one spec per component
debsources.go OBS source archives: the payload staged for every architecture
obsspec.go Unified debbuild and rpmbuild spec generation for the OBS build, one spec per component
obssources.go OBS source archives: the payload staged for every architecture
stage.go Payload staging into a buildroot, with generated %files lists
common/ Shared assets referenced by the builder
<lang>/otel-config.yaml Language-specific declarative configuration file, shipped by that language package (valid as shipped)
Expand Down Expand Up @@ -203,9 +203,10 @@ copr-cli buildscm opentelemetry/opentelemetry-packaging \

To try a change before it is merged, point `--clone-url` and `--commit` at a fork and a branch, or submit the same command to a COPR project of your own with the same chroots.

### Building DEBs with debbuild on the Open Build Service
### Building DEBs and RPMs on the Open Build Service

DEBs have a second producer too, used by the [Open Build Service](https://build.opensuse.org/) (OBS), which builds, signs, and publishes the Debian and Ubuntu repositories.
DEBs and RPMs have a second producer too, used by the [Open Build Service](https://build.opensuse.org/) (OBS), which builds, signs, and publishes the repositories.
One spec per component serves both: OBS builds it with debbuild for the Debian and Ubuntu repositories, and with rpmbuild for the Fedora and EL ones.
OBS builds have no network access, and the Debian releases do not ship the Go version `go.mod` asks for, so nothing is compiled or downloaded there.
The payload is staged beforehand, by the same builder as every other path, and committed to OBS in the source archive.

Expand All @@ -214,27 +215,29 @@ Each is versioned by the upstream agent it ships, the version in its pin (see "U
Write the sources of every component:

```sh
make deb-sources
make obs-sources
```

Or of a single one:

```sh
make deb-sources-injector
make obs-sources-injector
```

Both write `build/deb-sources/<package>/`, the content of the OBS package of the same name, by running:
Both write `build/obs-sources/<package>/`, the content of the OBS package of the same name, by running:

```sh
go run ./cmd/build-spec/deb -output build/deb-sources
go run ./cmd/build-spec/obs -output build/obs-sources
```

`-version` overrides every component's version, for testing.

Each directory holds two files.
`<package>.spec` is a [debbuild](https://github.com/debbuild/debbuild) spec rendered from `components.go`, with nothing to build.
`<package>-<version>.tar.gz` holds the payload staged for each DEB architecture under `<arch>/root`, or once under `all/root` for an architecture-independent component, with the `%files` list for it alongside.
The spec picks the tree debbuild's `%{_arch}` names and copies it into the buildroot.
`<package>.spec` is a spec rendered from `components.go`, with nothing to build.
`<package>-<version>.tar.gz` holds the payload staged for each architecture, named by its DEB architecture, under `<arch>/root`, or once under `all/root` for an architecture-independent component.
Beside each tree are two file lists, `<component>.deb.files` and `<component>.rpm.files`: the RPM one carries `%attr` and the `%config(noreplace)` qualifiers rpmbuild needs, the DEB one does neither.
The spec picks the tree and the list for the architecture and the builder it runs under, and copies the tree into the buildroot.
The few differences between the two builders sit under `%if "%{_vendor}" == "debbuild"`; everything else, including the lifecycle scriptlets, is shared.
The archive entries, and the date in the man pages, carry the time in [`SOURCE_DATE_EPOCH`](https://reproducible-builds.org/specs/source-date-epoch/), so identical payloads give identical archives and an unchanged component is no change to commit.
Without it the archive records the current time, and the command warns.
The Python payload is the one pip writes, and pip records in every `*.dist-info/direct_url.json` the URL it installed the package from, a temporary directory that changes at every run.
Expand All @@ -246,10 +249,10 @@ Renovate bumps that pin on its own, in a PR of its own: the next upload then reb
To check that a component's sources are reproducible, write them twice with the same `SOURCE_DATE_EPOCH` and compare the two, which CI does for Python:

```sh
make check-reproducible-deb-sources-python
make check-reproducible-obs-sources-python
```

Some properties of the result differ from the nfpm packages, and are worth knowing:
Some properties of the DEBs differ from the nfpm packages, and are worth knowing:

- The DEB version is the upstream version written the way nfpm would (`1.0.0~rc.1` for `1.0.0-rc.1`), followed by a revision that OBS sets from its own commit and build counters (`-2.1`). A packaging-only change keeps the version and gets a higher revision, so it still upgrades.
- The spec sets `AutoReq: no`, so the dependencies are exactly those in `components.go`, as with nfpm.
Expand All @@ -258,7 +261,12 @@ Some properties of the result differ from the nfpm packages, and are worth knowi
- The compression follows the build distribution's `dpkg` default: xz on Debian, zstd on Ubuntu.
- The packages are not byte-reproducible: debbuild stamps the directories it creates, and the man page it recompresses, with the time of the build. The source archives are, which is what matters for OBS, where a changed archive is a rebuild.

### Building the DEB sources locally
Unlike the source RPM the COPR path produced, nothing is compiled or downloaded at build time.
The spec has no `BuildRequires`, because the payload is staged beforehand.
The spec sets the same globals the source RPM did: no debuginfo, no stripping of the prebuilt binaries, and no private libraries published as `Provides`.
`AutoReq` stays on for rpm, so the glibc symbol versions the binaries need remain install constraints.

### Building the sources locally

`make deb-rebuild-container` builds every generated spec with debbuild in a container, the way OBS does, and `make integration-test-deb-rebuild` runs the metadata tests over the result:

Expand All @@ -273,6 +281,15 @@ Keep it pinned: the specs set `%global __mkdir_p` and `%global __gzip`, macros i
That is also why the rebuild is worth running at all.
Every other assertion about this path reads the text of the generated spec, and a spec that is wrong in a way debbuild agrees with passes all of them.

`make obs-rpm-rebuild-container` builds the same specs with rpmbuild, and `make integration-test-obs-rpm-rebuild` runs the RPM metadata tests over the result:

```sh
make integration-test-obs-rpm-rebuild RPM_REBUILD_IMAGE=docker.io/almalinux/9-base
```

`RPM_REBUILD_IMAGE` defaults to Fedora 44.
The EL 9 image exercises the oldest rpm, 4.16, which has to parse the spec too.

To run debbuild by hand instead, create the `_topdir` skeleton first:

```sh
Expand Down
Loading