diff --git a/.drone.yml b/.drone.yml index 59fc2a145..9bdf616aa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,56 +2,217 @@ kind: pipeline type: docker name: unit + workspace: path: /cgrates steps: - name: unit pull: never - image: cgrates-integration + image: cgrates-it-entrypoint commands: - docker-entrypoint.sh - ./test.sh - name: notify pull: never - image: trial97/drone-email + image: drillster/drone-email settings: from: cgrates.test01@gmail.com - credentials: - from_secret: credentials - token: - from_secret: token + host: smtp.gmail.com + username: + from_secret: email_username + password: + from_secret: email_password + subject: > + [{{ build.status }}] + {{ repo.owner }}/{{ repo.name }} + ({{ commit.branch }}) + body: > + Build number: # {{ build.number }} + Build link: {{ build.link }} + Build started: {{ build.started }} + Build ended: {{ build.finished }} + Commit author: {{ commit.author.name }} + Commit message: {{ commit.message }} + Commit branch: {{ commit.branch }} + Commit link: {{ commit.link }} + recipients_file: recipients + recipients_only: true when: - status: [ changed, failure ] + status: failure + +--- +kind: pipeline +type: docker +name: integration-internal -# --- -# kind: pipeline -# type: docker -# name: default +workspace: + path: /cgrates -# workspace: -# path: /cgrates +steps: +- name: integration-internal + pull: never + image: cgrates-it-entrypoint + commands: + - docker-entrypoint.sh + - ./integration_test.sh -dbtype=*internal +- name: notify + pull: never + image: drillster/drone-email + settings: + from: cgrates.test01@gmail.com + host: smtp.gmail.com + username: + from_secret: email_username + password: + from_secret: email_password + subject: > + [{{ build.status }}] + {{ repo.owner }}/{{ repo.name }} + ({{ commit.branch }}) + body: > + Build number: # {{ build.number }} + Build link: {{ build.link }} + Build started: {{ build.started }} + Build ended: {{ build.finished }} + Commit author: {{ commit.author.name }} + Commit message: {{ commit.message }} + Commit branch: {{ commit.branch }} + Commit link: {{ commit.link }} + recipients_file: recipients + recipients_only: true + when: + status: failure -# steps: -# - name: integration -# pull: never -# image: cgrates-integration -# commands: -# - docker-entrypoint.sh -# - ./integration_test.sh +--- +kind: pipeline +type: docker +name: integration-mysql -# - name: notify -# pull: never -# image: trial97/drone-email -# settings: -# from: cgrates.test01@gmail.com -# credentials: -# from_secret: credentials -# token: -# from_secret: token -# when: -# status: [ changed, failure ] -# depends_on: -# - unit +workspace: + path: /cgrates + +steps: +- name: integration-mysql + pull: never + image: cgrates-it-entrypoint + commands: + - docker-entrypoint.sh + - ./integration_test.sh -dbtype=*mysql +- name: notify + pull: never + image: drillster/drone-email + settings: + from: cgrates.test01@gmail.com + host: smtp.gmail.com + username: + from_secret: email_username + password: + from_secret: email_password + subject: > + [{{ build.status }}] + {{ repo.owner }}/{{ repo.name }} + ({{ commit.branch }}) + body: > + Build number: # {{ build.number }} + Build link: {{ build.link }} + Build started: {{ build.started }} + Build ended: {{ build.finished }} + Commit author: {{ commit.author.name }} + Commit message: {{ commit.message }} + Commit branch: {{ commit.branch }} + Commit link: {{ commit.link }} + recipients_file: recipients + recipients_only: true + when: + status: failure + +--- +kind: pipeline +type: docker +name: integration-mongo + + +workspace: + path: /cgrates + +steps: +- name: integration-mongo + pull: never + image: cgrates-it-entrypoint + commands: + - docker-entrypoint.sh + - ./integration_test.sh -dbtype=*mongo +- name: notify + pull: never + image: drillster/drone-email + settings: + from: cgrates.test01@gmail.com + host: smtp.gmail.com + username: + from_secret: email_username + password: + from_secret: email_password + subject: > + [{{ build.status }}] + {{ repo.owner }}/{{ repo.name }} + ({{ commit.branch }}) + body: > + Build number: # {{ build.number }} + Build link: {{ build.link }} + Build started: {{ build.started }} + Build ended: {{ build.finished }} + Commit author: {{ commit.author.name }} + Commit message: {{ commit.message }} + Commit branch: {{ commit.branch }} + Commit link: {{ commit.link }} + recipients_file: recipients + recipients_only: true + when: + status: failure + +--- +kind: pipeline +type: docker +name: integration-postgres + + +workspace: + path: /cgrates + +steps: +- name: integration-postgres + pull: never + image: cgrates-it-entrypoint + commands: + - docker-entrypoint.sh + - ./integration_test.sh -dbtype=*postgres +- name: notify + pull: never + image: drillster/drone-email + settings: + from: cgrates.test01@gmail.com + host: smtp.gmail.com + username: + from_secret: email_username + password: + from_secret: email_password + subject: > + [{{ build.status }}] + {{ repo.owner }}/{{ repo.name }} + ({{ commit.branch }}) + body: > + Build number: # {{ build.number }} + Build link: {{ build.link }} + Build started: {{ build.started }} + Build ended: {{ build.finished }} + Commit author: {{ commit.author.name }} + Commit message: {{ commit.message }} + Commit branch: {{ commit.branch }} + Commit link: {{ commit.link }} + recipients_file: recipients + recipients_only: true + when: + status: failure \ No newline at end of file diff --git a/data/docker/integration/Dockerfile b/data/docker/integration/Dockerfile index 65a066ad0..2b2d66c2d 100644 --- a/data/docker/integration/Dockerfile +++ b/data/docker/integration/Dockerfile @@ -4,7 +4,7 @@ RUN groupadd -r mongodb && useradd -r -g mongodb mongodb RUN groupadd -r redis && useradd -r -g redis redis RUN groupadd -r kafka && useradd -r -g kafka kafka -RUN mkdir -p /usr/share/man/man1 /var/spool/cgrates/ers/in /var/spool/cgrates/ers/out /var/spool/cgrates/cdre/csv /var/spool/cgrates/cdre/fwv /var/spool/cgrates/tpe /var/spool/cgrates/failed_posts /var/spool/cgrates/analyzers /run /data/configdb /data/db /kafka /logs +RUN mkdir -p /usr/share/cgrates/conf /usr/share/man/man1 /var/spool/cgrates/ers/in /var/spool/cgrates/ers/out /var/spool/cgrates/cdre/csv /var/spool/cgrates/cdre/fwv /var/spool/cgrates/tpe /var/spool/cgrates/failed_posts /var/spool/cgrates/analyzers /run /data/configdb /data/db /kafka /logs RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections @@ -18,8 +18,11 @@ RUN echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | RUN wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - RUN echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list -RUN wget -qO - https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc | apt-key add - -RUN printf "deb https://dl.bintray.com/rabbitmq-erlang/debian buster erlang\ndeb https://dl.bintray.com/rabbitmq/debian buster main" | tee /etc/apt/sources.list.d/bintray.rabbitmq.list +RUN wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb +RUN dpkg -i erlang-solutions_1.0_all.deb +RUN apt-get update +RUN apt-get install -y erlang erlang-nox +RUN curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | bash RUN apt-get update RUN apt-get install -y mongodb-org postgresql rabbitmq-server diff --git a/data/docker/integration/docker-entrypoint.sh b/data/docker/integration/docker-entrypoint.sh index c8b9aa57f..55a8426c6 100755 --- a/data/docker/integration/docker-entrypoint.sh +++ b/data/docker/integration/docker-entrypoint.sh @@ -7,7 +7,8 @@ export KAFKA_HEAP_OPTS="-Xmx100M -Xms100M" /kafka/bin/kafka-server-start.sh -daemon /kafka/config/server.properties rsyslogd -f /etc/rsyslogd.conf -pg_ctlcluster 13 main start & +version=$(ls /var/lib/postgresql) +pg_ctlcluster $version main start & mongod --bind_ip 127.0.0.1 --logpath /logs/mongodb.log & redis-server /etc/redis/redis.conf & MYSQL_ROOT_PASSWORD="CGRateS.org" /scripts/mariadb-ep.sh mysqld > /logs/mariadb_script.log 2>&1 @@ -56,4 +57,4 @@ mysql -u root -pCGRateS.org -h localhost < /scripts/mysql/create_db_with_users_e mysql -u root -pCGRateS.org -h localhost -D cgrates < /scripts/mysql/create_cdrs_tables.sql > /dev/null 2>&1 mysql -u root -pCGRateS.org -h localhost -D cgrates < /scripts/mysql/create_tariffplan_tables.sql > /dev/null 2>&1 -ln -s /cgrates/data /usr/share/cgrates \ No newline at end of file +cp -r data/. /usr/share/cgrates \ No newline at end of file diff --git a/data/docker/integration/scripts/mongo b/data/docker/integration/scripts/mongo new file mode 120000 index 000000000..221af3976 --- /dev/null +++ b/data/docker/integration/scripts/mongo @@ -0,0 +1 @@ +../../../storage/mongo/ \ No newline at end of file diff --git a/data/docker/integration/scripts/mysql b/data/docker/integration/scripts/mysql new file mode 120000 index 000000000..50ba904e1 --- /dev/null +++ b/data/docker/integration/scripts/mysql @@ -0,0 +1 @@ +../../../storage/mysql/ \ No newline at end of file diff --git a/data/docker/integration/scripts/mysql/create_db_with_users_extra.sql b/data/docker/integration/scripts/mysql/create_db_with_users_extra.sql deleted file mode 100644 index 2d9e5c601..000000000 --- a/data/docker/integration/scripts/mysql/create_db_with_users_extra.sql +++ /dev/null @@ -1,9 +0,0 @@ - --- --- Sample db and users creation. Replace here with your own details --- - -CREATE DATABASE cgrates2; - -GRANT ALL on cgrates.* TO 'cgrates'@'127.0.0.1' IDENTIFIED BY 'CGRateS.org'; -GRANT ALL on cgrates2.* TO 'cgrates'@'127.0.0.1' IDENTIFIED BY 'CGRateS.org'; diff --git a/data/docker/integration/scripts/postgres b/data/docker/integration/scripts/postgres new file mode 120000 index 000000000..a019a3978 --- /dev/null +++ b/data/docker/integration/scripts/postgres @@ -0,0 +1 @@ +../../../storage/postgres/ \ No newline at end of file diff --git a/recipients b/recipients new file mode 100644 index 000000000..b49bf6477 --- /dev/null +++ b/recipients @@ -0,0 +1,5 @@ +andrei.andronache@itsyscom.com +alexandru.tripon@itsyscom.com +ionut.boangiu@itsyscom.com +adrian.porosnicu@itsyscom.com +nickolas.filip@itsyscom.com