From f044b867dcf81408cfc332d33e4fdfa1b4ab4c47 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Tue, 20 Jan 2026 09:01:39 -0600 Subject: [PATCH 1/3] Adjusted build host script to allow for pre-seeded image and cf-remote failures rhel-10 pre-seeded image failed due to masterfiles download using cf-remote without trying to install cf-remote. suse-12 failed due to cf-remote install failing. Ticket: ENT-13483 Changelog: none --- ci/setup-cfengine-build-host.sh | 82 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/ci/setup-cfengine-build-host.sh b/ci/setup-cfengine-build-host.sh index 736652bca..314be6a98 100755 --- a/ci/setup-cfengine-build-host.sh +++ b/ci/setup-cfengine-build-host.sh @@ -126,52 +126,43 @@ if grep 6.10 /etc/issue; then urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-3.24.3/misc/cfengine-masterfiles-3.24.3-1.pkg.tar.gz fi -if [ -x /var/cfengine/bin/cf-agent ]; then - echo "Case of pre-installed CFEngine so skipping cf-remote install and assuming download of masterfiles earlier in the script." -else - echo "Installing cf-remote for possible package install and masterfiles download" - # try pipx first for debian as pip won't work. - # If that fails to install CFEngine then try python3-pip for redhats. - PIP="" - software python3-venv || true # on ubuntu-20 this is needed, debian-12 it is not but won't hurt - if software pipx; then - PIP=pipx - export PATH=$HOME/.local/bin:$PATH - elif software python3-pip; then - if command -v pip; then - PIP=pip - elif command -v pip3; then - PIP=pip3 - fi - elif software python-pip; then - if command -v pip; then - PIP=pip - fi - else - echo "Tried installing pipx, python3-pip and python-pip, none of which resulted in pipx, pip3 or pip being available. Exiting." - exit 23 +echo "Installing cf-remote for possible package install and masterfiles download" +# try pipx first for debian as pip won't work. +# If that fails to install CFEngine then try python3-pip for redhats. +PIP="" +software python3-venv || true # on ubuntu-20 this is needed, debian-12 it is not but won't hurt +if software pipx; then + PIP=pipx + export PATH=$HOME/.local/bin:$PATH +elif software python3-pip; then + if command -v pip; then + PIP=pip + elif command -v pip3; then + PIP=pip3 fi - export PATH=/usr/local/bin:$PATH # some pip/pipx use /usr/local/bin - - $PIP uninstall cf-remote || true # just in case a previous is there and would cause the install to fail - $PIP install cf-remote - - if ! command -v cf-remote; then - echo "cf-remote was not installed, it is required so exiting now" - exit 42 +elif software python-pip; then + if command -v pip; then + PIP=pip fi +else + echo "Tried installing pipx, python3-pip and python-pip, none of which resulted in pipx, pip3 or pip being available. Exiting." + exit 23 +fi +export PATH=/usr/local/bin:$PATH # some pip/pipx use /usr/local/bin - echo "Checking for pre-installed CFEngine (chicken/egg problem)" - # We need a cf-agent to run build host setup policy and redhat-10-arm did not have a previous package to install. - if ! /var/cfengine/bin/cf-agent -V; then - echo "No existing CFEngine install found, try cf-remote..." - if [ -n "$DEBIAN_STRETCH" ]; then - _VERSION="--version 3.21.8" - else - _VERSION="--version master" - fi - cf-remote --log-level info $_VERSION install --clients localhost || true +$PIP uninstall cf-remote || true # just in case a previous is there and would cause the install to fail +$PIP install cf-remote || true # if this fails we will try to install from source + +echo "Checking for pre-installed CFEngine (chicken/egg problem)" +# We need a cf-agent to run build host setup policy and redhat-10-arm did not have a previous package to install. +if ! /var/cfengine/bin/cf-agent -V; then + echo "No existing CFEngine install found, try cf-remote..." + if [ -n "$DEBIAN_STRETCH" ]; then + _VERSION="--version 3.21.8" + else + _VERSION="--version master" fi + cf-remote --log-level info $_VERSION install --clients localhost || true fi if [ ! -x /var/cfengine/bin/cf-agent ]; then @@ -188,7 +179,12 @@ fi # download masterfiles if not already present (such as in case of centos-6 above, hard-coded 3.24.3 download) if ! ls cfengine-masterfiles*gz; then - cf-remote download masterfiles --output-dir . + # if we are using a CFEngine pre-installed (chicken/egg) image we would skip cf-remote install so need to download directly + if ! command -v cf-remote; then + urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-3.27.0/misc/cfengine-masterfiles-3.27.0-1.pkg.tar.gz + else + cf-remote download masterfiles --output-dir . + fi fi tar xf cfengine-masterfiles-*tar.gz cp -a masterfiles/* /var/cfengine/inputs/ From a307b7f42ceb8f2568230fae9f41136ef6e0f446 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Tue, 20 Jan 2026 09:47:16 -0600 Subject: [PATCH 2/3] Added special case for SUSE-12 build host setup where cf-remote cannot be installed Ticket: ENT-13483 Changelog: none --- ci/setup-cfengine-build-host.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ci/setup-cfengine-build-host.sh b/ci/setup-cfengine-build-host.sh index 314be6a98..40b26c769 100755 --- a/ci/setup-cfengine-build-host.sh +++ b/ci/setup-cfengine-build-host.sh @@ -126,6 +126,20 @@ if grep 6.10 /etc/issue; then urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-3.24.3/misc/cfengine-masterfiles-3.24.3-1.pkg.tar.gz fi +if grep suse /etc/os-release; then + if grep -i version=\"12 /etc/os-release; then + echo "SUSE-12 found, cf-remote cannot be installed here so download directly similar to CentOS-6." + if [ ! -x /var/cfengine/bin/cf-agent ]; then + urlget https://cfengine-package-repos.s3.amazonaws.com/pub/gpg.key + rpm --import gpg.key + rm -rf cfengine-nova*rpm + urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-3.24.3/agent/agent_suse12_x86_64/cfengine-nova-3.24.3-1.suse12.x86_64.rpm + zypper in -y cfengine-nova-3.24.3-1.suse12.x86_64.rpm + fi + urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-3.24.3/misc/cfengine-masterfiles-3.24.3-1.pkg.tar.gz + fi +fi + echo "Installing cf-remote for possible package install and masterfiles download" # try pipx first for debian as pip won't work. # If that fails to install CFEngine then try python3-pip for redhats. From b50ed2336e2903feeb5816b7bbb37369536fb625 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Tue, 20 Jan 2026 09:58:28 -0600 Subject: [PATCH 3/3] Adjusted build host script to use latest LTS instead of master with cf-remote install I had used master as a way to get rhel-10-arm but considering that master nightlies are unstable/unreliable we should use the latest LTS instead. Ticket: none Changelog: none --- ci/setup-cfengine-build-host.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/setup-cfengine-build-host.sh b/ci/setup-cfengine-build-host.sh index 40b26c769..1be303a1d 100755 --- a/ci/setup-cfengine-build-host.sh +++ b/ci/setup-cfengine-build-host.sh @@ -174,7 +174,7 @@ if ! /var/cfengine/bin/cf-agent -V; then if [ -n "$DEBIAN_STRETCH" ]; then _VERSION="--version 3.21.8" else - _VERSION="--version master" + _VERSION="" fi cf-remote --log-level info $_VERSION install --clients localhost || true fi