fix builder on hub

This commit is contained in:
Trevor Batley 2023-09-03 08:01:23 +10:00
parent 1f5633accd
commit 35e35717c4

View File

@ -163,54 +163,59 @@ while true ; do
((BSNO=BSNO+1))
## On the HUB
# check if nfs has been installed on the hub (only need to install once)
if [ ! -s /etc/exports ] ; then
# add nfs share for koji files direcory to hub
curl $SILENT $SCRIPT_GIT/deploy-koji-nfs-server.sh > $SCRIPT_DIR/deploy-koji-nfs-server.sh
chmod o+x $SCRIPT_DIR/deploy-koji-nfs-server.sh
deploy-koji-nfs-server.sh $KOJI_BUILD_FQDN
else
# add build server to nfs exports line
echo " $KOJI_BUILD_FQDN(ro,no_root_squash)" >> /etc/exports
fi
# Add the host entry for the koji builder to the database
sudo -u kojiadmin koji add-host "$KOJI_BUILD_FQDN" "$RPM_ARCH"
# Add the host to the createrepo channel
sudo -u kojiadmin koji add-host-to-channel "$KOJI_BUILD_FQDN" createrepo
# A note on capacity
sudo -u kojiadmin koji edit-host --capacity="$KOJID_CAPACITY" "$KOJI_BUILD_FQDN"
# Generate a certificate for the builder
pushd "$KOJI_PKI_DIR"
./gencert.sh "$KOJI_BUILD_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_BUILD_FQDN"
popd
# generate a hub ssl key if there isn't one already (for scp & ssh to builders)
if [ ! -f /root/.ssh/id-rsa ] ; then
# create a ssh key on build server
mkdir -p ~/.ssh
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ""
fi
if [ $KOJI_BUILD_FQDN eq $KOJI_HUB_FQDN ] ; then
deploy-koji-builder.sh
else
## On the HUB
# check if nfs has been installed on the hub (only need to install once)
if [ ! -s /etc/exports ] ; then
# add nfs share for koji files direcory to hub
curl $SILENT $SCRIPT_GIT/deploy-koji-nfs-server.sh > $SCRIPT_DIR/deploy-koji-nfs-server.sh
chmod o+x $SCRIPT_DIR/deploy-koji-nfs-server.sh
deploy-koji-nfs-server.sh $KOJI_BUILD_FQDN
else
# add build server to nfs exports line
echo " $KOJI_BUILD_FQDN(ro,no_root_squash)" >> /etc/exports
fi
# Generate a certificate for the builder
pushd "$KOJI_PKI_DIR"
./gencert.sh "$KOJI_BUILD_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_BUILD_FQDN"
popd
# generate a hub ssl key if there isn't one already (for scp & ssh to builders)
if [ ! -f /root/.ssh/id-rsa ] ; then
# create a ssh key on build server
mkdir -p ~/.ssh
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ""
fi
## On the BUILDER
# copy the server key into authorized keys on the build server
ssh-copy-id -i ~/.ssh/id_rsa.pub $KOJI_BUILD_FQDN
# copy across the ssl keys
ssh $QUIET root@$KOJI_BUILD_FQDN mkdir $KOJI_PKI_DIR
scp $QUIET $KOJI_PKI_DIR/$KOJI_BUILD_FQDN.pem root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
scp $QUIET $KOJI_PKI_DIR/koji_ca_cert.crt root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
# copy across the parameter files (we built them on the hub)
ssh $QUIET root@$KOJI_BUILD_FQDN mkdir -p $SCRIPT_DIR
scp $QUIET $SCRIPT_DIR/globals.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/globals.sh
scp $QUIET $SCRIPT_DIR/parameters.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/parameters.sh
# pull down the required scripts
ssh $QUIET root@$KOJI_BUILD_FQDN "curl $SILENT $SCRIPT_GIT/deploy-koji-nfs-client.sh > $SCRIPT_DIR/deploy-koji-nfs-client.sh"
ssh $QUIET root@$KOJI_BUILD_FQDN "curl $SILENT $SCRIPT_GIT/deploy-koji-builder.sh > $SCRIPT_DIR/deploy-koji-builder.sh"
# make them executeable
ssh $QUIET root@$KOJI_BUILD_FQDN "chmod o+x $SCRIPT_DIR/*"
# connect to nfs share
ssh $QUIET root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-nfs-client.sh
# deploy koji builder
ssh $QUIET root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-builder.sh
done
## On the BUILDER
# copy the server key into authorized keys on the build server
ssh-copy-id -i ~/.ssh/id_rsa.pub $KOJI_BUILD_FQDN
# copy across the ssl keys
ssh $QUIET root@$KOJI_BUILD_FQDN mkdir $KOJI_PKI_DIR
scp $QUIET $KOJI_PKI_DIR/$KOJI_BUILD_FQDN.pem root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
scp $QUIET $KOJI_PKI_DIR/koji_ca_cert.crt root@$KOJI_BUILD_FQDN:$KOJI_PKI_DIR/.
# copy across the parameter files (we built them on the hub)
ssh $QUIET root@$KOJI_BUILD_FQDN mkdir -p $SCRIPT_DIR
scp $QUIET $SCRIPT_DIR/globals.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/globals.sh
scp $QUIET $SCRIPT_DIR/parameters.sh root@$KOJI_BUILD_FQDN:$SCRIPT_DIR/parameters.sh
# pull down the required scripts
ssh $QUIET root@$KOJI_BUILD_FQDN "curl $SILENT $SCRIPT_GIT/deploy-koji-nfs-client.sh > $SCRIPT_DIR/deploy-koji-nfs-client.sh"
ssh $QUIET root@$KOJI_BUILD_FQDN "curl $SILENT $SCRIPT_GIT/deploy-koji-builder.sh > $SCRIPT_DIR/deploy-koji-builder.sh"
# make them executeable
ssh $QUIET root@$KOJI_BUILD_FQDN "chmod o+x $SCRIPT_DIR/*"
# connect to nfs share
ssh $QUIET root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-nfs-client.sh
# deploy koji builder
ssh $QUIET root@$KOJI_BUILD_FQDN $SCRIPT_DIR/deploy-koji-builder.sh
done
fi
#
bootstrap-build.sh