Skip to content

Commit

Permalink
Merge branch 'master' into improvement/redis-retryonerror
Browse files Browse the repository at this point in the history
  • Loading branch information
troll-os committed May 30, 2024
2 parents 9057197 + 6343b82 commit d21d16c
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 88 deletions.
68 changes: 36 additions & 32 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ kind: pipeline
name: opencti-tests

steps:
- name: branch-definition
- name: dependencies-checkout
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
environment:
GITHUB_TOKEN:
from_secret: github_token
commands:
- apk add git
- export OPENCTI_BRANCH=$DRONE_SOURCE_BRANCH
- if [ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git refs/heads/$DRONE_SOURCE_BRANCH)")" != '' ]; then CLIENT_PYTHON_BRANCH=$DRONE_SOURCE_BRANCH; else CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git refs/heads/opencti/$DRONE_SOURCE_BRANCH)")" != '' ]] && echo opencti/$DRONE_SOURCE_BRANCH || echo 'master'); fi
- if [ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/connectors.git refs/heads/$DRONE_SOURCE_BRANCH)")" != '' ]; then CONNECTOR_BRANCH=$DRONE_SOURCE_BRANCH; else CONNECTOR_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/connectors.git refs/heads/opencti/$DRONE_SOURCE_BRANCH)")" != '' ]] && echo opencti/$DRONE_SOURCE_BRANCH || echo 'master'); fi
- echo "OPENCTI_BRANCH=$DRONE_SOURCE_BRANCH" >> variables
- echo "CLIENT_PYTHON_BRANCH=$CLIENT_PYTHON_BRANCH" >> variables
- echo "CONNECTOR_BRANCH=$CONNECTOR_BRANCH" >> variables
- echo [INFO] Using opencti@$OPENCTI_BRANCH, client-python@$CLIENT_PYTHON_BRANCH and connectors@$CONNECTOR_BRANCH
- apk add git github-cli
- chmod 777 scripts/*
- ./scripts/clone-dependencies.sh ${DRONE_SOURCE_BRANCH} $(pwd) ${DRONE_PULL_REQUEST}
- ls -lart

- name: api-tests
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
Expand Down Expand Up @@ -44,22 +43,20 @@ steps:
commands:
- apk add build-base git libffi-dev cargo
- pip3 install --upgrade setuptools
- source ./variables
- cd opencti-platform
- echo [INFO] Using opencti@$OPENCTI_BRANCH, client-python@$CLIENT_PYTHON_BRANCH and connectors@$CONNECTOR_BRANCH
- cd ..
- git clone -b $CONNECTOR_BRANCH https://github.com/OpenCTI-Platform/connectors.git opencti-connectors
- cd opencti-connectors
- CONNECTOR_COMMIT=$(git rev-parse --short HEAD)
- echo [INFO] using connectors@$CONNECTOR_BRANCH:$CONNECTOR_COMMIT
- cd ../opencti-platform/opencti-graphql
- echo "DRONE_WORKSPACE=$DRONE_WORKSPACE"
- echo "DRONE_WORKSPACE=${DRONE_WORKSPACE}"
- cd "$DRONE_WORKSPACE/opencti-platform/opencti-graphql"
- yarn install
- yarn build
- yarn check-ts
- yarn lint
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- echo [INFO] using package client-python@$CLIENT_PYTHON_BRANCH
- cd "$DRONE_WORKSPACE/client-python"
- echo "[INFO] using client-python on branch $(git branch --show-current)"
- pip3 install --upgrade --force .
- cd "$DRONE_WORKSPACE/opencti-platform/opencti-graphql"
- NODE_OPTIONS=--max_old_space_size=8192 yarn test
depends_on:
- dependencies-checkout

- name: api-coverage
image: plugins/codecov
Expand Down Expand Up @@ -204,13 +201,15 @@ services:
SUBSCRIPTION_SCHEDULER__ENABLED: false
commands:
- sleep 10
- ls -lart
- cp -a opencti-platform/* /tmp/raw-start-platform/
- source ./variables
- apk add build-base git libffi-dev cargo
- cd /tmp/raw-start-platform/opencti-graphql
- yarn install
- yarn install:python
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- cd "$DRONE_WORKSPACE/client-python"
- pip3 install --upgrade --force .
- cd /tmp/raw-start-platform/opencti-graphql
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
- name: opencti-live-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
Expand All @@ -235,12 +234,13 @@ services:
commands:
- sleep 10
- cp -a opencti-platform/* /tmp/live-start-platform/
- source ./variables
- apk add build-base git libffi-dev cargo
- cd /tmp/live-start-platform/opencti-graphql
- yarn install
- yarn install:python
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- cd "$DRONE_WORKSPACE/client-python"
- pip3 install --upgrade --force .
- cd /tmp/live-start-platform/opencti-graphql
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
- name: opencti-direct-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
Expand All @@ -265,12 +265,13 @@ services:
commands:
- sleep 10
- cp -a opencti-platform/* /tmp/direct-start-platform/
- source ./variables
- apk add build-base git libffi-dev cargo
- cd /tmp/direct-start-platform/opencti-graphql
- yarn install
- yarn install:python
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- cd "$DRONE_WORKSPACE/client-python"
- pip3 install --upgrade --force .
- cd /tmp/direct-start-platform/opencti-graphql
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
- name: opencti-direct-worker
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
Expand All @@ -284,12 +285,13 @@ services:
commands:
- sleep 10
- cp -a opencti-worker /tmp/direct-start-worker
- source ./variables
- apk add build-base git libffi-dev cargo
- while ! nc -z opencti-direct-start 4300 ; do sleep 1 ; done
- cd /tmp/direct-start-worker
- pip3 install -r src/requirements.txt
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- cd "$DRONE_WORKSPACE/client-python"
- pip3 install --upgrade --force .
- cd /tmp/direct-start-worker
- python3 src/worker.py
- name: opencti-restore-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
Expand All @@ -315,11 +317,12 @@ services:
- sleep 10
- cp -a opencti-platform/* /tmp/restore-start-platform/
- apk add build-base git libffi-dev cargo
- source ./variables
- cd /tmp/restore-start-platform/opencti-graphql
- yarn install
- yarn install:python
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- cd "$DRONE_WORKSPACE/client-python"
- pip3 install --upgrade --force .
- cd /tmp/restore-start-platform/opencti-graphql
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
- name: opencti-e2e-start
image: nikolaik/python-nodejs:python3.11-nodejs20-alpine
Expand Down Expand Up @@ -349,8 +352,9 @@ services:
- yarn install
- yarn install:python
- BRANCH=$(echo $DRONE_COMMIT_BRANCH | cut -d "/" -f 2)
- CLIENT_PYTHON_BRANCH=$([[ "$(echo "$(git ls-remote --heads https://github.com/OpenCTI-Platform/client-python.git opencti/$BRANCH)")" != '' ]] && echo opencti/$BRANCH || echo 'master')
- pip3 install --upgrade --force git+https://github.com/OpenCTI-Platform/client-python@$CLIENT_PYTHON_BRANCH
- cd "$DRONE_WORKSPACE/client-python"
- pip3 install --upgrade --force .
- cd /tmp/e2e-start-platform/opencti-graphql
- yarn build:dev
- yarn wait-api && yarn insert:dev &
- NODE_OPTIONS=--max_old_space_size=8192 yarn start
Expand Down
7 changes: 3 additions & 4 deletions opencti-platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ RUN set -ex \
-S \
-u "${UID}" \
"${USERNAME}" \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs'

RUN mkdir -p /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support \
&& chmod -R 0733 /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/telemetry' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/.support'

VOLUME ["/opt/opencti/logs", "/opt/opencti/telemetry", "/opt/opencti/.support"]

Expand Down
7 changes: 3 additions & 4 deletions opencti-platform/Dockerfile_circleci
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ RUN set -ex \
-S \
-u "${UID}" \
"${USERNAME}" \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs'

RUN mkdir -p /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support \
&& chmod -R 0733 /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/telemetry' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/.support'

VOLUME ["/opt/opencti/logs", "/opt/opencti/telemetry", "/opt/opencti/.support"]

Expand Down
7 changes: 3 additions & 4 deletions opencti-platform/Dockerfile_circleci_fips
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ RUN set -ex \
-S \
-u "${UID}" \
"${USERNAME}" \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs'

RUN mkdir -p /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support \
&& chmod -R 0733 /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/telemetry' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/.support'

VOLUME ["/opt/opencti/logs", "/opt/opencti/telemetry", "/opt/opencti/.support"]

Expand Down
7 changes: 3 additions & 4 deletions opencti-platform/Dockerfile_fips
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ RUN set -ex \
-S \
-u "${UID}" \
"${USERNAME}" \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs'

RUN mkdir -p /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support \
&& chmod -R 0733 /opt/opencti/logs /opt/opencti/telemetry /opt/opencti/.support
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/logs' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/telemetry' \
&& install -o "${UID}" -g "${GID}" -m 0755 -d '/opt/opencti/.support'

VOLUME ["/opt/opencti/logs", "/opt/opencti/telemetry", "/opt/opencti/.support"]

Expand Down
2 changes: 1 addition & 1 deletion opencti-platform/Dockerfile_ga
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine AS app
FROM node:20-alpine3.20 AS app

WORKDIR /opt
RUN apk add tini python3 py3-pip python3-dev git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import React, { useMemo } from 'react';
import { Link, Route, Routes, Navigate, useParams, useLocation } from 'react-router-dom';
import { Link, Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { graphql, useSubscription } from 'react-relay';
import Box from '@mui/material/Box';
import Tabs from '@mui/material/Tabs';
Expand Down Expand Up @@ -129,6 +129,7 @@ const RootGrouping = () => {
enableQuickSubscription={true}
enableQuickExport={true}
enableAskAi={true}
redirectToContent={true}
/>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class RootNote extends Component {
<ContainerHeader
container={note}
PopoverComponent={<NotePopover note={note} />}
redirectToContent={true}
/>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @ts-nocheck
import React, { useMemo } from 'react';
import { graphql, useSubscription } from 'react-relay';
import { Link, Route, Routes, useParams, useLocation, Navigate } from 'react-router-dom';
import { Link, Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { GraphQLSubscriptionConfig } from 'relay-runtime';
import Box from '@mui/material/Box';
import Tabs from '@mui/material/Tabs';
Expand Down Expand Up @@ -131,6 +131,7 @@ const RootReport = () => {
enableQuickExport={true}
enableAskAi={true}
overview={isOverview}
redirectToContent={true}
/>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @ts-nocheck
import React, { useMemo } from 'react';
import { graphql, usePreloadedQuery, useSubscription } from 'react-relay';
import { Link, Route, Routes, useParams, useLocation, Navigate } from 'react-router-dom';
import { Link, Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { GraphQLSubscriptionConfig } from 'relay-runtime';
import Box from '@mui/material/Box';
import Tabs from '@mui/material/Tabs';
Expand Down Expand Up @@ -125,6 +125,7 @@ const RootCaseIncidentComponent = ({ queryRef, caseId }) => {
PopoverComponent={<CaseIncidentPopover id={caseData.id} />}
enableQuickSubscription={true}
enableAskAi={true}
redirectToContent={true}
/>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import React, { useMemo } from 'react';
import { Link, Navigate, Route, Routes, useParams, useLocation } from 'react-router-dom';
import { Link, Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { graphql, usePreloadedQuery, useSubscription } from 'react-relay';
import { GraphQLSubscriptionConfig } from 'relay-runtime';
import Box from '@mui/material/Box';
Expand Down Expand Up @@ -122,6 +122,7 @@ const RootCaseRfiComponent = ({ queryRef, caseId }) => {
PopoverComponent={<CaseRfiPopover id={caseData.id} />}
enableQuickSubscription={true}
enableAskAi={true}
redirectToContent={true}
/>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import React, { useMemo } from 'react';
import { Link, Route, Routes, useParams, useLocation, Navigate } from 'react-router-dom';
import { Link, Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { graphql, usePreloadedQuery, useSubscription } from 'react-relay';
import { GraphQLSubscriptionConfig } from 'relay-runtime';
import Box from '@mui/material/Box';
Expand Down Expand Up @@ -121,6 +121,7 @@ const RootCaseRftComponent = ({ queryRef, caseId }) => {
PopoverComponent={<CaseRftPopover id={caseData.id} />}
enableQuickSubscription={true}
enableAskAi={true}
redirectToContent={true}
/>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const RootFeedbackComponent = ({ queryRef, caseId }) => {
enableQuickSubscription
enableManageAuthorizedMembers={canManage}
authorizedMembersMutation={feedbackAuthorizedMembersMutation}
redirectToContent={true}
/>
<Box
sx={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import React, { useMemo } from 'react';
import { Link, Route, Routes, useParams, useLocation } from 'react-router-dom';
import { Link, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { graphql, usePreloadedQuery, useSubscription } from 'react-relay';
import { GraphQLSubscriptionConfig } from 'relay-runtime';
import Box from '@mui/material/Box';
Expand Down Expand Up @@ -98,6 +98,7 @@ const RootTaskComponent = ({ queryRef, taskId }) => {
container={data}
PopoverComponent={<TasksPopover id={data.id} />}
enableSuggestions={false}
redirectToContent={true}
/>
<Box
sx={{
Expand Down
Loading

0 comments on commit d21d16c

Please sign in to comment.