Skip to content
Snippets Groups Projects
Commit a16b0338 authored by Shubham Sharma's avatar Shubham Sharma
Browse files

ci/cd setup

    - fix for install dependency input required.
    - iptables dependency added
parent 91110a88
Branches
No related tags found
1 merge request!4urlfilter CI/CD setup
Pipeline #13584 passed
include:
- project: 'iopsys/gitlab-ci-pipeline'
file: '/static-code-analysis.yml'
privileged: true
stages:
- static_code_analysis
- functional_test
variables:
DEBUG: 'TRUE'
SOURCE_FOLDER: "."
run_functional_test:
stage: functional_test
image: iopsys/code-analysis-dev
allow_failure: false
script:
- "./gitlab-ci/install-dependencies.sh"
- "./gitlab-ci/setup.sh"
- "./gitlab-ci/functional-test.sh"
artifacts:
when: always
paths:
- functional-test-coverage.xml
- timestamp.log
#!/bin/bash
echo "Functional Test"
pwd
cd urlfilter
make coverage -C ./
supervisorctl status all
supervisorctl update
sleep 3
supervisorctl status all
#make functional-test -C ./
supervisorctl stop all
supervisorctl status
#report part
#GitLab-CI output
gcovr -r .
# Artefact
gcovr -r . --xml -o ./functional-test-coverage.xml
date +%s > timestamp.log
#!/bin/bash
echo "install dependencies"
pwd
# libnetfilter-queue
sudo apt-get update
sudo yes | apt-get install libnetfilter-queue-dev
sudo yes | apt-get install iptables
iptables -L FORWARD|grep -iqE "NFQUEUE"
if [ "$?" -ne 0 ]; then
echo "Applying firewall rule to setup NFQUEUE on forward traffic for urlfiltering"
iptables -I FORWARD -p tcp --dport 80 -j NFQUEUE --queue-num 0
else
echo "Error : Unmet dependency - iptables not found."
fi
sudo ldconfig
[program:ubusd]
command=/bin/bash -c "/usr/sbin/ubusd"
[program:urlfilter]
command=/bin/bash -c "mkdir -p /opt/work && /usr/bin/valgrind --xml=yes --xml-file=/opt/work/memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/urlfilter/urlfilter"
#!/bin/bash
echo "Setup script"
pwd
cp -r ./test/files/etc/* /etc/
cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/
ls /etc/config/
ls /usr/share/rpcd/schemas/
ls /etc/supervisor/conf.d/
config globals 'globals'
option enable '1'
option global_blacklist '1'
list gbl_url 'abc.com'
list gbl_url 'def.com'
list gbl_url 'facebook.com'
list gbl_url 'instagram.com'
config profile 'homeoffice'
list whitelist_url 'facebook.com'
list whitelist_url 'instagram.com'
config profile 'kids'
list blacklist_url 'youtube.com'
list blacklist_url 'game.com'
config filter 'f1'
option enable '1'
option profile 'kids'
list macaddr '00:11:22:33:44:55'
list macaddr 'AA:BB:CC:33:44:55'
list day 'Monday'
list day 'Tuesday'
list day 'Wednesday'
list day 'Thursday'
list day 'Friday'
option start_time '20:00'
option duration '64800'
config filter 'f2'
option enable '1'
option profile 'homeoffice'
list macaddr 'CC:DD:EE:33:44:55'
list macaddr 'EE:AA:BB:11:22:33'
# Makefile for qosmngr
CC=gcc
GCOV = gcov
SRC_DIR = src
CODECOVERAGE_SRC = $(addprefix $(SRC_DIR)/, filter.c config.c )
PROG = urlfilter
PROG_CFLAGS = $(CFLAGS) -Wall -fstrict-aliasing -fPIC
......@@ -19,5 +21,10 @@ all: $(PROG)
$(PROG): $(OBJS)
$(CC) -o $@ $^ $(PROG_LDFLAGS)
coverage: CFLAGS += -g -O0 -fprofile-arcs -ftest-coverage -fPIC
coverage: LDFLAGS += --coverage
coverage: $(PROG)
$(foreach testprog, $(CODECOVERAGE_SRC), $(GCOV) $(testprog);)
clean:
rm -f urlfilter *.o
rm -f $(PROG) $(addprefix $(SRC_DIR)/, *.o) *.log *.xml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment