Skip to content

Commit afa08fa

Browse files
authored
Merge pull request #1744 from HXSecurity/beta
Beta
2 parents 852ade2 + d351902 commit afa08fa

File tree

481 files changed

+31246
-20995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

481 files changed

+31246
-20995
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*.DS_Store
44
/venv
55
*/__pycache__/*
6-
*/migrations/*
76
*.pyc
87
.idea/
98
scaapi/cron/logs/sca.log
@@ -25,7 +24,6 @@ build_docker.sh
2524
*.DS_Store
2625
/venv
2726
*/__pycache__/*
28-
*/migrations/*
2927
*.pyc
3028
.idea/
3129
scaapi/cron/logs/sca.log

.github/workflows/deploy-dev.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,10 @@ jobs:
8080
registry.cn-hongkong.aliyuncs.com/secnium/dongtai-server:${{ steps.version.outputs.GITHUB_REF }}-latest
8181
registry.cn-hongkong.aliyuncs.com/secnium/dongtai-server:${{ steps.version.outputs.GITHUB_REF }}-1.0.${{github.run_number}}
8282
83-
- name: Set the value
84-
id: release
85-
run: |
86-
if [ ${{ steps.version.outputs.GITHUB_REF }} = develop ] ; then echo "helm_ns=test" >> $GITHUB_ENV; echo "helm_mysql=test" >> $GITHUB_ENV
87-
elif [ ${{ steps.version.outputs.GITHUB_REF }} = beta ] ; then echo "helm_ns=beta" >> $GITHUB_ENV; echo "helm_mysql=beta" >> $GITHUB_ENV
88-
else echo "helm_ns=main" >> $GITHUB_ENV ; echo "helm_mysql=temp" >> $GITHUB_ENV ;fi
89-
9083
- name: deploy to cluster
91-
uses: wahyd4/kubectl-helm-action@master
84+
uses: tscuite/kubectl-helm-action@main
9285
env:
86+
MAX: false
87+
PROJECT: server
88+
TOKEN_SCA: ${{ secrets.TOKEN_SCA }}
9389
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_TEST_DATA }}
94-
with:
95-
args: |
96-
git clone https://github.com/HXSecurity/DongTai.git
97-
helm upgrade --install huoxian --create-namespace -n iast-${{ env.helm_ns }} ./DongTai/deploy/kubernetes/helm/ \
98-
--set sca.sca_token=${{ secrets.TOKEN_SCA }} --set usb.usb_token=${{ secrets.TOKEN_SCA }} --set mysql.host=iast-mysql-${{ env.helm_mysql }}.huoxian.cn \
99-
--set tag=${{ steps.version.outputs.GITHUB_REF }}-latest --set build.server_number=iast${{github.run_number}} --set develop.agentZip=${{ env.helm_ns }} --values https://charts.dongtai.io/devops.yaml

.github/workflows/nightly.yaml

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ name: "Nightly"
55
on:
66
schedule:
77
- cron: '0 0 * * *'
8+
workflow_dispatch:
89

910
jobs:
10-
# This workflow contains a single job called "build"
11-
Run-API-TEST:
11+
Run-Unit-TEST-In-Cython:
1212
runs-on: ubuntu-latest
1313
services:
1414
mysql:
@@ -40,37 +40,87 @@ jobs:
4040
- uses: actions/setup-python@v4
4141
with:
4242
python-version: "3.10"
43-
ref: main
43+
cache: "pip"
44+
4445
- name: Install dependencies
4546
run: |
4647
sudo apt-get install build-essential cmake ninja-build python3-dev cython3 pybind11-dev libre2-dev -y
4748
python -m pip install --upgrade pip
4849
pip install wheel
50+
pip install coverage
4951
pip install -r requirements.txt
50-
pip install schemathesis
51-
pip install httpx
52-
53-
- name: Install dependencies
52+
53+
- name: Django Unit Testing
5454
run: |
55-
curl -X GET "https://iast.io/openapi/api/v1/agent/download?url=https://iast.io/openapi&language=python&projectName=WEBAPI${{ github.repository_owner }}.${{github.run_number}}" -H "Authorization: Token a303ab4bedc93f96808335d023d7ac4d2ba00773" -o dongtai-agent-python.tar.gz -k
56-
pip install dongtai-agent-python.tar.gz
55+
export CELERY_EAGER_TEST=TRUE
56+
cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
57+
mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
58+
python3 ./deploy/docker/version_update.py || true
59+
python3 manage.py migrate
60+
pip install Cython==3.0.0
61+
python setup.py build_ext --inplace
62+
find . -name "*.so" | grep test | xargs rm
63+
coverage run --source='.' manage.py test
64+
coverage report
65+
66+
Run-API-TEST-With-Cython:
67+
runs-on: ubuntu-latest
68+
services:
69+
mysql:
70+
image: dongtai/dongtai-mysql-unittest:latest
71+
ports:
72+
- 3306:3306
73+
options: >-
74+
--health-cmd "mysqladmin ping --silent"
75+
--health-interval 10s
76+
--health-timeout 180s
77+
--health-retries 10
78+
redis:
79+
image: dongtai/dongtai-redis:latest
80+
ports:
81+
- 6379:6379
82+
options: >-
83+
--health-cmd "redis-cli ping"
84+
--health-interval 10s
85+
--health-timeout 5s
86+
--health-retries 5
87+
strategy:
88+
max-parallel: 4
89+
matrix:
90+
python-version: ["3.10"]
5791

92+
steps:
93+
- name: Checkout
94+
uses: actions/checkout@v2
95+
- uses: actions/setup-python@v4
96+
with:
97+
python-version: "3.10"
98+
cache: "pip"
5899

100+
- name: Install dependencies
101+
run: |
102+
sudo apt-get install build-essential cmake ninja-build python3-dev cython3 pybind11-dev libre2-dev -y
103+
python -m pip install --upgrade pip
104+
pip install wheel
105+
pip install -r requirements.txt
106+
pip install schemathesis
107+
pip install httpx
108+
59109
- name: Django Api Testing
60110
run: |
61111
mysql --host=127.0.0.1 -uroot -p'dongtai-iast' -D dongtai_webapi < /home/runner/work/DongTai/DongTai/test/init.sql
62112
cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
63-
export PROJECT_NAME=DONGTAI-SERVER.${{ github.repository_owner }}
64-
export PROJECT_VERSION=${{github.run_number}}
65113
export DOC=TRUE
66-
export PYTHONAGENT=TRUE
67114
mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
68115
python3 ./deploy/docker/version_update.py || true
69-
python3 manage.py updatedepartmenttoken
70-
python3 manage.py runserver 0.0.0.0:8000 &
71-
sleep 60
72-
schemathesis run --base-url "http://localhost:8000/" -H 'Authorization: Token 67aebd78e700ad36a82a152276196b5f49fafeb0' http://localhost:8000/api/XZPcGFKoxYXScwGjQtJx8u/schema/ --hypothesis-suppress-health-check=data_too_large,filter_too_much,too_slow,large_base_example,function_scoped_fixture --validate-schema=false --hypothesis-verbosity normal
73-
116+
python3 manage.py migrate
117+
pip install Cython==3.0.0
118+
python setup.py build_ext --inplace
119+
python setup.py build_ext --inplace
120+
python3 manage.py runserver 0.0.0.0:8000 > webapi.log &
121+
sleep 15
122+
schemathesis run --rate-limit=28/s --base-url "http://localhost:8000/" -H 'Authorization: Token 67aebd78e700ad36a82a152276196b5f49fafeb0' http://localhost:8000/api/XZPcGFKoxYXScwGjQtJx8u/schema/ --hypothesis-suppress-health-check=data_too_large,filter_too_much,too_slow,large_base_example,function_scoped_fixture --validate-schema=false --hypothesis-verbosity normal
123+
74124
Run-BuildCheck:
75125
if: ${{ github.repository_owner == 'HXSecurity' }}
76126
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)