Skip to content
Snippets Groups Projects
Forked from cs / ds / alarm-handler
43 commits behind the upstream repository.
.gitlab-ci.yml_multi_stage 2.22 KiB
image:
  name: nexus.engageska-portugal.pt/ska-docker/tango-dsconfig

# The following variables are automatically passed down to the tangodb container
# as well as the tangodatabaseds container and available within each.
variables:
  MYSQL_ROOT_PASSWORD: "secret"
  MYSQL_DATABASE: "tango"
  MYSQL_USER: "tango"
  MYSQL_PASSWORD: "tango"
  MYSQL_HOST: "tangodb"
  TANGO_HOST: "localhost:10000"

stages:
  - build
  - conf
  - test

services:
  - name: nexus.engageska-portugal.pt/ska-docker/tango-db
    alias: tangodb
#  - name: nexus.engageska-portugal.pt/ska-docker/tango-cpp
#    alias: tangodatabaseds
#    entrypoint: ["/usr/local/bin/DataBaseds"]
#    command: ["2","-ORBendPoint giop:tcp::10000"]

build_job:
  stage: build
  before_script:
    #TODO: remove procps use for ps
    - sudo apt update && sudo apt -y --no-install-recommends install build-essential cmake pkg-config libboost-thread-dev procps
  script:
    #- make
    - mkdir build && cd build
    - cmake ..
    - make
  artifacts:
    paths:
      - build/alarm-handler-srv
    expire_in: 1 week
  #    # depending on your build setup it's most likely a good idea to cache outputs to reduce the build time
  #    cache:
  #      paths:
  #        - build/CMakeFiles/

configure_and_run_job:
  stage: conf
  script:
    - sleep 10
    - /usr/local/bin/DataBaseds 2 -ORBendPoint giop:tcp::10000 &
    - sleep 10
    - exit_code=2
    - json2tango -w -a -u ./test/ah_config.json || exit_code=$?
    # json2tango returns 2 if values written to DB
    - if [ ${exit_code} -ne 2 ]; then echo "Tango DB configuration failed!" ; else echo "Tango DB configuration succedeed!"; fi
    - sleep 5
  artifacts:
    paths:
      - build/alarm-handler-srv
    expire_in: 1 week
  needs: ["build_job"]
  #services:
  #  - name: nexus.engageska-portugal.pt/ska-docker/tango-db
  #    alias: tangodb

test_job:
  stage: test
  before_script:
    #TODO: remove procps use for ps
    - sudo apt update && sudo apt -y --no-install-recommends install libboost-thread-dev procps
  script:
    - /usr/local/bin/DataBaseds 2 -ORBendPoint giop:tcp::10000 &
    - sleep 10
    - ./build/alarm-handler-srv 01 &
    - sleep 10
    - ps -ef | grep alarm-handler-srv | grep -v grep
    - sleep 5
  needs: ["configure_and_run_job"]