diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eef96688ba969a95709f27c6b0d96e226662d1e3..c642888588327b2369367a21720aa65f123704fc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -447,6 +447,10 @@ integration_test_docker: - name: docker:dind variables: DOCKER_TLS_CERTDIR: "/certs" + artifacts: + when: always + paths: + - log/ before_script: - | if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" && -z "$CI_COMMIT_TAG" ]]; then @@ -465,20 +469,23 @@ integration_test_docker: - export BASH_SOURCE=$(pwd)/bootstrap/etc/lofar20rc.sh # Hack HOSTNAME env variable into host.docker.internal, set in docker-compose - export HOSTNAME=host.docker.internal -# - export HOSTNAME=$(hostname -i) -# - export HOSTNAME=$(cat /run/systemd/netif/leases/2 | grep ^ADDRESS= | awk -F'=' '{print $2}') # source the lofarrc file and mask its non zero exit code - . bootstrap/etc/lofar20rc.sh || true # TANGO_HOST must be unset our databaseds will be unreachable - unset TANGO_HOST -## Allow docker image script to execute -# - chmod u+x $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh # Do not remove 'bash' or statement will be ignored by primitive docker shell - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag -## Allow integration test to execute -# - chmod u+x $CI_PROJECT_DIR/sbin/run_integration_test.sh # Do not remove 'bash' or statement will be ignored by primitive docker shell - bash $CI_PROJECT_DIR/sbin/run_integration_test.sh + after_script: +# Collect output of all containers + - | + mkdir -p log + for container in $(docker ps -a --format "{{.Names}}") + do + echo "Saving log for container $container" + docker logs "${container}" >& "log/${container}.log" + done wheel_packaging: stage: packaging artifacts: diff --git a/docker-compose/Makefile b/docker-compose/Makefile index 5aa715b84f64f4038ce946aa2cd9c33f9c53ba23..1f859907bd6eb9038c569e24fd2a40a339145ca5 100644 --- a/docker-compose/Makefile +++ b/docker-compose/Makefile @@ -181,6 +181,7 @@ bootstrap: pull build # first start, initialise from scratch $(MAKE) start dsconfig # boot up containers to load configurations sleep 5 # wait for dsconfig container to come up ../sbin/update_ConfigDb.sh ../CDB/LOFAR_ConfigDb.json # load default configuration + ../sbin/update_ConfigDb.sh ../CDB/tango-archiver-data/archiver-devices.json # load default archive configuration ../sbin/update_ConfigDb.sh ../CDB/stations/simulators_ConfigDb.json # by default, use simulators start: up ## start a service (usage: make start <servicename>) diff --git a/docker-compose/tango.yml b/docker-compose/tango.yml index 166891b51f9a1ac59d3fcf837c3486f3199ad798..5a6839f44a356113ae1fc525a0ff6e3290e777cd 100644 --- a/docker-compose/tango.yml +++ b/docker-compose/tango.yml @@ -80,12 +80,10 @@ services: - TANGO_HOST=${TANGO_HOST} command: > sh -c "wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict -- - json2tango -w -a -u /tango-archiver-data/archiver-devices.json && sleep infinity" volumes: - ..:/opt/lofar/tango:rw - ${HOME}:/hosthome - - ../CDB/tango-archiver-data:/tango-archiver-data logging: driver: syslog options: diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh index 343eac0520e9e4ece9a4e7144e8ebd1b1e165753..acac6e21e1aeb0850d19aa420a4fe5c9a72970b9 100755 --- a/sbin/run_integration_test.sh +++ b/sbin/run_integration_test.sh @@ -20,31 +20,39 @@ sleep 1 # dsconfig container must be up and running... # shellcheck disable=SC2016 echo '/usr/local/bin/wait-for-it.sh ${TANGO_HOST} --strict --timeout=300 -- true' | make run dsconfig bash - +DEVICES="device-boot device-apsct device-apspu device-sdp device-recv device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam" +SIMULATORS="sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim" + # Build only the required images, please do not build everything that makes CI # take really long to finish, especially grafana / jupyter / prometheus. # jupyter is physically large > 2.5gb and overlayfs is really slow. -make build device-sdp device-recv device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam -make build sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim +# shellcheck disable=SC2086 +make build $DEVICES $SIMULATORS make build elk integration-test make build archiver-timescale hdbppts-cm hdbppts-es # Start and stop sequence -make stop device-boot device-docker device-apsct device-apspu device-sdp device-recv device-sst device-unb2 device-xst device-beamlet device-digitalbeam device-tilebeam sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim hdbppts-es hdbppts-cm archiver-timescale +# shellcheck disable=SC2086 +make stop $DEVICES $SIMULATORS hdbppts-es hdbppts-cm archiver-timescale +make stop device-docker # this one does not test well in docker-in-docker make start elk # Update the dsconfig # Do not remove `bash`, otherwise statement ignored by gitlab ci shell! bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/LOFAR_ConfigDb.json +bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/tango-archiver-data/archiver-devices.json bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/simulators_ConfigDb.json bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/stations/dummy_positions_ConfigDb.json cd "$LOFAR20_DIR/docker-compose" || exit 1 -make start sdptr-sim recv-sim unb2-sim apsct-sim apspu-sim +# shellcheck disable=SC2086 +make start $SIMULATORS # Give the simulators time to start sleep 5 -make start device-boot device-apsct device-apspu device-sdp device-recv device-sst device-unb2 device-xst device-tilebeam device-beamlet device-digitalbeam +# shellcheck disable=SC2086 +make start $DEVICES # Archive devices -> starting order is important make start archiver-timescale hdbppts-cm hdbppts-es @@ -63,4 +71,5 @@ make run integration-test default bash "${LOFAR20_DIR}"/sbin/update_ConfigDb.sh "${LOFAR20_DIR}"/CDB/integrations/recvcluster_ConfigDb.json make restart device-recv device-tilebeam sleep 5 + make run integration-test recv_cluster