Skip to content

ENT-13777: Added container-based CFEngine package builder#2146

Open
larsewi wants to merge 1 commit intocfengine:masterfrom
larsewi:container
Open

ENT-13777: Added container-based CFEngine package builder#2146
larsewi wants to merge 1 commit intocfengine:masterfrom
larsewi:container

Conversation

@larsewi
Copy link
Copy Markdown
Contributor

@larsewi larsewi commented Mar 19, 2026

  • Added build-in-container, a Python/Docker-based build tool that builds CFEngine packages inside containers using the existing build scripts
  • Supports Debian/Ubuntu platforms (ubuntu-20, ubuntu-22, ubuntu-24, debian-11, debian-12) with incremental builds via named Docker volumes. Currently only ubuntu-20 is tested (see ticket ENT-13777).

See build-in-container.md for full documentation.

@cf-bottom
Copy link
Copy Markdown

Thanks for submitting a pull request! Maybe @craigcomstock can review this?

@larsewi larsewi marked this pull request as ready for review March 25, 2026 15:31
Copy link
Copy Markdown
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

Looks good overall, some comments and suggestions here and there.

@@ -0,0 +1,362 @@
#!/usr/bin/env python3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC craig said we already have a script for this, which is used in GH Actions. Might be good to align this, maybe delete the old one and start using the new one if appropriate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yepp, he probably means enterprise/ci/docker-build-package.sh. Although this script also runs tests, which we are trying to separate.

We can replace it after adding SFTP cache support to build-in-container.py.

Comment on lines +91 to +99
# === Build steps ===
run_step "01-autogen" "$BASEDIR/buildscripts/build-scripts/autogen"
run_step "02-install-dependencies" "$BASEDIR/buildscripts/build-scripts/install-dependencies"
if [ "$EXPLICIT_ROLE" = "hub" ]; then
run_step "03-mission-portal-deps" install_mission_portal_deps
fi
run_step "04-configure" "$BASEDIR/buildscripts/build-scripts/configure"
run_step "05-compile" "$BASEDIR/buildscripts/build-scripts/compile"
run_step "06-package" "$BASEDIR/buildscripts/build-scripts/package"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like we should rename build-scripts folder to steps / build-steps 😅.


ENV DEBIAN_FRONTEND=noninteractive

# Build tools extracted from ci/cfengine-build-host-setup.cf (debian|ubuntu section)
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, it would be sad to copy/paste that content here so that now we have to maintain two locations again.


# Hub build tools: Node.js 20 LTS (system nodejs is too old for modern npm
# packages that use the node: protocol), PHP, and Composer
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
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.

would be nice to stick with individual scripts we can maintain with new versions like https://github.com/cfengine/buildscripts/blob/master/ci/linux-install-jdk21.sh


PLATFORMS = {
"ubuntu-20": {
"base_image": "ubuntu:20.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.

Ideally we would have a two-tiered approach here so we can automate and cache:

  • the base image + updates, cache that
  • the patched base image + build dependencies, cache that

Introduced build-in-container, a Python/Docker-based build system that
builds CFEngine packages inside containers using the existing build
scripts.

Ticket: ENT-13777
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
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.

4 participants