Skip to content
Snippets Groups Projects
Commit c231ebde authored by Corné Lukken's avatar Corné Lukken
Browse files

L2SS-451: Reenable pipeline and update docker images

parent 0b3ba25d
No related branches found
No related tags found
1 merge request!110L2SS-451: Integration test ci fix
...@@ -11,76 +11,49 @@ cache: ...@@ -11,76 +11,49 @@ cache:
paths: paths:
- .cache/pip - .cache/pip
stages: stages:
# - building - building
# - linting - linting
# - static-analysis - static-analysis
# - unit-tests - unit-tests
- integration-tests - integration-tests
#newline_at_eof: newline_at_eof:
# stage: linting stage: linting
# before_script:
# - pip3 install -r devices/test-requirements.txt
# script:
# - flake8 --filename *.sh,*.conf,*.md,*.yml --select=W292 --exclude .tox,.egg-info,docker
#python_linting:
# stage: linting
# script:
# - cd devices
# - tox -e pep8
#bandit:
# stage: static-analysis
# script:
# - cd devices
# - tox -e bandit
#shellcheck:
# stage: static-analysis
# before_script:
# - sudo apt-get update
# - sudo apt-get install -y shellcheck
# script:
# - shellcheck **/*.sh
#unit_test:
# stage: unit-tests
# before_script:
# - sudo apt-get update
# - sudo apt-get install -y git
# script:
# - cd devices
# - tox -e py37
integration_test_itango:
stage: integration-tests
allow_failure: true
tags:
- privileged
services:
- name: docker:20.10.8-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
# Everything below does not work currently, we need a privileged container
# that can run the dind service
before_script: before_script:
- sudo apt update - pip3 install -r devices/test-requirements.txt
- sudo apt install -y docker.io
- export USER=$(id | awk -F'=' '{print $2}' | awk -F'(' '{print $2}' | awk -F')' '{print $1}')
- echo $USER
# - sudo usermod -aG docker $USER
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script: script:
- touch /home/$USER/.Xauthority - flake8 --filename *.sh,*.conf,*.md,*.yml --select=W292 --exclude .tox,.egg-info,docker
# || true is necessary to mask error return code from source file python_linting:
- . bootstrap/etc/lofar20rc.sh || true stage: linting
# - export HOSTNAME=$(cat /run/systemd/netif/leases/2 | grep ^ADDRESS= | awk -F'=' '{print $2}') script:
- export HOSTNAME=$(hostname -i) - cd devices
- echo $HOSTNAME - tox -e pep8
# - chmod u+x $CI_PROJECT_DIR/sbin/run_integration_test.sh bandit:
- $CI_PROJECT_DIR/sbin/run_integration_test.sh stage: static-analysis
script:
- cd devices
- tox -e bandit
shellcheck:
stage: static-analysis
before_script:
- sudo apt-get update
- sudo apt-get install -y shellcheck
script:
- shellcheck **/*.sh
unit_test:
stage: unit-tests
before_script:
- sudo apt-get update
- sudo apt-get install -y git
script:
- cd devices
- tox -e py37
integration_test_docker: integration_test_docker:
stage: integration-tests stage: integration-tests
image: docker:20.10.8 image: docker:latest
tags: tags:
- privileged - privileged
services: services:
- name: docker:20.10.8-dind - name: docker:dind
variables: variables:
DOCKER_TLS_CERTDIR: "/certs" DOCKER_TLS_CERTDIR: "/certs"
before_script: before_script:
...@@ -91,48 +64,15 @@ integration_test_docker: ...@@ -91,48 +64,15 @@ integration_test_docker:
- touch /root/.Xauthority - touch /root/.Xauthority
# Hack BASH_SOURCE into sourced files, docker its sh shell won't set this # Hack BASH_SOURCE into sourced files, docker its sh shell won't set this
- export BASH_SOURCE=$(pwd)/bootstrap/etc/lofar20rc.sh - export BASH_SOURCE=$(pwd)/bootstrap/etc/lofar20rc.sh
# Hack HOSTNAME env variable into an ip address with externally reachable gateway # Hack HOSTNAME env variable into host.docker.internal, set in docker-compose
- export HOSTNAME=host.docker.internal - export HOSTNAME=host.docker.internal
# - export HOSTNAME=$(hostname -i) # - 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 - . bootstrap/etc/lofar20rc.sh || true
# TANGO_HOST must be unset our databaseds will be unreachable # TANGO_HOST must be unset our databaseds will be unreachable
- unset TANGO_HOST - unset TANGO_HOST
# - export HOSTNAME=$(cat /run/systemd/netif/leases/2 | grep ^ADDRESS= | awk -F'=' '{print $2}') # Allow integration test to execute
- echo $HOSTNAME
- echo $CI_BUILD_ID
- echo $CI_JOB_ID
- echo $CONTAINER_NAME_PREFIX
- chmod u+x $CI_PROJECT_DIR/sbin/run_integration_test.sh - 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 - bash $CI_PROJECT_DIR/sbin/run_integration_test.sh
# - cd docker-compose
# - make start itango
# - docker exec -i ${CONTAINER_NAME_PREFIX}itango sudo apt update
# - docker exec -i ${CONTAINER_NAME_PREFIX}itango sudo apt install nmap -y
# - docker exec -i ${CONTAINER_NAME_PREFIX}itango nmap host.docker.internal
# - dig $HOSTNAME
# - echo $HOSTNAME
# - echo $LOFAR20_DIR
# - echo $CI_JOB_ID
# - echo $TANGO_HOST
# - ifconfig
# - ip address
# - route
# - cd docker-compose
# - make start itango
# - docker exec -i ${CONTAINER_NAME_PREFIX}itango sudo apt update
# - docker exec -i ${CONTAINER_NAME_PREFIX}itango sudo apt install nmap -y
# - docker exec -i ${CONTAINER_NAME_PREFIX}itango nmap host.docker.internal
# - docker exec -i ${CONTAINER_NAME_PREFIX}itango nmap $(hostname -i)
# - sed -i "s/sdptr-sim/${CONTAINER_NAME_PREFIX}sdptr-sim/" CDB/integration_ConfigDb.json
# - sed -i "s/pypcc-sim/${CONTAINER_NAME_PREFIX}pypcc-sim/" CDB/integration_ConfigDb.json
# - cat CDB/integration_ConfigDb.json
# - bash $CI_PROJECT_DIR/sbin/run_integration_test.sh || true
# - docker exec -i ${CONTAINER_NAME_PREFIX}device-sdp sudo apt update
# - docker exec -i ${CONTAINER_NAME_PREFIX}device-sdp sudo apt install nmap -y
# - docker exec -i ${CONTAINER_NAME_PREFIX}device-sdp nmap ${CONTAINER_NAME_PREFIX}sdptr-sim -p 4840
# - docker exec -i ${CONTAINER_NAME_PREFIX}device-sdp nmap ${CONTAINER_NAME_PREFIX}recv-sim -p 4842
# - docker exec -i ${CONTAINER_NAME_PREFIX}device-sdp nmap ${CONTAINER_NAME_PREFIX}device-recv -p 5700
# - docker exec -i ${CONTAINER_NAME_PREFIX}device-sdp nmap device-recv -p 5700
# - docker exec -i ${CONTAINER_NAME_PREFIX}device-sdp nmap device-sdp -p 5701
# - docker exec -i -w ${TANGO_LOFAR_CONTAINER_DIR}/devices ${CONTAINER_NAME_PREFIX}device-sdp tox -e integration || true
# - docker exec -i -w ${TANGO_LOFAR_CONTAINER_DIR}/devices ${CONTAINER_NAME_PREFIX}device-recv tox -e integration
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment