diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ca3a617c1b052564c46e2a5e426fe9a1e86787d6..350b264d8891a58f8b268c36b7d0315962ff382e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,7 +33,6 @@ bandit: - tox -e bandit shellcheck: stage: static-analysis - allow_failure: true before_script: - sudo apt-get update - sudo apt-get install -y shellcheck diff --git a/bin/start-DS.sh b/bin/start-DS.sh index a9c9765d52db4fecd744117ef64938f20288511d..83a6eec6dd30f2e496fa03ffc6f7351d8e9a664d 100755 --- a/bin/start-DS.sh +++ b/bin/start-DS.sh @@ -1,7 +1,8 @@ +#!/bin/bash function help() { why="${1}" - echo -e "*** Cannot start the Python device server.\n${why}\n\n* The Python file for the device server must be the 1st parameter that is provided.\n* The instance of this device server must be the 2nd parameter that is provided." + echo -e "*** Cannot start the Python device server.\\n${why}\\n\\n* The Python file for the device server must be the 1st parameter that is provided.\\n* The instance of this device server must be the 2nd parameter that is provided." exit -1 } @@ -29,14 +30,14 @@ esac # ATTENTION # This is assuming that the device server's Python file exists # on the Docker's host in the user's ${HOME} directory. -runThis=$(basename ${deviceServer}) +runThis=$(basename "${deviceServer}") runThis=${runThis//.sh/.py} -if [ -f ${runThis} ]; then +if [ -f "${runThis}" ]; then myDir=${PWD} else - myDir=${PWD}/$(dirname ${deviceServer}) + myDir=${PWD}/$(dirname "${deviceServer}") fi deviceServerPath=${myDir/${HOME}/\/hosthome} # Tango log lines start with a UNIX timestamp. Replace them with the UTC time. -docker exec -it itango python3 ${deviceServerPath}/${runThis} ${instance} ${@} | perl -ne 'use Time::Piece; s/^([0-9]+)/gmtime($1)->strftime("%F %T")/e; print;' +docker exec -it itango python3 "${deviceServerPath}/${runThis}" "${instance}" "${@}" | perl -ne 'use Time::Piece; s/^([0-9]+)/gmtime($1)->strftime("%F %T")/e; print;' diff --git a/bin/start-jive.sh b/bin/start-jive.sh index fcbb9f8b5e95a4bbbfb6b2895c30d4d2a1914340..38e04ce1837f2351a46f0f5f3c55936825cf5d7b 100755 --- a/bin/start-jive.sh +++ b/bin/start-jive.sh @@ -1,9 +1,10 @@ +#!/bin/bash OS=$(uname) case ${OS} in Linux) display="" - XTRA_OPTIONS="-u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/groups:/etc/groups:ro" + XTRA_OPTIONS="-u $(id -u "${USER}"):$(id -g "${USER}") -v /etc/passwd:/etc/passwd:ro -v /etc/groups:/etc/groups:ro" ;; Darwin) @@ -28,10 +29,10 @@ else fi #docker run --rm -it --network host ${OPTIONS} nexus.engageska-portugal.pt/ska-docker/tango-java:latest ${command} ${@} -container_name=artefact.skatelescope.org/ska-tango-images/tango-java:9.3.3.2 -container=$(docker ps | egrep ${container_name} | cut -d' ' -f1) -if [ ! -z ${container} ]; then - docker exec -it ${container} ${command} ${@} +container_name=artefact.skao.int/ska-tango-images-tango-java:9.3.4 +container=$(docker ps | grep -E ${container_name} | cut -d' ' -f1) +if [ ! -z "${container}" ]; then + docker exec -it "${container}" ${command} "${@}" else echo "Container \"${container_name}\" is not running." fi diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh index 9d9ec12ae79a2336d5bfd88191930f8c6fa9db36..e0b87940b9ac9776a812b2e7cda5d9fa851e9200 100755 --- a/sbin/run_integration_test.sh +++ b/sbin/run_integration_test.sh @@ -1,12 +1,12 @@ #!/bin/bash -e -if [ -z "$LOFA20_DIR"]; then +if [ -z "$LOFAR20_DIR" ]; then # We assume we aren't in the PATH, so we can derive our path. # We need our parent directory. - LOFAR20_DIR_RELATIVE=`dirname "$0"`/.. + LOFAR20_DIR_RELATIVE=$(dirname "$0")/.. # As an absolute path - LOFAR20_DIR=`readlink -f "${LOFAR20_DIR_RELATIVE}"` + LOFAR20_DIR=$(readlink -f "${LOFAR20_DIR_RELATIVE}") fi # Start and stop sequence @@ -18,7 +18,7 @@ make start databaseds dsconfig jupyter elk sleep 15 # Update the dsconfig -${LOFAR20_DIR}/sbin/update_ConfigDb.sh ${LOFAR20_DIR}/CDB/integration_ConfigDb.json +"${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/integration_ConfigDb.json cd "$LOFAR20_DIR/docker-compose" || exit 1 make start sdptr-sim recv-sim unb2-sim diff --git a/sbin/tag_and_push_docker_image.sh b/sbin/tag_and_push_docker_image.sh index ad94ae4b2ca6418e0d89347d4b37b47ef1a16a5a..799ab1cd779bb5caf840685f339080b57916063b 100755 --- a/sbin/tag_and_push_docker_image.sh +++ b/sbin/tag_and_push_docker_image.sh @@ -1,4 +1,4 @@ -#! /usr/bin/env bash -e +#!/bin/bash -e # Tag and push which image version? DOCKER_TAG=latest @@ -10,16 +10,16 @@ SKA_REPO="nexus.engageska-portugal.pt/ska-docker" LOFAR_REPO="git.astron.nl:5000/lofar2.0/tango" # Compile a list of the SKA images -SKA_IMAGES=$(for i in $(docker images | egrep ${DOCKER_TAG} | egrep ${SKA_REPO} | cut -d' ' -f1); do printf "%s " ${i}; done) +SKA_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E ${SKA_REPO} | cut -d' ' -f1); do printf "%s " "${i}"; done) # Compile a list of LOFAR2.0 images -LOFAR_IMAGES=$(for i in $(docker images | egrep ${DOCKER_TAG} | egrep -v "${SKA_REPO}|${LOFAR_REPO}" | cut -d' ' -f1); do printf "%s " ${i}; done) +LOFAR_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E -v "${SKA_REPO}|${LOFAR_REPO}" | cut -d' ' -f1); do printf "%s " "${i}"; done) function tag_and_push() { ( - docker tag ${1} ${2} - docker push ${2} + docker tag "${1}" "${2}" + docker push "${2}" ) & } @@ -27,14 +27,14 @@ function tag_and_push() # and push them to the LOFAR2.0 repo for IMAGE in ${SKA_IMAGES}; do PUSH_IMAGE=${IMAGE//${SKA_REPO}/${LOFAR_REPO}}:${VERSION} - tag_and_push ${IMAGE} ${PUSH_IMAGE} + tag_and_push "${IMAGE}" "${PUSH_IMAGE}" done # Rename the LOFAR2.0 images for the LOFAR2.0 repo # and push them to the LOFAR2.0 repo for IMAGE in ${LOFAR_IMAGES}; do - PUSH_IMAGES=${LOFAR_REPO}/${IMAGE}:${VERSIN} - tag_and_push ${IMAGE} ${PUSH_IMAGE} + PUSH_IMAGE=${LOFAR_REPO}/${IMAGE}:${VERSION} + tag_and_push "${IMAGE}" "${PUSH_IMAGE}" done wait