Move ci scripts to hifi repo

This commit is contained in:
Clement 2019-07-12 14:03:09 -07:00
parent 34908e54ef
commit 54a2619b70
9 changed files with 136 additions and 0 deletions

View file

@ -0,0 +1,5 @@
#!/bin/bash
if ! systemctl is-active <%= service %>
then
systemctl start <%= service %>
fi

View file

@ -0,0 +1,17 @@
#!/bin/bash
dpkg -s <%= service %> &>/dev/null
if [ $? -ne 0 ]
then
if systemctl is-active <%= service %>
then
# Stop service that is running
systemctl stop <%= service %>
fi
fi
[ $(getent group hifi) ] || groupadd hifi
id -u hifi &>/dev/null || useradd hifi -g hifi --system --no-create-home
mkdir -p /.local && chown root:hifi /.local && chmod 775 /.local
mkdir -p /.config && chown root:hifi /.config && chmod 775 /.config
mkdir -p /var/log/hifi && chown root:hifi /var/log/hifi && chmod 775 /var/log/hifi
mkdir -p /usr/share/hifi/assignment-client && chown root:hifi /usr/share/hifi/assignment-client && chmod 775 /usr/share/hifi/assignment-client

View file

@ -0,0 +1,6 @@
#!/bin/bash
if systemctl is-active <%= service %>
then
# Stop service that is running
systemctl stop <%= service %>
fi

View file

@ -0,0 +1,17 @@
#!/bin/bash
dpkg -s <%= service %> &>/dev/null
if [ $? -ne 0 ]
then
if systemctl is-active <%= service %>
then
# Stop service that is running
systemctl stop <%= service %>
fi
fi
[ $(getent group hifi) ] || groupadd hifi
id -u hifi &>/dev/null || useradd hifi -g hifi --system --no-create-home
mkdir -p /.local && chown root:hifi /.local && chmod 775 /.local
mkdir -p /.config && chown root:hifi /.config && chmod 775 /.config
mkdir -p /var/log/hifi && chown root:hifi /var/log/hifi && chmod 775 /var/log/hifi
mkdir -p /usr/share/hifi/domain-server && chown root:hifi /usr/share/hifi/domain-server && chmod 775 /usr/share/hifi/domain-server

View file

@ -0,0 +1,12 @@
[Unit]
Description=Assignment client service for High Fidelity server
After=network.target
[Service]
Restart=always
WorkingDirectory=/usr/share/hifi/assignment-client
Environment="LD_LIBRARY_PATH=/usr/share/hifi/assignment-client/"
ExecStart=/bin/bash -c 'ulimit -c unlimited; /usr/share/hifi/assignment-client/assignment-client -n 7 2>&1 >> /var/log/hifi/assignment-client.log'
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,13 @@
[Unit]
Description=Domain Server service for High Fidelity
After=network.target
[Service]
Restart=on-failure
WorkingDirectory=/usr/share/hifi/domain-server
Environment="LD_LIBRARY_PATH=/usr/share/hifi/domain-server/"
ExecStartPre=/bin/bash -c 'if /usr/bin/pgrep -l domain-server; then /usr/bin/pkill -SIGKILL -f /usr/share/hifi/domain-server/domain-server; fi'
ExecStart=/bin/bash -c 'ulimit -c unlimited; /usr/share/hifi/domain-server/domain-server 2>&1 >> /var/log/hifi/domain-server.log'
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,14 @@
[Unit]
Description=Ice Server service for High Fidelity
After=network.target
[Service]
Restart=on-failure
Environment="HIFI_ENVIRONMENT=production"
WorkingDirectory=/usr/share/hifi/ice-server
ExecStartPre=/bin/bash -c 'if /usr/bin/pgrep -l ice-server; then /usr/bin/pkill -SIGKILL -f /usr/share/hifi/ice-server/ice-server; fi'
ExecStart=/bin/bash -c 'ulimit -c unlimited; /usr/share/hifi/ice-server/ice-server 2>&1 >> /var/log/hifi/ice-server.log'
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,17 @@
#!/bin/bash
dpkg -s <%= service %> &>/dev/null
if [ $? -ne 0 ]
then
if systemctl is-active <%= service %>
then
# Stop service that is running
systemctl stop <%= service %>
fi
fi
[ $(getent group hifi) ] || groupadd hifi
id -u hifi &>/dev/null || useradd hifi -g hifi --system --no-create-home
mkdir -p /.local && chown root:hifi /.local && chmod 775 /.local
mkdir -p /.config && chown root:hifi /.config && chmod 775 /.config
mkdir -p /var/log/hifi && chown root:hifi /var/log/hifi && chmod 775 /var/log/hifi
mkdir -p /usr/share/hifi/ice-server && chown root:hifi /usr/share/hifi/ice-server && chmod 775 /usr/share/hifi/ice-server

