Skip to content

Commit 40ee56e

Browse files
authored
Merge pull request #884 from TencentBlueKing/develop
2.5.2
2 parents 0dcec5c + be952b8 commit 40ee56e

138 files changed

Lines changed: 3366 additions & 4138 deletions

File tree

Some content is hidden

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

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [ master, develop ]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ master ]
19+
branches: [ master, develop ]
2020
schedule:
2121
- cron: '22 11 * * 4'
2222

@@ -39,11 +39,11 @@ jobs:
3939

4040
steps:
4141
- name: Checkout repository
42-
uses: actions/checkout@v2
42+
uses: actions/checkout@v3
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v1
46+
uses: github/codeql-action/init@v2
4747
with:
4848
languages: ${{ matrix.language }}
4949
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +54,7 @@ jobs:
5454
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5555
# If this step fails, then you should remove it and run the build manually (see below)
5656
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v1
57+
uses: github/codeql-action/autobuild@v2
5858

5959
# ℹ️ Command-line programs to run using the OS shell.
6060
# 📚 https://git.io/JvXDl
@@ -68,4 +68,4 @@ jobs:
6868
# make release
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v1
71+
uses: github/codeql-action/analyze@v2

.github/workflows/eslint.yaml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/eslint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: ESLint
2+
3+
on:
4+
push:
5+
branches: [ master, develop, pre_*, ft_* ]
6+
pull_request:
7+
branches: [ master, develop, pre_*, ft_* ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: 16
17+
cache: 'npm'
18+
cache-dependency-path: 'src/pages/yarn.lock'
19+
- name: Install modules
20+
run: |
21+
cd src/pages
22+
npm i
23+
- name: Run ESLint
24+
run: |
25+
cd src/pages
26+
npx eslint --ext .js,.vue src/

.github/workflows/python-ci.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Python CI Check
22

33
on:
44
push:
5-
branches: [ master, develop ]
5+
branches: [ master, develop, pre_*, ft_* ]
66
pull_request:
7-
branches: [ master, develop ]
7+
branches: [ master, develop, pre_*, ft_* ]
88

99
jobs:
1010
build:
@@ -14,23 +14,24 @@ jobs:
1414
matrix:
1515
python-version: [3.6.14]
1616
poetry-version: [1.1.7]
17-
os: [ubuntu-18.04]
17+
os: [ubuntu-20.04]
1818
runs-on: ${{ matrix.os }}
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
22+
- name: Install poetry
23+
run: pipx install poetry==${{ matrix.poetry-version }}
24+
- name: Export requirements.txt
25+
run: poetry export -f requirements.txt --dev --without-hashes -o requirements.txt --no-ansi
2226
- name: Set up Python
23-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v4
2428
with:
2529
python-version: ${{ matrix.python-version }}
26-
- name: Set up Poetry
27-
uses: abatilo/actions-poetry@v2.1.0
28-
with:
29-
poetry-version: ${{ matrix.poetry-version }}
30+
cache: 'pip'
31+
cache-dependency-path: 'requirements.txt'
3032
- name: Install dependencies
31-
run: poetry config virtualenvs.create false && poetry install
33+
run: pip install -r requirements.txt -i https://pypi.org/simple/
3234
- name: Lint with flake8
3335
run: pflake8 src/ --config=pyproject.toml
3436
- name: Lint with mypy
3537
run: mypy src/ --config-file=pyproject.toml
36-

.github/workflows/unittest.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Unittest
22

33
on:
44
push:
5-
branches: [ master, develop ]
5+
branches: [ master, develop, pre_*, ft_* ]
66
pull_request:
7-
branches: [ master, develop ]
7+
branches: [ master, develop, pre_*, ft_* ]
88

99
jobs:
1010
build:
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
python-version: [3.6.14]
1515
poetry-version: [1.1.7]
16-
os: [ubuntu-18.04]
16+
os: [ubuntu-20.04]
1717
runs-on: ${{ matrix.os }}
1818

1919
env:
@@ -23,26 +23,30 @@ jobs:
2323
DB_PORT: 3306
2424

2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2727
- uses: samin/mysql-action@v1.3
2828
with:
2929
mysql version: '5.7'
3030
mysql database: ${{ env.DB_DATABASE }}
3131
mysql root password: ${{ env.DB_PASSWORD }}
3232
mysql user: ${{ env.DB_USER }}
3333
mysql password: ${{ env.DB_PASSWORD }}
34+
- name: Install poetry
35+
run: pipx install poetry==${{ matrix.poetry-version }}
36+
- name: Export requirements.txt
37+
run: |
38+
cd src/api/
39+
bash bin/export_requirements_txt.sh
3440
- name: Set up Python
35-
uses: actions/setup-python@v2
41+
uses: actions/setup-python@v4
3642
with:
3743
python-version: ${{ matrix.python-version }}
38-
- name: Set up Poetry
39-
uses: abatilo/actions-poetry@v2.1.0
40-
with:
41-
poetry-version: ${{ matrix.poetry-version }}
44+
cache: 'pip'
45+
cache-dependency-path: 'src/api/requirements.txt'
4246
- name: Install dependencies
4347
run: |
4448
cd src/api/
45-
poetry config virtualenvs.create false && bash bin/install_ci_dependencies.sh
49+
pip install -r requirements.txt -i https://pypi.org/simple/
4650
- name: Run api unittest
4751
env:
4852
DJANGO_SETTINGS_MODULE: "bkuser_core.config.overlays.unittest"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ generate-release-md:
1313
mv src/saas/release.md docs/
1414

1515
test:
16-
cd src/api && source ./test_env.sh && poetry run pytest bkuser_core/tests --disable-pytest-warnings
16+
cd src/api && export DJANGO_SETTINGS_MODULE="bkuser_core.config.overlays.unittest" && poetry run pytest bkuser_core/tests --disable-pytest-warnings
1717

1818
link:
1919
rm src/api/bkuser_global || true

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
name = "蓝鲸用户管理"
33
version = "2.3.3"
44
description = "project description file for ci"
5-
authors = ["IMBlues <bluesedenyu@gmail.com>"]
5+
authors = ["TencentBlueKing <contactus_bk@tencent.com>"]
66

77
[tool.poetry.dependencies]
8-
python = "3.6.14"
8+
python = "^3.8"
99
apigw-manager = "^1.0.3"
1010

1111
[tool.poetry.dev-dependencies]
@@ -14,8 +14,8 @@ black = "^22.3.0"
1414
# isort
1515
isort = "^5.9.2"
1616
# flake8
17-
pyproject-flake8 = "^0.0.1-alpha.2"
18-
flake8-comprehensions = "^3.5.0"
17+
pyproject-flake8 = "0.0.1-alpha.2"
18+
flake8-comprehensions = "3.5.0"
1919
# pytest
2020
pytest = "^6.2.4"
2121
pytest-django = "^3.9.0"
@@ -39,6 +39,7 @@ exclude = '''
3939
| .+/migrations
4040
| .+/sdk
4141
| .+/node_modules
42+
| .+/build
4243
)/
4344
'''
4445

@@ -59,7 +60,7 @@ format = "pylint"
5960
show_source = "true"
6061
statistics = "true"
6162
count = "true"
62-
exclude = "*migrations*,*.pyc,.git,__pycache__,*/node_modules/*,*/templates_module*,*/bin/*,*/config/*,*sdk*"
63+
exclude = "*migrations*,*.pyc,.git,__pycache__,*/node_modules/*,*/templates_module*,*/bin/*,*/config/*,*sdk*,*build*"
6364

6465
[tool.mypy]
6566
ignore_missing_imports = true
@@ -70,6 +71,7 @@ pretty=true
7071
exclude = '''(?x)(
7172
instrumentor\.py$
7273
| otel\.py$
74+
| src/build/.*\.py$
7375
)'''
7476

7577
[[tool.mypy.overrides]]
@@ -78,5 +80,6 @@ module = [
7880
"*.config.*",
7981
"bkuser_sdk.*",
8082
"*.bkuser_sdk.*",
83+
"*.build.*",
8184
]
8285
ignore_errors = true
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ sed -i '/^--extra-index-url*/d' requirements.txt
66
sed -i '/gevent/d' requirements.txt
77
sed -i '/greenlet/d' requirements.txt
88
sed -i '/gunicorn/d' requirements.txt
9-
10-
pip install -r requirements.txt -i https://pypi.org/simple/

src/api/bkuser_core/api/login/serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class Meta:
8585
"status",
8686
"time_zone",
8787
"language",
88+
"domain",
89+
"category_id",
8890
# NOTE: 这里缩减登陆成功之后的展示字段
8991
# "position",
9092
# "logo_url", => to logo?

src/api/bkuser_core/api/login/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def login(self, request):
102102

103103
time_aware_now = now()
104104
config_loader = ConfigProvider(category_id=category.id)
105-
# Admin 用户只需直接判断 密码是否正确 (只有本地目录有密码配置)
106-
if not profile.is_superuser and category.type in [CategoryType.LOCAL.value]:
105+
# 由于安全检测等原因,取消原先对admin用户的检查豁免
106+
if category.type in [CategoryType.LOCAL.value]:
107107

108108
# 判断账户状态
109109
if profile.status in [

0 commit comments

Comments
 (0)