From f8eb8462942bca95ab511e97b7839d92bc005682 Mon Sep 17 00:00:00 2001 From: Anatolii Zimovskii Date: Tue, 25 Jan 2022 20:29:02 +0300 Subject: [PATCH] testrail fixes --- linux/ecosystem/testrail/ad/Dockerfile | 14 ++++---- linux/ecosystem/testrail/ad/run.sh | 21 ++++++------ linux/ecosystem/testrail/latest/Dockerfile | 37 ++++++++++++---------- linux/ecosystem/testrail/latest/run.sh | 12 +++---- linux/ecosystem/testrail/ldap/Dockerfile | 14 ++++---- linux/ecosystem/testrail/ldap/run.sh | 18 +++++------ 6 files changed, 59 insertions(+), 57 deletions(-) diff --git a/linux/ecosystem/testrail/ad/Dockerfile b/linux/ecosystem/testrail/ad/Dockerfile index d302559d6..2d15f799a 100644 --- a/linux/ecosystem/testrail/ad/Dockerfile +++ b/linux/ecosystem/testrail/ad/Dockerfile @@ -1,13 +1,11 @@ FROM epicmorg/testrail:latest -ARG TESTRAIL_RELEASE_DIR=/testrail-release - -ARG TESTRAIL_PLUGIN_VERSION=1.4 -ARG TESTRAIL_PLUGIN_NAME=ad -ARG TESTRAIL_PLUGIN_FULLNAME=testrail-auth-${TESTRAIL_PLUGIN_NAME}-${TESTRAIL_PLUGIN_VERSION} -ARG TESTRAIL_PLUGIN_FILE=${TESTRAIL_PLUGIN_FULLNAME}.zip -ARG TESTRAIL_PLUGIN_DONWLOAD_URL=https://media.gurock.com/gk-media/downloads/${TESTRAIL_PLUGIN_FILE} -ARG TESTRAIL_PLUGIN_TEMP=${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} +ENV TESTRAIL_PLUGIN_VERSION=1.4 +ENV TESTRAIL_PLUGIN_NAME=ad +ENV TESTRAIL_PLUGIN_FULLNAME=testrail-auth-${TESTRAIL_PLUGIN_NAME}-${TESTRAIL_PLUGIN_VERSION} +ENV TESTRAIL_PLUGIN_FILE=${TESTRAIL_PLUGIN_FULLNAME}.zip +ENV TESTRAIL_PLUGIN_DONWLOAD_URL=https://media.gurock.com/gk-media/downloads/${TESTRAIL_PLUGIN_FILE} +ENV TESTRAIL_PLUGIN_TEMP=${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} RUN rm -rfv /run.sh COPY run.sh /run.sh diff --git a/linux/ecosystem/testrail/ad/run.sh b/linux/ecosystem/testrail/ad/run.sh index 020cbb26c..5bc9ee463 100755 --- a/linux/ecosystem/testrail/ad/run.sh +++ b/linux/ecosystem/testrail/ad/run.sh @@ -1,5 +1,8 @@ #!/bin/bash #set -e +#env + +################################################################################## function createOptDirectory { if [ ! -d $1 ] @@ -11,20 +14,20 @@ function createOptDirectory { chown -R www-data:www-data $1 } -/bin/cp -rf /testrail-release/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf +/bin/cp -rf ${TESTRAIL_RELEASE_DIR}/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf echo "[testrail] Unzipping testrail service" -unzip -o /testrail-release/testrail.zip -d /var/www/ +unzip -o ${TESTRAIL_RELEASE_DIR}/testrail.zip -d /var/www/ echo "[testrail] Unzipping testrail Active Directory auth plugin" -unzip -o -j /testrail-release/testrail-auth-ad-1.4.zip testrail-auth-ad-1.4/auth.php -d ${TR_CUSTOM_AUTH_DIR} +unzip -o -j ${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} ${TESTRAIL_PLUGIN_FULLNAME}/auth.php -d ${TR_CUSTOM_AUTH_DIR} -createOptDirectory $TR_DEFAULT_LOG_DIR -createOptDirectory $TR_DEFAULT_AUDIT_DIR -createOptDirectory $TR_DEFAULT_REPORT_DIR -createOptDirectory $TR_DEFAULT_ATTACHMENT_DIR +createOptDirectory ${TR_DEFAULT_LOG_DIR} +createOptDirectory ${TR_DEFAULT_AUDIT_DIR} +createOptDirectory ${TR_DEFAULT_REPORT_DIR} +createOptDirectory ${TR_DEFAULT_ATTACHMENT_DIR} -chown -R www-data:www-data /var/www/testrail/config +chown -R www-data:www-data ${TR_CONFIG_DIR} ################################################################################# @@ -38,7 +41,7 @@ done echo "[testrail] Starting background task" while /bin/true; do php /var/www/testrail/task.php || true - sleep $TR_DEFAULT_TASK_EXECUTION + sleep ${TR_DEFAULT_TASK_EXECUTION} done & echo "[testrail] Background task stoped" diff --git a/linux/ecosystem/testrail/latest/Dockerfile b/linux/ecosystem/testrail/latest/Dockerfile index 5a16bc0da..04134ec47 100644 --- a/linux/ecosystem/testrail/latest/Dockerfile +++ b/linux/ecosystem/testrail/latest/Dockerfile @@ -2,19 +2,21 @@ FROM epicmorg/apache2:php7.4 ENV TESTRAIL_VERSION=latest ENV DOWNLOAD_URL=https://secure.gurock.com/downloads/testrail/testrail-${TESTRAIL_VERSION}-ion72.zip +ENV TR_DEFAULT_TASK_EXECUTION=60 + ENV TESTRAIL_RELEASE_DIR=/testrail-release -ENV TR_DEFAULT_TASK_EXECUTION=60 -ENV TR_WWWPATH="/var/www/testrail/" -ENV TR_CONFIGPATH="/var/www/testrail/config/" -ENV TR_CUSTOM_DIR="/var/www/testrail/custom/" -ENV TR_CUSTOM_AUTH_DIR="/var/www/testrail/custom/auth/" +ENV TR_WWW_PATH=/var/www/testrail +ENV TR_CONFIG_DIR=${TR_WWW_PATH}/config +ENV TR_CUSTOM_DIR=${TR_WWW_PATH}/custom +ENV TR_CUSTOM_AUTH_DIR=${TR_CUSTOM_DIR}/auth + +ENV TR_OPT_PATH=/opt/testrail +ENV TR_DEFAULT_LOG_DIR=${TR_OPT_PATH}/logs +ENV TR_DEFAULT_AUDIT_DIR=${TR_OPT_PATH}/audit +ENV TR_DEFAULT_REPORT_DIR=${TR_OPT_PATH}/reports +ENV TR_DEFAULT_ATTACHMENT_DIR=${TR_OPT_PATH}/attachments -ENV TR_OPTPATH="/opt/testrail/" -ENV TR_DEFAULT_LOG_DIR="/opt/testrail/logs/" -ENV TR_DEFAULT_AUDIT_DIR="/opt/testrail/audit/" -ENV TR_DEFAULT_REPORT_DIR="/opt/testrail/reports/" -ENV TR_DEFAULT_ATTACHMENT_DIR="/opt/testrail/attachments/" ENV OPENSSL_CONF=/etc/ssl/ RUN \ @@ -26,16 +28,17 @@ RUN \ RUN \ - echo "WGET" && \ - mkdir -p /${TESTRAIL_RELEASE_DIR} && \ - mkdir -p /var/www/testrail && \ - mkdir -p /opt/testrail/attachments /opt/testrail/reports /opt/testrail/logs /opt/testrail/audit && \ + echo "[testrail] Preparing folders" && \ + mkdir -p ${TESTRAIL_RELEASE_DIR} && \ + mkdir -p ${TR_WWW_PATH} && \ + mkdir -p ${TR_DEFAULT_ATTACHMENT_DIR} ${TR_DEFAULT_REPORT_DIR} ${TR_DEFAULT_AUDIT_DIR} ${TR_DEFAULT_LOG_DIR} && \ + echo "[testrail] Downloading and installing" && \ wget --no-check-certificate -O ${TESTRAIL_RELEASE_DIR}/testrail.zip ${DOWNLOAD_URL} && \ chown -R www-data:www-data ${TESTRAIL_RELEASE_DIR} && \ unzip -o ${TESTRAIL_RELEASE_DIR}/testrail.zip -d /var/www/ && \ - ls -las /var/www/testrail && \ - chown -R www-data:www-data /var/www/testrail && \ - chown -R www-data:www-data /opt/testrail + ls -las ${TR_WWW_PATH} && \ + chown -R www-data:www-data ${TR_WWW_PATH} && \ + chown -R www-data:www-data ${TR_OPT_PATH} COPY apache_testrail.conf ${TESTRAIL_RELEASE_DIR}/apache-conf/000-default.conf diff --git a/linux/ecosystem/testrail/latest/run.sh b/linux/ecosystem/testrail/latest/run.sh index 85f74d885..f1b302fb0 100755 --- a/linux/ecosystem/testrail/latest/run.sh +++ b/linux/ecosystem/testrail/latest/run.sh @@ -19,12 +19,12 @@ function createOptDirectory { echo "[testrail] Unzipping testrail service" unzip -o ${TESTRAIL_RELEASE_DIR}/testrail.zip -d /var/www/ -createOptDirectory $TR_DEFAULT_LOG_DIR -createOptDirectory $TR_DEFAULT_AUDIT_DIR -createOptDirectory $TR_DEFAULT_REPORT_DIR -createOptDirectory $TR_DEFAULT_ATTACHMENT_DIR +createOptDirectory ${TR_DEFAULT_LOG_DIR} +createOptDirectory ${TR_DEFAULT_AUDIT_DIR} +createOptDirectory ${TR_DEFAULT_REPORT_DIR} +createOptDirectory ${TR_DEFAULT_ATTACHMENT_DIR} -chown -R www-data:www-data ${TR_CONFIGPATH} +chown -R www-data:www-data ${TR_CONFIG_DIR} ################################################################################# @@ -38,7 +38,7 @@ done echo "[testrail] Starting background task" while /bin/true; do php /var/www/testrail/task.php || true - sleep $TR_DEFAULT_TASK_EXECUTION + sleep ${TR_DEFAULT_TASK_EXECUTION} done & echo "[testrail] Background task stoped" diff --git a/linux/ecosystem/testrail/ldap/Dockerfile b/linux/ecosystem/testrail/ldap/Dockerfile index 3eca65d54..543fc5aab 100644 --- a/linux/ecosystem/testrail/ldap/Dockerfile +++ b/linux/ecosystem/testrail/ldap/Dockerfile @@ -1,13 +1,11 @@ FROM epicmorg/testrail:latest -ARG TESTRAIL_RELEASE_DIR=/testrail-release - -ARG TESTRAIL_PLUGIN_VERSION=1.4 -ARG TESTRAIL_PLUGIN_NAME=ldap -ARG TESTRAIL_PLUGIN_FULLNAME=testrail-auth-${TESTRAIL_PLUGIN_NAME}-${TESTRAIL_PLUGIN_VERSION} -ARG TESTRAIL_PLUGIN_FILE=${TESTRAIL_PLUGIN_FULLNAME}.zip -ARG TESTRAIL_PLUGIN_DONWLOAD_URL=https://media.gurock.com/gk-media/downloads/${TESTRAIL_PLUGIN_FILE} -ARG TESTRAIL_PLUGIN_TEMP=${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} +ENV TESTRAIL_PLUGIN_VERSION=1.4 +ENV TESTRAIL_PLUGIN_NAME=ldap +ENV TESTRAIL_PLUGIN_FULLNAME=testrail-auth-${TESTRAIL_PLUGIN_NAME}-${TESTRAIL_PLUGIN_VERSION} +ENV TESTRAIL_PLUGIN_FILE=${TESTRAIL_PLUGIN_FULLNAME}.zip +ENV TESTRAIL_PLUGIN_DONWLOAD_URL=https://media.gurock.com/gk-media/downloads/${TESTRAIL_PLUGIN_FILE} +ENV TESTRAIL_PLUGIN_TEMP=${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} RUN rm -rfv /run.sh COPY run.sh /run.sh diff --git a/linux/ecosystem/testrail/ldap/run.sh b/linux/ecosystem/testrail/ldap/run.sh index a3e418e69..b4ba56179 100755 --- a/linux/ecosystem/testrail/ldap/run.sh +++ b/linux/ecosystem/testrail/ldap/run.sh @@ -11,20 +11,20 @@ function createOptDirectory { chown -R www-data:www-data $1 } -/bin/cp -rf /testrail-release/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf +/bin/cp -rf ${TESTRAIL_RELEASE_DIR}/apache-conf/000-default.conf /etc/apache2/sites-enabled/000-default.conf echo "[testrail] Unzipping testrail service" -unzip -o /testrail-release/testrail.zip -d /var/www/ +unzip -o ${TESTRAIL_RELEASE_DIR}/testrail.zip -d /var/www/ echo "[testrail] Unzipping testrail LDAP auth plugin" -unzip -o -j /testrail-release/testrail-auth-ldap-1.4.zip testrail-auth-ldap-1.4/auth.php -d ${TR_CUSTOM_AUTH_DIR} +unzip -o -j ${TESTRAIL_RELEASE_DIR}/${TESTRAIL_PLUGIN_FILE} ${TESTRAIL_PLUGIN_FULLNAME}/auth.php -d ${TR_CUSTOM_AUTH_DIR} -createOptDirectory $TR_DEFAULT_LOG_DIR -createOptDirectory $TR_DEFAULT_AUDIT_DIR -createOptDirectory $TR_DEFAULT_REPORT_DIR -createOptDirectory $TR_DEFAULT_ATTACHMENT_DIR +createOptDirectory ${TR_DEFAULT_LOG_DIR} +createOptDirectory ${TR_DEFAULT_AUDIT_DIR} +createOptDirectory ${TR_DEFAULT_REPORT_DIR} +createOptDirectory ${TR_DEFAULT_ATTACHMENT_DIR} -chown -R www-data:www-data /var/www/testrail/config +chown -R www-data:www-data ${TR_CONFIG_DIR} ################################################################################# @@ -38,7 +38,7 @@ done echo "[testrail] Starting background task" while /bin/true; do php /var/www/testrail/task.php || true - sleep $TR_DEFAULT_TASK_EXECUTION + sleep ${TR_DEFAULT_TASK_EXECUTION} done & echo "[testrail] Background task stoped"