Skip to content
Snippets Groups Projects
Commit 2c9a1457 authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'L2SS-409-fix-shellcheck-ci' into 'master'

Resolve L2SS-409 "Fix shellcheck ci"

Closes L2SS-409

See merge request !151
parents 5f766cfe bb9ac21d
No related branches found
No related tags found
1 merge request!151Resolve L2SS-409 "Fix shellcheck ci"
...@@ -33,7 +33,6 @@ bandit: ...@@ -33,7 +33,6 @@ bandit:
- tox -e bandit - tox -e bandit
shellcheck: shellcheck:
stage: static-analysis stage: static-analysis
allow_failure: true
before_script: before_script:
- sudo apt-get update - sudo apt-get update
- sudo apt-get install -y shellcheck - sudo apt-get install -y shellcheck
......
#!/bin/bash
function help() function help()
{ {
why="${1}" 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 exit -1
} }
...@@ -29,14 +30,14 @@ esac ...@@ -29,14 +30,14 @@ esac
# ATTENTION # ATTENTION
# This is assuming that the device server's Python file exists # This is assuming that the device server's Python file exists
# on the Docker's host in the user's ${HOME} directory. # on the Docker's host in the user's ${HOME} directory.
runThis=$(basename ${deviceServer}) runThis=$(basename "${deviceServer}")
runThis=${runThis//.sh/.py} runThis=${runThis//.sh/.py}
if [ -f ${runThis} ]; then if [ -f "${runThis}" ]; then
myDir=${PWD} myDir=${PWD}
else else
myDir=${PWD}/$(dirname ${deviceServer}) myDir=${PWD}/$(dirname "${deviceServer}")
fi fi
deviceServerPath=${myDir/${HOME}/\/hosthome} deviceServerPath=${myDir/${HOME}/\/hosthome}
# Tango log lines start with a UNIX timestamp. Replace them with the UTC time. # 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;'
#!/bin/bash
OS=$(uname) OS=$(uname)
case ${OS} in case ${OS} in
Linux) Linux)
display="" 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) Darwin)
...@@ -28,10 +29,10 @@ else ...@@ -28,10 +29,10 @@ else
fi fi
#docker run --rm -it --network host ${OPTIONS} nexus.engageska-portugal.pt/ska-docker/tango-java:latest ${command} ${@} #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_name=artefact.skao.int/ska-tango-images-tango-java:9.3.4
container=$(docker ps | egrep ${container_name} | cut -d' ' -f1) container=$(docker ps | grep -E ${container_name} | cut -d' ' -f1)
if [ ! -z ${container} ]; then if [ ! -z "${container}" ]; then
docker exec -it ${container} ${command} ${@} docker exec -it "${container}" ${command} "${@}"
else else
echo "Container \"${container_name}\" is not running." echo "Container \"${container_name}\" is not running."
fi fi
......
#!/bin/bash -e #!/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 assume we aren't in the PATH, so we can derive our path.
# We need our parent directory. # We need our parent directory.
LOFAR20_DIR_RELATIVE=`dirname "$0"`/.. LOFAR20_DIR_RELATIVE=$(dirname "$0")/..
# As an absolute path # As an absolute path
LOFAR20_DIR=`readlink -f "${LOFAR20_DIR_RELATIVE}"` LOFAR20_DIR=$(readlink -f "${LOFAR20_DIR_RELATIVE}")
fi fi
# Start and stop sequence # Start and stop sequence
...@@ -18,7 +18,7 @@ make start databaseds dsconfig jupyter elk ...@@ -18,7 +18,7 @@ make start databaseds dsconfig jupyter elk
sleep 15 sleep 15
# Update the dsconfig # 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 cd "$LOFAR20_DIR/docker-compose" || exit 1
make start sdptr-sim recv-sim unb2-sim make start sdptr-sim recv-sim unb2-sim
......
#! /usr/bin/env bash -e #!/bin/bash -e
# Tag and push which image version? # Tag and push which image version?
DOCKER_TAG=latest DOCKER_TAG=latest
...@@ -10,16 +10,16 @@ SKA_REPO="nexus.engageska-portugal.pt/ska-docker" ...@@ -10,16 +10,16 @@ SKA_REPO="nexus.engageska-portugal.pt/ska-docker"
LOFAR_REPO="git.astron.nl:5000/lofar2.0/tango" LOFAR_REPO="git.astron.nl:5000/lofar2.0/tango"
# Compile a list of the SKA images # 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 # 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() function tag_and_push()
{ {
( (
docker tag ${1} ${2} docker tag "${1}" "${2}"
docker push ${2} docker push "${2}"
) & ) &
} }
...@@ -27,14 +27,14 @@ function tag_and_push() ...@@ -27,14 +27,14 @@ function tag_and_push()
# and push them to the LOFAR2.0 repo # and push them to the LOFAR2.0 repo
for IMAGE in ${SKA_IMAGES}; do for IMAGE in ${SKA_IMAGES}; do
PUSH_IMAGE=${IMAGE//${SKA_REPO}/${LOFAR_REPO}}:${VERSION} PUSH_IMAGE=${IMAGE//${SKA_REPO}/${LOFAR_REPO}}:${VERSION}
tag_and_push ${IMAGE} ${PUSH_IMAGE} tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
done done
# Rename the LOFAR2.0 images for the LOFAR2.0 repo # Rename the LOFAR2.0 images for the LOFAR2.0 repo
# and push them to the LOFAR2.0 repo # and push them to the LOFAR2.0 repo
for IMAGE in ${LOFAR_IMAGES}; do for IMAGE in ${LOFAR_IMAGES}; do
PUSH_IMAGES=${LOFAR_REPO}/${IMAGE}:${VERSIN} PUSH_IMAGE=${LOFAR_REPO}/${IMAGE}:${VERSION}
tag_and_push ${IMAGE} ${PUSH_IMAGE} tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
done done
wait wait
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment