ud3tn/.gitlab-ci.yml
Maximilian Nitsch cbc36a38e2 test(dtn7-interop): Bump docker image buildpack-deps:trixie
Rust toolchain must be set to 1.76.0, as the current version causes a
compilation error:

```
55.50 error[E0432]: unresolved import `serde::__private`
55.50   --> core/dtn7/src/cla/ecla/processing.rs:16:12
55.50    |
55.50 16 | use serde::__private::TryFrom;
55.50    |            ^^^^^^^^^ could not find `__private` in `serde`
```

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2026-05-21 17:35:25 +02:00

857 lines
37 KiB
YAML

---
stages:
- builds
- functional_test
- code_quality_test
- publish
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie
variables:
GIT_SUBMODULE_STRATEGY: recursive
# https://docs.gitlab.com/ci/yaml/workflow/#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
- if: $CI_COMMIT_TAG
build-posix-debug:
stage: builds
when: always
script:
- make werror=yes verbose=yes
build-posix-release:
stage: builds
when: always
script:
- make -j4 type=release optimize=yes werror=yes verbose=yes
build-clang-posix-debug:
stage: builds
when: always
script:
- make werror=yes verbose=yes TOOLCHAIN=clang
build-clang-posix-release:
stage: builds
when: always
script:
- make type=release optimize=yes werror=yes verbose=yes TOOLCHAIN=clang
.nix:
when: always
image: nixos/nix:2.22.2
before_script:
- mkdir -p $HOME/.config/nix
- echo "experimental-features = nix-command flakes" > $HOME/.config/nix/nix.conf
.nix-build:
extends: .nix
stage: builds
script:
- nix build --print-build-logs '.?submodules=1#ud3tn'
- nix build --print-build-logs '.?submodules=1#pyd3tn'
- nix build --print-build-logs '.?submodules=1#python-ud3tn-utils'
- nix build --print-build-logs '.?submodules=1#mkdocs-html'
.nix-test:
extends: .nix
image: alpine:latest
stage: functional_test
script:
- nix flake check --print-build-logs '.?submodules=1#'
build-nix-x86_64-linux:
extends: .nix-build
build-nix-arm64:
extends: .nix-build
tags: ["arm64"]
build-nix-macos:
extends: .nix-build
tags: ["macos"]
test-nix-x86_64-linux:
extends: .nix-test
tags: ["nix"]
build-posix-arm64-debug:
extends: build-posix-debug
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-posix-arm64-release:
extends: build-posix-release
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-clang-posix-arm64-debug:
extends: build-clang-posix-debug
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-clang-posix-arm64-release:
extends: build-clang-posix-release
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
build-posix-macos-debug:
extends: build-posix-debug
tags: ["macos"]
build-posix-macos-release:
extends: build-posix-release
tags: ["macos"]
build-freebsd:
extends: build-posix-debug
tags: ["freebsd"]
script:
- gmake werror=yes verbose=yes
build-library:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build
- cd /ud3tn_build
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
- make posix-lib
- gcc -I include/ -c components/daemon/main.c
- gcc -o ud3tn -L. main.o -l:build/posix/libud3tn.so
- ./ud3tn -L 4 --allow-remote-config --status-reports &
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- pytest test/integration
unit-test-posix-debug:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build TOOLCHAIN=clang sanitize-strict=yes unittest-posix
- cd /ud3tn_build
- ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 timeout 60 build/posix/testud3tn
unit-test-posix-release:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build type=release sanitize-strict=yes unittest-posix
- cd /ud3tn_build
- ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 timeout 60 build/posix/testud3tn
unit-test-posix-arm64:
extends: unit-test-posix-debug
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
unit-test-posix-macos:
stage: functional_test
when: always
tags: ["macos"]
script:
- make unittest-posix -j4 sanitize-strict=yes
# NOTE: ASAN_OPTIONS=detect_leaks=1 is apparently not supported on macOS
# See: https://github.com/google/sanitizers/issues/1026
- UBSAN_OPTIONS=print_stacktrace=1 gtimeout 60 build/posix/testud3tn
unit-test-posix-freebsd:
stage: functional_test
when: always
tags: ["freebsd"]
script:
- gmake unittest-posix sanitize-strict=yes
# NOTE: ASAN_OPTIONS=detect_leaks=1 is apparently not supported on FreeBSD
- UBSAN_OPTIONS=print_stacktrace=1 timeout 60 build/posix/testud3tn
integration-test-posix:
stage: functional_test
when: always
script:
- echo "CPPFLAGS += -DBUNDLE7_TX_PRODUCE_PREVIOUS_NODE_BLOCK=1" >> config.mk
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build TOOLCHAIN=clang sanitize-strict=yes
- cd /ud3tn_build
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4
-c "sqlite:file::memory:?cache=shared;tcpclv3:*,4556;tcpspp:*,4223,false,1;smtcp:*,4222,false;mtcp:*,4224"
--allow-remote-config --status-reports & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- pytest test/integration
- CLA=tcpspp TEST_JSON_CONFIG=1 pytest test/integration
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
integration-test-posix-python-3.14:
extends: integration-test-posix
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.14-trixie
integration-test-posix-thread-sanitizer:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build TOOLCHAIN=clang sanitize=thread sanitize-strict=yes
- cd /ud3tn_build
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 --allow-remote-config --status-reports & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- pytest test/integration
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
integration-test-posix-extdispatch:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build TOOLCHAIN=clang sanitize-strict=yes
- cd /ud3tn_build
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4
-c "sqlite:file::memory:?cache=shared;tcpclv3:*,4556;tcpspp:*,4223,false,1;smtcp:*,4222,false;mtcp:*,4224"
--allow-remote-config --external-dispatch --status-reports & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- aap2-bdm-ud3tn-routing --insecure-config -vv & DISPATCHER_PID=$!
- sleep 1 # give the dispatcher some time to start
- TEST_QUERY=1 TEST_JSON_CONFIG=1 pytest test/integration
- CLA=tcpspp pytest test/integration
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
integration-test-posix-release:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build type=release optimize=yes
- cd /ud3tn_build
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
# NOTE: Here we use the external dispatcher to test also the AAPv2 secret handling
# NOTE: TEST_AAP2_BDM_SECRET is also recognized by the integration test
- export TEST_AAP2_BDM_SECRET=very_secure_secret
- build/posix/ud3tn -L 3 --bdm-secret-var TEST_AAP2_BDM_SECRET --allow-remote-config --external-dispatch --status-reports &
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- python -O -m ud3tn_utils.aap2.bin.aap2_bdm_ud3tn_routing --secret-var TEST_AAP2_BDM_SECRET --insecure-config -vv & DISPATCHER_PID=$!
- sleep 1 # give the dispatcher some time to start
# Run test in Python "release" mode, disabling non-test assertions
- python -O -m pytest test/integration
integration-test-posix-arm64:
extends: integration-test-posix
tags: ["arm64"]
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ci-python-clang:3.10-trixie-arm64
integration-test-posix-macos:
stage: functional_test
when: always
tags: ["macos"]
script:
- make posix -j4 sanitize-strict=yes optimize=yes
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 --allow-remote-config --status-reports & UD3TN_PID=$!
- make virtualenv
- source .venv/bin/activate
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- pytest test/integration
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
aap-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- rm -f ./ud3tn.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 & UD3TN1_PID=$!
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- python test/functional/aap_test.py
- kill -TERM $UD3TN1_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN1_PID
# now test IPv6
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -e "dtn://ud3tn2.dtn/" -a '::1' -p 4242 -S ud3tn2.aap2.socket -L 4 & UD3TN2_PID=$!
- while ! nc -z localhost 4242; do sleep 0.1; done
- python test/functional/aap_test.py --tcp '::1' 4242
- kill -TERM $UD3TN2_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN2_PID
aap2-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- rm -f ./ud3tn.aap2.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 & UD3TN1_PID=$!
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- aap2-ping dtn://ud3tn.dtn/echo -t 1 -c 1
- aap2-ping dtn://ud3tn.dtn/1 -a 1 -t 1 -c 1
- (sleep 1 && aap2-send -a 2 --secret secret dtn://ud3tn.dtn/2 hello) & timeout -v 3 aap2-receive -a 2 --secret secret -c 1 --verify-pl hello
# Python "release" mode (optimized build)
- python -O -m ud3tn_utils.aap2.bin.aap2_ping dtn://ud3tn.dtn/1 -a 1 -t 1 -c 1
- (sleep 1 && python -O -m ud3tn_utils.aap2.bin.aap2_send -a 2 --secret secret dtn://ud3tn.dtn/2 hello)
& timeout -v 3 python -O -m ud3tn_utils.aap2.bin.aap2_receive -a 2 --secret secret -c 1 --verify-pl hello
- kill -TERM $UD3TN1_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN1_PID
# now test IPv6
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 -A '::1' -P 4243 & UD3TN2_PID=$!
- while ! nc -z localhost 4243; do sleep 0.1; done
- aap2-ping dtn://ud3tn.dtn/echo --tcp '::1' 4243 -t 1 -c 1
- aap2-ping dtn://ud3tn.dtn/1 --tcp '::1' 4243 -a 1 -t 1 -c 1
- (sleep 1 && aap2-send --tcp '::1' 4243 -a 2 --secret secret dtn://ud3tn.dtn/2 hello)
& timeout -v 3 aap2-receive --tcp '::1' 4243 -a 2 --secret secret -c 1 --verify-pl hello
# ensure that re-execution (with re-registration under the same agent ids but with different secrets) works
- (sleep 1 && aap2-send --tcp '::1' 4243 -a 2 --secret secret2 dtn://ud3tn.dtn/2 hello)
& timeout -v 3 aap2-receive --tcp '::1' 4243 -a 2 --secret secret2 -c 1 --verify-pl hello
# Python "release" mode (optimized build)
- python -O -m ud3tn_utils.aap2.bin.aap2_ping dtn://ud3tn.dtn/1 --tcp '::1' 4243 -a 1 -t 1 -c 1
- (sleep 1 && python -O -m ud3tn_utils.aap2.bin.aap2_send --tcp '::1' 4243 -a 2 --secret secret3 dtn://ud3tn.dtn/2 hello)
& timeout -v 3 python -O -m ud3tn_utils.aap2.bin.aap2_receive --tcp '::1' 4243 -a 2 --secret secret3 -c 1 --verify-pl hello
- kill -TERM $UD3TN2_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN2_PID
# now test ipn EIDs
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 -e ipn:1.0 & UD3TN3_PID=$!
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- aap2-ping ipn:1.9002 -t 1 -c 1
- aap2-ping ipn:1.1 -a 1 -t 1 -c 1
- aap2-ping ipn:0.1.1 -a 1 -t 1 -c 1
- (sleep 1 && aap2-send -a 2 --secret secret ipn:1.2 hello) & timeout -v 3 aap2-receive -a 2 --secret secret -c 1 --verify-pl hello
- kill -TERM $UD3TN3_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN3_PID
# now test ipn EIDs with allocator (+ user-defined source EIDs afterwards)
- export TEST_AAP2_BDM_SECRET=very_secure_secret
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 -e ipn:55555.1.0 --bdm-secret-var TEST_AAP2_BDM_SECRET & UD3TN4_PID=$!
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- aap2-ping ipn:55555.1.9002 -t 1 -c 1
- aap2-ping ipn:55555.1.1 -a 1 -t 1 -c 1
# FQNN for 55555.1
- aap2-ping ipn:238606908129281.1 -a 1 -t 1 -c 1
# special node number for local EIDs: 0xFFFFFFFF
- aap2-ping ipn:4294967295.1 -a 1 -t 1 -c 1
- aap2-ping 'ipn:!.2' -a 2 -t 1 -c 1
- (sleep 1 && aap2-send -a 3 --secret secret ipn:55555.1.3 hello) & timeout -v 3 aap2-receive -a 3 --secret secret -c 1 --verify-pl hello
- (sleep 1 && aap2-send -a 4 --secret secret 'ipn:!.4' hello2) & timeout -v 3 aap2-receive -a 4 --secret secret -c 1 --verify-pl hello2
# test user-defined source EIDs
- (sleep 1 && aap2-send -a 5 --secret-var TEST_AAP2_BDM_SECRET --source dtn:none 'ipn:!.6' helloNONE)
& timeout -v 3 aap2-receive -a 6 -c 1 --verify-pl helloNONE --verify-source dtn:none
- (sleep 1 && aap2-send -a 7 --secret-var TEST_AAP2_BDM_SECRET --source 'ipn:!.0' 'ipn:!.8' helloLOCAL)
& timeout -v 3 aap2-receive -a 8 -c 1 --verify-pl helloLOCAL --verify-source 'ipn:!.0'
- kill -TERM $UD3TN4_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN4_PID
aap2-c-api-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build
- cd /ud3tn_build
# Test sending/receiving bundles
- make aap2sendfile aap2recvfile -j4
- rm -f ./ud3tn.aap2.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 & UD3TN1_PID=$!
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- echo "Hello uD3TN!" > input
- (sleep 1 && build/posix/aap2sendfile -p ud3tn.aap2.socket src dtn://ud3tn.dtn/dst input)
& timeout -v 3 build/posix/aap2recvfile -p ud3tn.aap2.socket dst output
- diff input output
# Test the Unified API integration
- make posix-lib -j4
- cd /
# TODO: Update the URL to master of DTNsuite repo after it was merged into Unified API
- git clone --branch integrated_ud3tn_aapv2_client_v2 -- https://gitlab.com/fwalter/unified_api.git unified_api
- cd unified_api
- make UD3TN_DIR=/ud3tn_build
- cd test_program
- make UD3TN_DIR=/ud3tn_build UNIFIED_API_DIR=..
- cd /ud3tn_build
# NOTE: This needs to be run from the ud3tn project root so it finds the socket file.
- ../unified_api/test_program/test_program_vUD3TN
# Test that the AAP 2 client can be compiled with a C++ compiler
- make clean
- make -j8 posix-lib
# NOTE that this relies on the example client tools being valid C++, but they are so simple
# that we can ensure this. Two warnings about unsupported compiler options are fine here:
# it warns about the `-std` and `-Wno-override-init` command line options being passed.
# As we do not support setting `CC` to a C++ compiler officially and fully control the
# used `g++` version in our CI toolchain, we can use it as a hack to test compatibility.
- make aap2recvfile aap2sendfile CC=g++
ion-ipn-bpv6-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ion-interop:3.7.4-2
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/ion_interoperability/minimal_forwarding_test/run.sh 6 ipn
ion-ipn-bpv7-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ion-interop:4.1.4
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/ion_interoperability/minimal_forwarding_test/run.sh 7 ipn
ione-ipn-bpv7-interoperability-test:
extends: ion-ipn-bpv7-interoperability-test
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ione-interop:1.1.0-2
ion-dtn-bpv6-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ion-interop:3.7.4-2
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/ion_interoperability/minimal_forwarding_test/run.sh 6 dtn
ion-dtn-bpv7-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ion-interop:4.1.4
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/ion_interoperability/minimal_forwarding_test/run.sh 7 dtn
ion-bpv7-mtcp-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ion-interop:4.1.4
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes "CFLAGS=-DCLA_MTCP_ION_STCP_COMPATIBILITY=1"
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/ion_interoperability/mtcp_minimal_forwarding_test/run.sh
ione-dtn-bpv7-interoperability-test:
extends: ion-dtn-bpv7-interoperability-test
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ione-interop:1.1.0-2
hdtn-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/hdtn-interop:2.0.0
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/run_hdtn_test.sh
dtn7-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/dtn7-interop:0.21.0-b3a6065-2
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/dtn7_interoperability/run_dtn7_test.sh
mtcp-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
- rm -f ./ud3tn.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 --allow-remote-config & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! nc -z localhost 4224; do sleep 0.1; done
- python tools/cla/mtcp_test.py -t mtcp --payload TESTPAYLOAD &
- timeout -v 5 python tools/cla/mtcp_sink.py --count 1 --verify-pl TESTPAYLOAD
- sleep 2
- (sleep 1 && python tools/cla/mtcp_send_bundle.py dtn://ud3tn.dtn/sink hello) &
- timeout -v 3 aap2-receive -a sink -c 1 --verify-pl hello
- sleep 0.2
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
fragment-reassembly-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
- rm -f ./ud3tn1.socket
- rm -f ./ud3tn2.socket
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -R -L 4
-c "sqlite:ud3tn1.sqlite;mtcp:*,4222" -e "dtn://ud3tn1.dtn/" -s ud3tn1.socket -S ud3tn1.aap2.socket
& UD3TN1_PID=$!
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -R -L 4
-c "sqlite:ud3tn2.sqlite;mtcp:*,4223" -e "dtn://ud3tn2.dtn/" -s ud3tn2.socket -S ud3tn2.aap2.socket
& UD3TN2_PID=$!
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! nc -z localhost 4222; do sleep 0.1; done
- while ! nc -z localhost 4223; do sleep 0.1; done
- while ! [ -r ./ud3tn1.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn2.socket ]; do sleep 0.1; done
- aap2-config --socket ud3tn1.aap2.socket --schedule 2 1 140 --schedule 4 1 140 dtn://ud3tn2.dtn/ mtcp:localhost:4223
- aap-send --socket ud3tn1.socket dtn://ud3tn2.dtn/sink THISISAVERYLONGBUNDLEPAYLOADWHICHWILLBEFRAGMENTED -v
- timeout -v 5 aap-receive --socket ud3tn2.socket --agentid sink --count 1
--verify-pl THISISAVERYLONGBUNDLEPAYLOADWHICHWILLBEFRAGMENTED --newline -vv
- kill -TERM $UD3TN1_PID
- kill -TERM $UD3TN2_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN1_PID
- wait $UD3TN2_PID
fragment-mbs-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
- rm -f ./ud3tn.socket
- rm -f ./ud3tn.aap2.socket
# NOTE: No dispatcher needed - testing that it also works without it here
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -L 4 -c "mtcp:*,4222" -m 110 --external-dispatch & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! nc -z localhost 4222; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- aap2-configure-link ipn:2.0 mtcp:localhost:4223
- (sleep 1; aap2-send ipn:2.1 BUNDLEFRAGMENTEDINTOTWOPARTS -v) &
- python tools/cla/mtcp_sink.py -b 7 -p 4223 --print-pl -c 2 > test.bin
- diff test.bin <(echo BUNDLEFRAGMENT; echo EDINTOTWOPARTS)
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
ipv6-compatibility-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
# IPv6 and IPv4
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -R -L 4
-c "sqlite:ud3tn1.sqlite;mtcp:::,4222" -e "dtn://ud3tn1.dtn/" -a '::' -p 4242 -S ud3tn1.aap2.socket
& UD3TN1_PID=$!
# IPv4-only
- UBSAN_OPTIONS=print_stacktrace=1 build/posix/ud3tn -R -L 4
-c "sqlite:ud3tn2.sqlite;mtcp:::,4223" -e "dtn://ud3tn2.dtn/" -a '127.0.0.1' -p 4243 -S ud3tn2.aap2.socket
& UD3TN2_PID=$!
# Create venv and wait for uD3TN ports to be open
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! nc -z localhost 4222; do sleep 0.1; done
- while ! nc -z localhost 4223; do sleep 0.1; done
- while ! nc -z localhost 4242; do sleep 0.1; done
- while ! nc -z localhost 4243; do sleep 0.1; done
# Check v6 via AAP to ud3tn1 and via MTCP to ud3tn2
- aap-config --tcp '::1' 4242 --schedule 2 1 140 --schedule 4 1 140 dtn://ud3tn2.dtn/ 'mtcp:[::1]:4223'
# Check v4 via AAP to ud3tn1
- aap-send --tcp 127.0.0.1 4242 dtn://ud3tn2.dtn/sink PAYLOAD -v
# Check v4 reception of the correct bundle at ud3tn2
- timeout -v 5 aap-receive --tcp 127.0.0.1 4243 --agentid sink --count 1 --verify-pl PAYLOAD --newline -vv
# Check that v6 does _not_ work on ud3tn2
- "if timeout -v 1 python test/functional/aap_test.py --tcp '::1' 4243; then echo 'Error: Should not be able to connect via IPv6 here.'; false; else true; fi"
- kill -TERM $UD3TN1_PID
- kill -TERM $UD3TN2_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN1_PID
- wait $UD3TN2_PID
storage-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/functional/sqlite_storage_test/aap2_storage_agent_metadata_test.sh
- bash test/functional/sqlite_storage_test/python_storage_agent_bundle_id_test.sh
- bash test/functional/sqlite_storage_test/aap2_storage_agent_metadata_test.sh persistent
- bash test/functional/sqlite_storage_test/python_storage_agent_bundle_id_test.sh persistent
- bash test/functional/sqlite_storage_test/ud3tn_bdm_storage_persistence_restart_test.sh
bibe-internal-forwarding-test:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize-strict=yes
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/functional/bibe_internal_forwarding_test/run.sh
ion-bibe-interoperability-test:
stage: functional_test
when: always
image: registry.gitlab.com/d3tn/ud3tn-docker-images/ion-interop:4.1.4
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build sanitize=yes "CFLAGS=-DBIBE_AR_TYPE_CODE=7"
- cd /ud3tn_build
- source /ud3tn_venv/bin/activate
- bash test/ion_interoperability/bibe_forwarding_test/run.sh
# Not compatible as of 2024-07-24, needs a deprecated/old config. format.
# ione-bibe-interoperability-test:
# extends: ion-bibe-interoperability-test
# image: registry.gitlab.com/d3tn/ud3tn-docker-images/ione-interop:1.1.0-1
data-decoder-test:
stage: functional_test
when: always
script:
- make clean
- make data-decoder sanitize-strict=yes -j4
- build/posix/ud3tndecode -7 test/decoder/examples/bpv7_test/bpv7_1.bin
- build/posix/ud3tndecode -7 test/decoder/examples/bpv7_test/invalid/bpv7_1_huge_block_type.bin && false || test $? -eq 2
- build/posix/ud3tndecode -6 test/decoder/examples/bpv6_test/bpv6_1.bin
- build/posix/ud3tndecode -s test/decoder/examples/spp_test/spp_1.bin
- build/posix/ud3tndecode -a test/decoder/examples/aap_test/test_aap_ping_packet.bin
- build/posix/ud3tndecode -a test/decoder/examples/aap_test/test_aap_sendbundle_packet.bin
- build/posix/ud3tndecode -a test/decoder/examples/aap_test/test_aap_sendconfirm_packet.bin
- build/posix/ud3tndecode -a test/decoder/examples/aap_test/test_aap_welcome_packet.bin
unit-test-valgrind:
stage: functional_test
when: always
script:
- make unittest-posix
- valgrind --leak-check=no --error-exitcode=1 build/posix/testud3tn
integration-test-valgrind-memory-check:
stage: functional_test
when: always
script:
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build
- cd /ud3tn_build
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
- UBSAN_OPTIONS=print_stacktrace=1 valgrind --leak-check=yes --error-exitcode=1 --errors-for-leak-kinds=definite
build/posix/ud3tn -L 4 --allow-remote-config --status-reports & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- pytest test/integration
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
python-unittests:
stage: functional_test
when: always
script:
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- pytest pyd3tn/pyd3tn/*
- pytest python-ud3tn-utils/ud3tn_utils/*
- pytest python-ud3tn-utils/ud3tn_utils/aap2/bin/*
license-check:
stage: code_quality_test
when: always
script:
- bash tools/analysis/license-check.sh
stylecheck:
stage: code_quality_test
when: always
image: perl:5
script:
- make check-style
python-stylecheck:
stage: code_quality_test
when: always
script:
- source /ud3tn_venv/bin/activate
- pip install -e "pyd3tn"
- pip install -e "python-ud3tn-utils"
- python -m flake8 pyd3tn python-ud3tn-utils test/integration tools/cla --max-complexity=12 --exclude=generated
coverage-test:
stage: code_quality_test
when: always
script:
- project_dir="$(pwd)"
- bash test/dockerfiles/prepare_for_test.sh . /ud3tn_build coverage=yes
- cd /ud3tn_build
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
# Unit Tests
- make unittest-posix coverage=yes
- timeout 60 build/posix/testud3tn
# Integration Test with external dispatcher
- build/posix/ud3tn --allow-remote-config --external-dispatch --status-reports & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- aap2-bdm-ud3tn-routing -vv --insecure-config & DISPATCHER_PID=$!
- sleep 1 # give the dispatcher some time to start
- pytest test/integration
- kill -TERM $UD3TN_PID
- kill -TERM $DISPATCHER_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
- rm -f ./ud3tn.socket ./ud3tn.aap2.socket
# Integration Test with internal routing
- build/posix/ud3tn --allow-remote-config --status-reports & UD3TN_PID=$!
- source /ud3tn_venv/bin/activate
- while ! [ -r ./ud3tn.socket ]; do sleep 0.1; done
- while ! [ -r ./ud3tn.aap2.socket ]; do sleep 0.1; done
- pytest test/integration
# Test AAP2 C tooling
- make aap2sendfile aap2recvfile coverage=yes
- echo "Hello uD3TN" > input
- (sleep 1 && build/posix/aap2sendfile -p ud3tn.aap2.socket src dtn://ud3tn.dtn/dst input)
& timeout -v 3 build/posix/aap2recvfile -p ud3tn.aap2.socket dst output
- diff input output
# Teardown
- kill -TERM $UD3TN_PID
- echo "Waiting for uD3TN to exit gracefully - if it doesn't, check for sanitizer warnings."
- wait $UD3TN_PID
# Convert and push coverage report
- gcovr --xml-pretty --exclude-unreachable-branches --gcov-ignore-parse-errors --print-summary -o coverage.xml --root .
- cp -v coverage.xml "$project_dir/"
coverage: /^\s*lines:\s*\d+.\d+\%/
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
expire_in: 2 days
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
clang-tidy-posix-debug:
stage: code_quality_test
when: always
script:
- make ccmds-posix -j4
- bash ./tools/analysis/clang-check.sh "clang-tidy-13 --use-color" "posix"
clang-tidy-posix-release:
stage: code_quality_test
when: always
script:
- make ccmds-posix -j4 type=release
- bash ./tools/analysis/clang-check.sh "clang-tidy-13 --use-color" "posix"
cppcheck-static-analyzer:
stage: code_quality_test
when: always
script:
- cppcheck --version
- cppcheck
--enable=warning --force --check-level=exhaustive --error-exitcode=2 --inline-suppr
-I include -I external/tinycbor/src -I external/util/include components
cppcheck-stylecheck:
stage: code_quality_test
when: always
script:
- cppcheck --version
- cppcheck
--enable=style --force --check-level=exhaustive --error-exitcode=2 --inline-suppr
--suppress=knownConditionTrueFalse --suppress=constParameterCallback
-I include -I external/tinycbor/src -I external/util/include components
publish-docker-image:
stage: publish
rules:
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+(.[0-9]+)+$/'
when: always
image:
# See https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
CI_REGISTRY_IMAGE: registry.gitlab.com/d3tn/ud3tn-docker-images/ud3tn
script:
# find out if the docker image *also* should be tagged with "latest"
- |
# Download all existing ud3tn docker image tags from the docker image registry
wget -q "https://gitlab.com/api/v4/projects/23559871/registry/repositories/1616836/tags" -O tags.json
# Remove some json symbols, introduce line feeds for better filtering
sed -i -E 's/\]//g; s/\[//g; s/\},?/\n/g' tags.json
# Remove everything except the docker image tags (latest, v0.9.0, ...)
sed -i -E 's/(^.*"name":")(.*)(","path.*$)/\2/' tags.json
# Append the $CI_COMMIT_TAG to the list of tags
echo "$CI_COMMIT_TAG" >> tags.json
# Get the numerically highest *version* tag
highest_version=$(grep -E "v.*" tags.json | sort -rV | head -n1)
# Build the string $IMAGES that determines what image_name:image_tag the resulting docker image will have
TAGS="$CI_COMMIT_TAG"
if [ "$highest_version" = "$CI_COMMIT_TAG" ]; then TAGS="$TAGS latest"; fi
for TAG in $TAGS; do
IMAGES="${IMAGES} --destination $CI_REGISTRY_IMAGE:$TAG";
done;
- echo $IMAGES
# Prepare docker image registry access credentials
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$UD3TN_CI_DOCKER_DEPLOY_USER\",\"password\":\"$UD3TN_CI_DOCKER_DEPLOY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# Build and push the docker image
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/dockerfiles/ud3tn --build-arg UD3TN_VERSION=$CI_COMMIT_TAG $IMAGES
pages:
stage: publish
extends: .nix
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- nix build --print-build-logs '.?submodules=1#mkdocs-html'
- cp -r result/ public
artifacts:
paths:
- public