Skip to content

Commit 11cdcb3

Browse files
committed
Taught build host setup script how to use cf-remote or source to get cf-agent
For new platforms/archictures where quickinstall script doesn't work let's try: 1) cf-remote --version master install (in case nightlies are available) 2) build from source (limited support so far in core) Ticket: ENT-13016 Changelog: none
1 parent 9d5e41d commit 11cdcb3

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

ci/setup-cfengine-build-host.sh

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ chown -R jenkins /home/jenkins
5656

5757
echo "checking for CFEngine install..."
5858
if [ -d /var/cfengine ]; then
59-
echo "Error: CFEngine already installed on this host. Will not proceed trying to setup build host with CFEngine temporary install."
60-
exit 1
59+
echo "Found CFEngine install at /var/cfengine"
60+
if ! /var/cfengine/bin/cf-agent -V; then
61+
echo "Failed to run cf-agent -V, will exit."
62+
exit 1
63+
fi
64+
echo "Found working cf-agent. Will proceed."
6165
fi
6266

6367
function cleanup()
@@ -116,17 +120,21 @@ cd ..
116120
echo "Install any distribution upgrades"
117121
if [ -f /etc/os-release ]; then
118122
if grep rhel /etc/os-release; then
119-
yum upgrade --assumeyes
123+
yum update --assumeyes
124+
alias software='yum install --assumeyes'
120125
elif grep debian /etc/os-release; then
121126
DEBIAN_FRONTEND=noninteractive apt upgrade --yes && DEBIAN_FRONTEND=noninteractive apt autoremove --yes
127+
alias software='DEBIAN_FRONTEND=noninteractive apt install --yes'
122128
elif grep suse /etc/os-release; then
123129
zypper -n update
130+
alias software='zypper install -y'
124131
else
125132
echo "Unknown platform ID $ID. Need this information in order to update/upgrade distribution packages."
126133
exit 1
127134
fi
128135
elif [ -f /etc/redhat-release ]; then
129-
yum upgrade --assumeyes
136+
yum update --assumeyes
137+
alias software='yum install --assumeyes'
130138
else
131139
echo "No /etc/os-release or /etc/redhat-release so cant determine platform."
132140
exit 1
@@ -168,6 +176,27 @@ else
168176
bash ./quick-install-cfengine-enterprise.sh agent
169177
fi
170178

179+
# if cf-agent not installed, try cf-remote --version master
180+
if [ ! -x /var/cfengine/bin/cf-agent ]; then
181+
echo "quick install didn't install cf-agent, try cf-remote"
182+
# could try pipx or various package names for different distributions, or uv
183+
if software pipx; then
184+
pipx install cf-remote
185+
cf-remote --version master install --client localhost
186+
fi
187+
fi
188+
189+
if [ ! -x /var/cfengine/bin/cf-agent ]; then
190+
echo "quickinstall and cf-remote didn't install cf-agent, try from source"
191+
CFE_VERSION=3.26.0 # need to use an actualy release which has a checksum for masterfiles download
192+
rm -rf core # just in case we are repeating the script
193+
git clone --recursive --depth 1 https://github.com/cfengine/core
194+
(
195+
cd core
196+
./ci/install.sh
197+
)
198+
fi
199+
171200
# get masterfiles
172201
urlget https://cfengine-package-repos.s3.amazonaws.com/enterprise/Enterprise-"$CFE_VERSION"/misc/cfengine-masterfiles-"$CFE_VERSION"-1.pkg.tar.gz
173202

0 commit comments

Comments
 (0)