Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Elasticsearch tests #1508

Elasticsearch tests

Elasticsearch tests #1508

Workflow file for this run

# This file is part of IVRE.
# Copyright 2011 - 2025 Pierre LALET <[email protected]>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IVRE is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.
name: Elasticsearch tests
on:
workflow_run:
workflows: [MongoDB tests]
types: [completed]
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'master')}}
jobs:
build:
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
mongodb-version: ['5.0']
elastic-version: ['7.17.22', '8.0.1', '8.14.1']
steps:
- name: Git checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Start MongoDB
uses: supercharge/[email protected]
with:
mongodb-version: ${{ matrix.mongodb-version }}
- name: Start Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: ${{ matrix.elastic-version }}
security-enabled: false
- run: pip install -r requirements-mongo.txt
- name: Install MongoDB tools (mongorestore)
run: |
wget -qO- https://www.mongodb.org/static/pgp/server-8.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-8.0.asc > /dev/null
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list > /dev/null
sudo apt-get -q update
sudo apt-get -qy install mongodb-org-tools
- run: pip install -r requirements-elastic.txt
- name: Install IVRE
uses: ./.github/actions/install
- run: curl http://127.0.0.1:9200
- run: echo 'DB_VIEW = "elastic://ivre@localhost:9200/ivre"' >> ~/.ivre.conf
- run: python -c 'import json, pymongo; print(json.dumps(pymongo.MongoClient().server_info(), indent=4))'
- name: Initialize IVRE databases
run: for cli in ipinfo scancli view; do ivre $cli --init < /dev/null; done
- name: Get MongoDB dump artifacts
uses: actions/download-artifact@v4
with:
name: backup_nmap_passive
path: ./backup_nmap_passive.tar.bz2
run-id: ${{ github.event.workflow_run.id }}
- run: tar jxf ./backup_nmap_passive.tar.bz2
- run: cd tests && python tests.py
env:
CI: true
DB: elastic
- run: cat /tmp/webserver.log
if: failure()