View file

@ -0,0 +1,35 @@
#!/bin/bash -l
prefix=${1:-""}
declare -a packages_systemd=("assignment-client" "domain-server" "ice-server")
cd ./build
for package_name in "${packages_systemd[@]}"
do
SOURCE_DESTINATION_LIST="${WORKSPACE}/build/${package_name}/${package_name}=/usr/share/hifi/${package_name}/ "
if [ "$package_name" == "domain-server" ]; then
DESCRIPTION="High Fidelity Domain server."
SOURCE_DESTINATION_LIST+="${WORKSPACE}/build/${package_name}/resources/=/usr/share/hifi/${package_name}/resources "
SOURCE_DESTINATION_LIST+="${WORKSPACE}/build/ext/makefiles/quazip/project/build/libquazip5.so.1.0.0=/usr/share/hifi/${package_name}/libquazip5.so.1"
elif [ "$package_name" == "assignment-client" ]; then
DESCRIPTION="High Fidelity Assignment clients. Services target a local domain server. Different assignment clients are managed independently with systemd."
SOURCE_DESTINATION_LIST+="${WORKSPACE}/build/${package_name}/plugins/=/usr/share/hifi/${package_name}/plugins "
SOURCE_DESTINATION_LIST+="${WORKSPACE}/build/ext/makefiles/quazip/project/build/libquazip5.so.1.0.0=/usr/share/hifi/${package_name}/libquazip5.so.1 "
SOURCE_DESTINATION_LIST+="${WORKSPACE}/build/${package_name}/oven=/usr/share/hifi/${package_name}/oven"
elif [ "$package_name" == "ice-server" ]; then
DESCRIPTION="High Fidelity ICE server."
fi
fpm -s dir -t deb -n hifi-${prefix}${package_name} -v ${VERSION} -d hifiqt5.12.3 --vendor "High Fidelity Inc" -m "<ops@highfidelity.com>" \
--url "https://highfidelity.com" --license "Apache License 2.0" --description "${DESCRIPTION}" -d libgomp1 -d libtbb2 -d libgl1-mesa-glx -d libnss3 \
-d libxi6 -d libxcursor1 -d libxcomposite1 -d libasound2 -d libxtst6 -d libxslt1.1 --template-scripts --template-value "service"="hifi-${package_name}" \
--deb-systemd ${WORKSPACE}/hifi-${package_name} --before-install ${WORKSPACE}/${package_name}-before-install.sh \
--after-install ${WORKSPACE}/after-install.sh --before-remove ${WORKSPACE}/before-remove.sh \
${SOURCE_DESTINATION_LIST}
dpkg-sig --sign builder -k 15FF1AAE -g '--no-tty --passphrase "${MASKED_DEB_REPO_SIGN_PASSPHRASE}"' ./hifi-${prefix}${package_name}_${VERSION}_amd64.deb
deb-s3 upload ./hifi-${prefix}${package_name}_${VERSION}_amd64.deb --bucket debian.highfidelity.com \
--sign=15FF1AAE --gpg-options='--no-tty --passphrase "${MASKED_DEB_REPO_SIGN_PASSPHRASE}"' \
--origin hifi --suite stable -p
done