Skip to content

ENT-14700: Added cfengine dev release commands - #292

Open
larsewi wants to merge 13 commits into
cfengine:mainfrom
larsewi:release-command
Open

larsewi wants to merge 13 commits into
cfengine:mainfrom
larsewi:release-command

Conversation

@larsewi

@larsewi larsewi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Adds three commands to release the packages built by build-in-container, for 3.30 and later. They replace the legacy release.py and sync-packages-to-s3.sh in infra, which stay in use for older LTS branches.

  • cfengine dev release copies and signs the release files, and writes the release data. Signing is reproducible.
  • cfengine dev update-repo adds a community release to the APT and YUM repositories.
  • cfengine dev publish uploads to S3.

The commits build the commands up step by step, so they can be reviewed one at a time. src/cfengine_cli/release/README.md explains how to make a release with them, and what each file does. The new release-e2e CI job recreates published releases with the real packaging and signing tools.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.22165% with 169 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.60%. Comparing base (89a64ed) to head (8103312).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/cfengine_cli/release/update_repo.py 45.87% 59 Missing ⚠️
src/cfengine_cli/release/utils.py 61.98% 46 Missing ⚠️
src/cfengine_cli/release/release.py 30.23% 30 Missing ⚠️
src/cfengine_cli/release/publish.py 73.80% 11 Missing ⚠️
src/cfengine_cli/release/release_data.py 83.87% 10 Missing ⚠️
src/cfengine_cli/dev.py 33.33% 6 Missing ⚠️
src/cfengine_cli/release/checksums.py 86.04% 6 Missing ⚠️
src/cfengine_cli/release/metadata.py 99.20% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #292      +/-   ##
==========================================
+ Coverage   55.05%   58.60%   +3.54%     
==========================================
  Files          33       45      +12     
  Lines        4299     5075     +776     
==========================================
+ Hits         2367     2974     +607     
- Misses       1932     2101     +169     
Files with missing lines Coverage Δ
src/cfengine_cli/main.py 62.40% <100.00%> (+1.08%) ⬆️
src/cfengine_cli/release/args.py 100.00% <100.00%> (ø)
src/cfengine_cli/release/build.py 100.00% <100.00%> (ø)
src/cfengine_cli/release/copy_files.py 100.00% <100.00%> (ø)
src/cfengine_cli/release/plan.py 100.00% <100.00%> (ø)
src/cfengine_cli/release/platforms.py 100.00% <100.00%> (ø)
src/cfengine_cli/release/metadata.py 99.20% <99.20%> (ø)
src/cfengine_cli/dev.py 28.35% <33.33%> (+0.77%) ⬆️
src/cfengine_cli/release/checksums.py 86.04% <86.04%> (ø)
src/cfengine_cli/release/release_data.py 83.87% <83.87%> (ø)
... and 4 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@larsewi
larsewi force-pushed the release-command branch 3 times, most recently from d72a414 to dedeac8 Compare November 27, 2026 15:48
larsewi and others added 2 commits November 27, 2026 17:13
A new command to release the packages built by build-in-container. For
now it only parses its options and prints a summary.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Reads the build output directory, with one directory per platform label,
and verifies it against its sha256sums.txt files.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@larsewi
larsewi force-pushed the release-command branch 2 times, most recently from 60dbede to 9926265 Compare November 30, 2026 10:00
larsewi and others added 7 commits November 30, 2026 15:23
Maps a build label like PACKAGES_x86_64_linux_debian_12 to how its packages
appear in a release: title, arch, classexpr and release directory, as in the
releases made by the legacy release.py. It also defines the order in which
the packages are listed on the downloads page.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Plans where each .deb, .rpm and .msi of the build will be published, its
download URL, and how it is shown in the release data. Prints the plan,
but copies nothing yet. Nightlies get no destination, as they are not
published. Instead, their URL links to the build on buildcache itself.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Plans the masterfiles tarballs, the binary tarball and the Vagrant
quickstart, and for community the source tarballs, in the same order as the
legacy release.py lists them.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Copies the planned files to the release dir. Each file is written in a
temporary directory in the output dir and then renamed, so a published file
is always complete. Existing files are skipped, so a failed run can be run
again. The output dir is locked while writing, and the disk space is checked
first.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Signs the .rpm and .deb copies with the release key. Signing is
reproducible: the signature time is the build time of the package, set from
SOURCE_DATE_EPOCH by build-in-container, so signing the same build with the
same key gives identical files.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
The formats of releases.json and the per-version documents, and the version
rules behind them: sorting, LTS branches, support dates, titles and the
latest flags. They give the same results as the legacy release.py.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Writes release-data/<project>/<version>.json with the checksums of the
published files, and adds the version to releases.json. If there is no local
releases.json yet, the published one is fetched.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@larsewi
larsewi force-pushed the release-command branch 2 times, most recently from cbe80c4 to 141b09c Compare December 2, 2026 10:28
larsewi and others added 2 commits December 2, 2026 11:38
Adds a community release to the APT and YUM repositories, and regenerates
and signs their metadata, with the same settings as the legacy release.py, as
both write to the same repositories. It adds the signed copies from the
release dir, and refuses unsigned packages.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Uploads the release to S3. --bucket test uploads the repositories to the test
bucket, to try installing from them. --bucket prod uploads the release
files, the repositories, and the release data last, so it never links to
files that are not uploaded yet. Nightlies only upload their release data.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@larsewi
larsewi force-pushed the release-command branch 2 times, most recently from ecbb431 to 2e05c2b Compare December 2, 2026 11:44
larsewi and others added 2 commits December 2, 2026 13:06
Recreates published community and enterprise releases from small fake
packages, with the real packaging and signing tools, and compares the release
data with the published one. Also checks the signatures, that signing is
reproducible, and a master nightly. Runs as its own CI job, as it needs tools
that dev machines usually lack.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Explains what the commands do, how to run them for feature and patch
releases, how the nightlies run them, and what each file is responsible for.

