diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c29b8cda3c58dfcf9ee2e1d79e30c218598d508d..71c3e159c9f47efcd6e35da306af81d8284ad4f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,164 +1,55 @@ # Image with everything needed to run Cyber Sandbox Creator. -image: registry.gitlab.ics.muni.cz:443/muni-kypo-csc/cyber-sandbox-creator:debian +image: registry.gitlab.ics.muni.cz:443/muni-kypo-csc/cyber-sandbox-creator/csc-debian # Make sure that VirtualBox kernel modules are loaded and install Python dependencies. before_script: + - apt-get install -y linux-headers-$(uname -r) - lsmod | grep "vbox" || /usr/lib/virtualbox/vboxdrv.sh setup - pip3 install -r requirements.txt - - chmod +x test_topologies.sh + - chmod +x run_tests.sh # Separating integration tests into several stages to ensure only one job creating virtual environment will run at one time. # Running several jobs at once will make them fail while testing virtual network. # Integration tests need to be separated into several jobs to fit under timeout treshold. stages: - - 0-routers-1-network-1-host - - 1-router-1-network-1-host - - 1-router-2-networks-2-hosts - - 1-router-2-networks-2-hosts-ubuntu - - 1-router-2-networks-2-hosts-kali - - 2-routers-2-networks-2-hosts - - 2-routers-4-networks-4-hosts - - 3-routers-5-networks-5-hosts-br - - 3-routers-5-networks-5-hosts-br-ansloc + - debian + - kali-2020 + - windows-server -original: - stage: 0-routers-1-network-1-host +debian: + stage: debian script: - - ./test_topologies.sh ./testing/ci/config_1_1.yml + - testing/run_tests.sh -c testing/ci/config_debian.yml -p # run even when other stages fail when: always - # only run for commits to master branch and merge requests + # only run for merge requests only: - merge_requests -debian-stretch: - stage: 0-routers-1-network-1-host - script: - - ./test_topologies.sh ./testing/ci/config_1_2.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -debian9: - stage: 0-routers-1-network-1-host - script: - - ./test_topologies.sh ./testing/ci/config_1_3.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -ubuntu: - stage: 0-routers-1-network-1-host - script: - - ./test_topologies.sh ./testing/ci/config_1_4.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -kali: - stage: 0-routers-1-network-1-host +kali-2020: + stage: kali-2020 # overwritting global before_script to create a virtual display before running test requiring a display before_script: + - apt-get install -y linux-headers-$(uname -r) - lsmod | grep "vbox" || /usr/lib/virtualbox/vboxdrv.sh setup - pip3 install -r requirements.txt - - chmod +x test_topologies.sh + - chmod +x run_tests.sh - Xvfb :1 -screen 0 800x600x16 & - script: - - DISPLAY=:1 ./test_topologies.sh ./testing/ci/config_1_5.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -1-router-1-network-1-host: - stage: 1-router-1-network-1-host - script: - - ./test_topologies.sh ./testing/ci/config_2_1.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests -1-router-2-networks-2-hosts: - stage: 1-router-2-networks-2-hosts script: - - ./test_topologies.sh ./testing/ci/config_3_1.yml + - DISPLAY=:1 testing/run_tests.sh -c testing/ci/config_kali_2020.yml -p # run even when other stages fail when: always - # only run for commits to master branch and merge requests + # only run for and merge requests only: - merge_requests -1-router-2-networks-2-hosts-ubuntu: - stage: 1-router-2-networks-2-hosts-ubuntu +windows-server: + stage: windows-server script: - - ./test_topologies.sh ./testing/ci/config_4_1.yml + - testing/run_tests.sh -c /testing/ci/config_windows_server.yml -p # run even when other stages fail when: always - # only run for commits to master branch and merge requests + # only run for merge requests only: - merge_requests - -1-router-2-networks-2-hosts-kali: - stage: 1-router-2-networks-2-hosts-kali - # overwritting global before_script to create a virtual display before running test requiring a display - before_script: - - lsmod | grep "vbox" || /usr/lib/virtualbox/vboxdrv.sh setup - - pip3 install -r requirements.txt - - chmod +x test_topologies.sh - - Xvfb :1 -screen 0 800x600x16 & - script: - - DISPLAY=:1 ./test_topologies.sh ./testing/ci/config_5_1.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -2-routers-2-networks-2-hosts: - stage: 2-routers-2-networks-2-hosts - script: - - ./test_topologies.sh ./testing/ci/config_6_1.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -2-routers-4-networks-4-hosts: - stage: 2-routers-4-networks-4-hosts - script: - - ./test_topologies.sh ./testing/ci/config_7_1.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -3-routers-5-networks-5-hosts-br: - stage: 3-routers-5-networks-5-hosts-br - script: - - ./test_topologies.sh ./testing/ci/config_8_1.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests - -3-routers-5-networks-5-hosts-br-ansloc: - stage: 3-routers-5-networks-5-hosts-br-ansloc - script: - - ./test_topologies.sh ./testing/ci/config_9_1.yml - # run even when other stages fail - when: always - # only run for commits to master branch and merge requests - only: - - merge_requests \ No newline at end of file diff --git a/testing/ci/config_1_1.yml b/testing/ci/config_1_1.yml deleted file mode 100644 index 4f935e56f4b79c1e105435253523317658f3f09a..0000000000000000000000000000000000000000 --- a/testing/ci/config_1_1.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 1 (see wiki) with all basic optional arguments. - -topologies: - - file: ./topologies/0-routers-1-network-1-host.yml - arguments: - - no-arguments - - ansible_local - diff --git a/testing/ci/config_1_2.yml b/testing/ci/config_1_2.yml deleted file mode 100644 index 551833407d2a6796e21e125f0a7575c5c5df3374..0000000000000000000000000000000000000000 --- a/testing/ci/config_1_2.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 1 (see wiki) with all basic optional arguments and host machine's OS image changed to Debian Stretch. - -topologies: - - file: ./topologies/0-routers-1-network-1-host.yml - arguments: - - no-arguments - - ansible_local - boxes: - - debian/contrib-stretch64 - original_boxes: false - diff --git a/testing/ci/config_1_3.yml b/testing/ci/config_1_3.yml deleted file mode 100644 index 0fc96605be4bdfd77937ab3aceaa244399afe4ba..0000000000000000000000000000000000000000 --- a/testing/ci/config_1_3.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 1 (see wiki) with all basic optional arguments and host machine's OS image changed to Debian 9. - -topologies: - - file: ./topologies/0-routers-1-network-1-host.yml - arguments: - - no-arguments - - ansible_local - boxes: - - generic/debian9 - original_boxes: false - diff --git a/testing/ci/config_1_4.yml b/testing/ci/config_1_4.yml deleted file mode 100644 index 828d7d249042afb72982f38648f02600272f8e5b..0000000000000000000000000000000000000000 --- a/testing/ci/config_1_4.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 1 (see wiki) with all basic optional arguments and host machine's OS image changed to Ubuntu Xenial. - -topologies: - - file: ./topologies/0-routers-1-network-1-host.yml - arguments: - - no-arguments - - ansible_local - boxes: - - ubuntu/xenial64 - original_boxes: false diff --git a/testing/ci/config_1_5.yml b/testing/ci/config_1_5.yml deleted file mode 100644 index b45026ec9def2a222b9629f7a2ffecf9ecf9fefc..0000000000000000000000000000000000000000 --- a/testing/ci/config_1_5.yml +++ /dev/null @@ -1,11 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 1 (see wiki) with all basic optional arguments and host machine's OS image changed to MUNI KYPO Kali. - -topologies: - - file: ./topologies/0-routers-1-network-1-host.yml - arguments: - - no-arguments - - ansible_local - boxes: - - kali-2019.4 - original_boxes: false diff --git a/testing/ci/config_2_1.yml b/testing/ci/config_2_1.yml deleted file mode 100644 index faa77c687ee515b3bc391007f141512f5a2832b1..0000000000000000000000000000000000000000 --- a/testing/ci/config_2_1.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 3 (see wiki) with all basic optional arguments. - -topologies: - - file: ./topologies/1-router-1-network-1-host.yml - arguments: - - no-arguments - - ansible_local - - border_router - - [ansible_local, border_router] diff --git a/testing/ci/config_3_1.yml b/testing/ci/config_3_1.yml deleted file mode 100644 index 22af51e248f0f0c168808d5cfeb7aa10ae99c952..0000000000000000000000000000000000000000 --- a/testing/ci/config_3_1.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 4 (see wiki) with all basic optional arguments. - -topologies: - - file: ./topologies/1-router-2-networks-2-hosts.yml - arguments: - - no-arguments - - ansible_local - - border_router - - [ansible_local, border_router] \ No newline at end of file diff --git a/testing/ci/config_4_1.yml b/testing/ci/config_4_1.yml deleted file mode 100644 index 102e2bd4ee7dc165869255628f83f8516091b6ff..0000000000000000000000000000000000000000 --- a/testing/ci/config_4_1.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 4 (see wiki) with all basic optional arguments and host machine's OS images changed to Ubuntu Xenial. - -topologies: - - file: ./topologies/1-router-2-networks-2-hosts.yml - arguments: - - no-arguments - - ansible_local - - border_router - - [ansible_local, border_router] - boxes: - - ubuntu/xenial64 - original_boxes: false \ No newline at end of file diff --git a/testing/ci/config_5_1.yml b/testing/ci/config_5_1.yml deleted file mode 100644 index 0b6b505c9179973ae3360c6a514f68b03ce3fe76..0000000000000000000000000000000000000000 --- a/testing/ci/config_5_1.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 4 (see wiki) with all basic optional arguments and host machine's OS images changed to MUNI KYPO Kali. - -topologies: - - file: ./topologies/1-router-2-networks-2-hosts.yml - arguments: - - no-arguments - - ansible_local - - border_router - - [ansible_local, border_router] - boxes: - - kali-2019.4 - original_boxes: false \ No newline at end of file diff --git a/testing/ci/config_6_1.yml b/testing/ci/config_6_1.yml deleted file mode 100644 index b983f73e81bbaf04c27e539b0e919d99cc7c9de7..0000000000000000000000000000000000000000 --- a/testing/ci/config_6_1.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 5 (see wiki) with all basic optional arguments. - -topologies: - - file: ./topologies/2-routers-2-networks-2-hosts.yml - arguments: - - border_router - - [ansible_local, border_router] - \ No newline at end of file diff --git a/testing/ci/config_7_1.yml b/testing/ci/config_7_1.yml deleted file mode 100644 index b787048bde7f696cdfcd42ef5cfa5d86587cf971..0000000000000000000000000000000000000000 --- a/testing/ci/config_7_1.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 6 (see wiki) with all basic optional arguments. - -topologies: - - file: ./topologies/2-routers-4-networks-4-hosts.yml - arguments: - - border_router - - [ansible_local, border_router] - diff --git a/testing/ci/config_8_1.yml b/testing/ci/config_8_1.yml deleted file mode 100644 index 35cf46a63685004fb3fbf8c947f7519374dc8a86..0000000000000000000000000000000000000000 --- a/testing/ci/config_8_1.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 7 (see wiki) with the border_router optional argument. - -topologies: - - file: ./topologies/3-routers-5-networks-5-hosts.yml - arguments: - - border_router \ No newline at end of file diff --git a/testing/ci/config_9_1.yml b/testing/ci/config_9_1.yml deleted file mode 100644 index c65cddc7ed35e87e4026e2ae330fabb9e85550b7..0000000000000000000000000000000000000000 --- a/testing/ci/config_9_1.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration file for integration testing. -# Tests example topology 7 (see wiki) with the border_router and ansible_local optional arguments. - -topologies: - - file: ./topologies/3-routers-5-networks-5-hosts.yml - arguments: - - [ansible_local, border_router] \ No newline at end of file diff --git a/testing/ci/config_debian.yml b/testing/ci/config_debian.yml new file mode 100644 index 0000000000000000000000000000000000000000..fcca977a5341630a38934697dc857d43aa9c2a94 --- /dev/null +++ b/testing/ci/config_debian.yml @@ -0,0 +1,21 @@ +topologies: + - file: ./topologies/0-routers-1-network-1-host.yml + arguments: + - no-arguments + - ansible_local + - file: ./topologies/1-router-1-network-1-host.yml + arguments: + - no-arguments + - ansible_local + - border_router + - [ansible_local, border_router] + - file: ./topologies/1-router-2-networks-2-hosts.yml + arguments: + - no-arguments + - ansible_local + - border_router + - [ansible_local, border_router] + - file: ./topologies/2-routers-2-networks-2-hosts.ym + arguments: + - border_router + - [ansible_local, border_router] \ No newline at end of file diff --git a/testing/ci/config_kali_2020.yml b/testing/ci/config_kali_2020.yml new file mode 100644 index 0000000000000000000000000000000000000000..fb6f7cd3665e63e70d6d9828874ce550e1c57607 --- /dev/null +++ b/testing/ci/config_kali_2020.yml @@ -0,0 +1,33 @@ +topologies: + - file: ./topologies/0-routers-1-network-1-host.yml + arguments: + - no-arguments + - ansible_local + boxes: + - munikypo/kali-2020.4 + original_boxes: false + - file: ./topologies/1-router-1-network-1-host.yml + arguments: + - no-arguments + - ansible_local + - border_router + - [ansible_local, border_router] + boxes: + - munikypo/kali-2020.4 + original_boxes: false + - file: ./topologies/1-router-2-networks-2-hosts.yml + arguments: + - no-arguments + - ansible_local + - border_router + - [ansible_local, border_router] + boxes: + - munikypo/kali-2020.4 + original_boxes: false + - file: ./topologies/2-routers-2-networks-2-hosts.ym + arguments: + - border_router + - [ansible_local, border_router] + boxes: + - munikypo/kali-2020.4 + original_boxes: false \ No newline at end of file diff --git a/testing/ci/config_windows_server.yml b/testing/ci/config_windows_server.yml new file mode 100644 index 0000000000000000000000000000000000000000..fe6679be05d333f6aad1796eebdd3f72cb72afe4 --- /dev/null +++ b/testing/ci/config_windows_server.yml @@ -0,0 +1,27 @@ +topologies: + - file: ./topologies/0-routers-1-network-1-host.yml + arguments: + - ansible_local + boxes: + - munikypo/windows-server-2019 + original_boxes: false + - file: ./topologies/1-router-1-network-1-host.yml + arguments: + - ansible_local + - [ansible_local, border_router] + boxes: + - munikypo/windows-server-2019 + original_boxes: false + - file: ./topologies/1-router-2-networks-2-hosts.yml + arguments: + - ansible_local + - [ansible_local, border_router] + boxes: + - munikypo/windows-server-2019 + original_boxes: false + - file: ./topologies/2-routers-2-networks-2-hosts.ym + arguments: + - [ansible_local, border_router] + boxes: + - munikypo/windows-server-2019 + original_boxes: false \ No newline at end of file