mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-21 09:07:29 +01:00
allow web-deploy without parameters (uses hub)
This commit is contained in:
parent
1690d98814
commit
1fc2cbb24c
@ -30,26 +30,13 @@ if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
|
||||
exit 1
|
||||
fi
|
||||
source "$SCRIPT_DIR"/koji-parameters.sh
|
||||
KOJI_HUB_FQDN="$(hostname -f)"
|
||||
|
||||
# pull down any required scripts
|
||||
curl $SILENT $SCRIPT_GIT/koji-deploy-hub.sh > $SCRIPT_DIR/koji-deploy-hub.sh
|
||||
|
||||
if [ ! -d $SCRIPT_DIR ] ; then mkdir -p $SCRIPT_DIR ; fi
|
||||
|
||||
# install any required packages
|
||||
if [[ -z $(dnf list installed | grep epel-release) ]] ; then
|
||||
dnf install -y epel-release $QUIET
|
||||
fi
|
||||
if [[ -z $(dnf list installed | grep netcat) ]] ; then
|
||||
dnf install -y netcat $QUIET
|
||||
fi
|
||||
|
||||
# if no build server given, deploy locally
|
||||
if [ -z $KOJI_BUILD_FQDN ] ; then
|
||||
KOJI_BUILD_FQDN=$KOJI_HUB_FQDN
|
||||
fi
|
||||
|
||||
# check that the target exists
|
||||
RESP=$(nc -z $KOJI_BUILD_FQDN 22 2>&1 | grep succeeded)
|
||||
if [[ -z $RESP ]] ; then
|
||||
echo "I cannot connect to $KOJI_BUILD_FQDN! Is it online? "
|
||||
@ -59,6 +46,14 @@ if [[ -z $RESP ]] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install any required packages
|
||||
if [[ -z $(dnf list installed | grep epel-release) ]] ; then
|
||||
dnf install -y epel-release $QUIET
|
||||
fi
|
||||
if [[ -z $(dnf list installed | grep netcat) ]] ; then
|
||||
dnf install -y netcat $QUIET
|
||||
fi
|
||||
|
||||
## On the HUB
|
||||
# Add the host entry for the koji builder to the database
|
||||
sudo -u kojiadmin koji add-host "$KOJI_BUILD_FQDN" "$RPM_ARCH"
|
||||
@ -69,10 +64,10 @@ sudo -u kojiadmin koji edit-host --capacity="$KOJID_CAPACITY" "$KOJI_BUILD_FQDN"
|
||||
# Generate a certificate for the builder
|
||||
if [ ! -f $SCRIPT_DIR/koji-gencert.sh ] ; then
|
||||
curl $SILENT $SCRIPT_GIT/koji-gencert.sh > $SCRIPT_DIR/koji-gencert.sh
|
||||
chmod a+x $SCRIPT_DIR/koji-gencert.sh
|
||||
fi
|
||||
cp $SCRIPT_DIR/koji-gencert.sh $KOJI_PKI_DIR/.
|
||||
pushd "$KOJI_PKI_DIR"
|
||||
./koji-gencert.sh "$KOJI_BUILD_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_BUILD_FQDN"
|
||||
$SCRIPT_DIR/koji-gencert.sh "$KOJI_BUILD_FQDN" "/C=$COUNTRY_CODE/ST=$STATE/L=$LOCATION/O=$ORGANIZATION/CN=$KOJI_BUILD_FQDN"
|
||||
popd
|
||||
# check if local install or remote
|
||||
if [[ $KOJI_BUILD_FQDN = $KOJI_HUB_FQDN ]] ; then
|
||||
|
@ -2,15 +2,17 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
KOJI_WEB_FQDN=$1
|
||||
KOJI_WEB_FQDN=
|
||||
DEBUG=
|
||||
SILENT="-s"
|
||||
QUIET="-q"
|
||||
for param in $2 ; do
|
||||
for param in $1 $2 ; do
|
||||
if [ $param ] ; then
|
||||
case $param in
|
||||
debug )
|
||||
DEBUG="debug" ;;
|
||||
* )
|
||||
KOJI_WEB_FQDN=$param ;;
|
||||
esac
|
||||
else
|
||||
break
|
||||
@ -31,6 +33,10 @@ if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
|
||||
fi
|
||||
source "$SCRIPT_DIR"/koji-parameters.sh
|
||||
|
||||
# if no build server given, deploy locally
|
||||
if [[ -z $KOJI_WEB_FQDN ]] ; then KOJI_WEB_FQDN=$KOJI_HUB_FQDN ; fi
|
||||
|
||||
# check if local or remote deploy
|
||||
if [[ "$KOJI_WEB_FQDN" != "$(hostname -f)" ]] ; then
|
||||
if [[ $DEBUG ]] ; then echo "Deploying remotely to $KOJI_WEB_FQDN" ; fi
|
||||
# deploy remotely to $KOJI_WEB_FQDN
|
||||
@ -106,6 +112,7 @@ dnf install -y mod_ssl koji-web $QUIET
|
||||
# install locally
|
||||
# create secret
|
||||
SECRET="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 32)"
|
||||
# create config files
|
||||
mkdir -p /etc/kojiweb
|
||||
cat > /etc/kojiweb/web.conf <<- EOF
|
||||
[web]
|
||||
|
Loading…
Reference in New Issue
Block a user