Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ steps:
SMTP__ENABLED: false
PYTHONUNBUFFERED: 1
commands:
- if [ -f $DRONE_WORKSPACE/api-test.skip ]; then echo "API TESTS ARE SKIPPED" ; exit 0; fi
- apk add build-base git libffi-dev cargo
- pip3 install --upgrade setuptools
- cd "$DRONE_WORKSPACE/client-python"
Expand All @@ -103,6 +104,7 @@ steps:

- name: api-coverage
image: plugins/codecov
failure: ignore
settings:
token:
from_secret: codecov_token
Expand Down Expand Up @@ -282,6 +284,7 @@ services:
SMTP__ENABLED: false
commands:
- sleep 10
- if [ -f $DRONE_WORKSPACE/api-test.skip ]; then echo "API TESTS ARE SKIPPED" ; exit 0; fi
- ls -lart
- apk add build-base git libffi-dev cargo
- cp -a $DRONE_WORKSPACE/platform-reference/* /tmp/raw-start-platform/
Expand Down Expand Up @@ -321,6 +324,7 @@ services:
SMTP__ENABLED: false
commands:
- sleep 10
- if [ -f $DRONE_WORKSPACE/api-test.skip ]; then echo "API TESTS ARE SKIPPED" ; exit 0; fi
- apk add build-base git libffi-dev cargo
- cp -a $DRONE_WORKSPACE/platform-reference/* /tmp/live-start-platform/
- cd "$DRONE_WORKSPACE/client-python"
Expand Down Expand Up @@ -359,6 +363,7 @@ services:
SMTP__ENABLED: false
commands:
- sleep 10
- if [ -f $DRONE_WORKSPACE/api-test.skip ]; then echo "API TESTS ARE SKIPPED" ; exit 0; fi
- apk add build-base git libffi-dev cargo
- cp -a $DRONE_WORKSPACE/platform-reference/* /tmp/direct-start-platform/
- cd "$DRONE_WORKSPACE/client-python"
Expand All @@ -377,6 +382,7 @@ services:
WORKER_LOG_LEVEL: info
commands:
- sleep 10
- if [ -f $DRONE_WORKSPACE/api-test.skip ]; then echo "API TESTS ARE SKIPPED" ; exit 0; fi
- apk add build-base git libffi-dev cargo
- cp -a opencti-worker /tmp/direct-start-worker
- cd "$DRONE_WORKSPACE/client-python"
Expand All @@ -397,6 +403,7 @@ services:
WORKER_LOG_LEVEL: info
commands:
- sleep 10
- if [ -f $DRONE_WORKSPACE/api-test.skip ]; then echo "API TESTS ARE SKIPPED" ; exit 0; fi
- cp -a opencti-worker /tmp/opencti-test-worker
- apk add build-base git libffi-dev cargo
- cd "$DRONE_WORKSPACE/client-python"
Expand Down Expand Up @@ -436,6 +443,7 @@ services:
SMTP__ENABLED: false
commands:
- sleep 10
- if [ -f $DRONE_WORKSPACE/api-test.skip ]; then echo "API TESTS ARE SKIPPED" ; exit 0; fi
- apk add build-base git libffi-dev cargo
- cp -a $DRONE_WORKSPACE/platform-reference/* /tmp/restore-start-platform/
- cd "$DRONE_WORKSPACE/client-python"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ArtifactImportPage from '../model/ArtifactImport.pageModel';
import { expect, test } from '../fixtures/baseFixtures';

test('Artifact error message in the absence of a file.', async ({ page }) => {

const artifactPage = new ArtifactPage(page);
const artifactImport = new ArtifactImportPage(page);
await page.goto('/dashboard/observations/artifacts');
Expand Down
39 changes: 35 additions & 4 deletions scripts/clone-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ clone_for_pr_build() {
echo "[CLONE-DEPS][CLIENT-PYTHON] No PR found in client-python side, keeping client-python:${PR_TARGET_BRANCH}"
# Repository already clone on PR_TARGET_BRANCH branch
fi

# ------
# For connector, maybe one day we will refactor to a function.
echo "[CLONE-DEPS][CONNECTOR] Multi repository PR, looking for connectors related branch"
Expand All @@ -79,11 +79,42 @@ clone_for_pr_build() {
echo "[CLONE-DEPS][CONNECTOR] No PR found in connectors side, keeping connector:${PR_TARGET_BRANCH}"
# Repository already clone on PR_TARGET_BRANCH branch
fi

else

echo "[CLONE-DEPS] NOT multi repo, cloning client-python:${PR_TARGET_BRANCH} and connector:${PR_TARGET_BRANCH}"
gh repo clone https://github.com/OpenCTI-Platform/client-python ${CLI_PYTHON_DIR} -- --branch ${PR_TARGET_BRANCH} --depth=1
gh repo clone https://github.com/OpenCTI-Platform/connectors ${CONNECTOR_DIR} -- --branch ${PR_TARGET_BRANCH} --depth=1

gh repo clone https://github.com/OpenCTI-Platform/client-python ${CLI_PYTHON_DIR} -- --depth=1
cd ${CLI_PYTHON_DIR}
git ls-remote --exit-code --heads origin $PR_TARGET_BRANCH >/dev/null 2>&1
EXIT_CODE=$?

if [[ $EXIT_CODE == '0' ]]; then
echo "Git branch '$PR_TARGET_BRANCH' exists in the remote repository in ${CLI_PYTHON_DIR}"
git switch $PR_TARGET_BRANCH
elif [[ $EXIT_CODE == '2' ]]; then
echo "Git branch '$PR_TARGET_BRANCH' does not exist in the remote repository, using default in ${CLI_PYTHON_DIR}"
fi

gh repo clone https://github.com/OpenCTI-Platform/connectors ${CONNECTOR_DIR} -- --depth=1
cd ${CONNECTOR_DIR}
if [[ $EXIT_CODE == '0' ]]; then
echo "Git branch '$PR_TARGET_BRANCH' exists in the remote repository ${CONNECTOR_DIR}"
git switch $PR_TARGET_BRANCH
elif [[ $EXIT_CODE == '2' ]]; then
echo "Git branch '$PR_TARGET_BRANCH' does not exist in the remote repository, using default in ${CONNECTOR_DIR}"
fi

cd ${WORKSPACE}
CHANGES_OUSTIDE_FRONT_COUNT=$(gh pr diff ${PR_NUMBER} --name-only | grep -v "opencti-platform/opencti-front" | wc -l)
if [[ ${CHANGES_OUSTIDE_FRONT_COUNT} -eq 0 ]]
then
echo "[CLONE-DEPS][BUILD] Only frontend changes on this PR, api-test can be skipped."
touch "${WORKSPACE}/api-test.skip"
else
echo "[CLONE-DEPS][BUILD] There is more than frontend changes, api-test will be run."
fi

fi
}

Expand Down