Ticket: ENT-14700
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@larsewi
larsewi marked this pull request as ready for review December 2, 2026 12:18
"""Return the branch of a version in releases.json.

A version number like 3.30.0 becomes 3.30.x.
Community master becomes nightly-master.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit strange. So not-community master is just master? Doesn't seem quite right.

Comment on lines +14 to +15
("community", "master", "nightly-master"),
("enterprise", "master", "master"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I wonder about this nightly-master and master like I mentioned earlier.

def _limit_to_role(project: str, hub: bool, classexpr: str) -> str:
"""Limit a classexpr to hubs or to non-hubs, where needed."""
if project == "community":
# Community has one package for both hubs and agents

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you used the term "hub" differently in the comment. Maybe better is "Community has one package for both policy servers and agents"?

https://docs.cfengine.com/docs/lts/overview/glossary/#hub

https://docs.cfengine.com/docs/lts/overview/glossary/#policy-server


# Every package in the published release-data/<project>/3.29.0.json, made by
# the legacy release.py: label, title, arch, classexpr, release_dir. Except the
# Ubuntu agent titles, which had .04.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why drop the .04? Isn't that marginally significant since there is "always" also a .10 release?

NO_CLASSEXPR = "!any"
NO_ARCH = "no arch"
# The label whose binary tarball is published, as in the legacy release.py
BINARY_TARBALL_LABEL = "PACKAGES_x86_64_linux_redhat_7"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using redhat_7 as the "oldest rpm platform" is linked to buildscripts/build-scripts/labels.txt so it might be good to mention that location here and this location there.

masterfiles_packages.append(source)
else:
masterfiles_sources.append(source)
elif source.name.startswith("cfengine-3."):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe change this to cfengine-\d. regex so we can get to 4 without remembering this line of code?

source: Path, destination: Path, output_dir: str, *, dry_run: bool
) -> None:
"""Copy source to destination unless it exists, and print what is done."""
if destination.exists():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should check the sizes or even checksums of the files instead of just existence?


def copy_files(planned: list[PlannedFile], output_dir: str, *, dry_run: bool) -> None:
"""Copy the planned files to their destinations.
"""Copy the planned files to their destinations, signing .rpm and .deb.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this far in the review so far.. stopped here in "Added signing of packages to cfengine dev release" commit. I will continue tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants