Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/master' into feature-v3-rbac
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/frontend/devops-repository/src/views/repoCommon/commonPackageDetail.vue
#	src/frontend/devops-repository/src/views/repoGeneric/index.vue
  • Loading branch information
zacYL committed Sep 26, 2023
2 parents d6b0244 + 6258aa7 commit 0141071
Show file tree
Hide file tree
Showing 95 changed files with 2,232 additions and 441 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
version="${GITHUB_REF_NAME#v}"
./build-images.sh --all-in-one -v $version --username ${{ secrets.DOCKER_USER }} \
--password ${{ secrets.DOCKER_PASS }} -n ${{ secrets.DOCKER_NAMESPACE }} \
-r ${{ secrets.DOCKER_HOST }} --slim-package-path ../bkrepo-slim.tar.gz -p
-r ${{ secrets.DOCKER_HOST }} --slim-package-path ../bkrepo-slim.tar.gz -p -l

release-all:
Expand Down
76 changes: 40 additions & 36 deletions docs/apidoc/node/favorites.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,27 @@
- API 名称: create_favorite
- 功能说明:

- 中文:创建收藏文件夹
- English:create favorite folder
- 中文:创建收藏文件夹
- English:create favorite folder
- 请求体

```json
{
"projectId": "",
"repoName": "",
"path": ""
"projectId": "devops",
"repoName": "custom",
"path": "/test/a/",
"type": "USER"
}
```
- 请求字段说明

| 字段 | 类型 | 是否必须 | 默认值 | 说明 | Description |
| ---| ---- | --------| ----- | --- |------------------|
| projectId | string ||| 项目名称 | project id |
| repoName | string ||| 仓库名称 | repo name |
| path | string ||| 完整路径 | path |
| type | enum || USER | [USER , PROJECT] | [USER , PROJECT] |

| 字段 | 类型 | 是否必须 | 默认值 | 说明 | Description |
| ----------- | -------- | ---------- | -------- | ---------- | -------------- |
| projectId | string ||| 项目名称 | project name |
| repoName | string ||| 仓库名称 | repo name |
| path | string ||| 完整路径 | path |
- 响应体

```json
Expand All @@ -40,31 +42,32 @@

## 分页查询收藏文件夹

- API: POST /repository/api/favorite/page
- API: POST /repository/api/favorite/query
- API 名称: favorite_page
- 功能说明:

- 中文:分页查询收藏文件夹
- English:list favorite page
- 中文:分页查询收藏文件夹
- English:list favorite page
- 请求体

```json
{
"projectId": "",
"repoName": "",
"type": "USER",
"pageNumber": 1,
"pageSize": 20
}
```
- 请求字段说明

| 字段 | 类型 | 是否必须 | 默认值 | 说明 | Description |
| ----------| ----- |------| ----- | ------- |------------------|
| type | enum || USER | [USER , PROJECT] | [USER , PROJECT] |
| projectId | string ||| 项目名称 | project id |
| pageNumber | int || 1 | 当前页 | current page |
| pageSize | int || 20 | 分页大小 | page size |


| 字段 | 类型 | 是否必须 | 默认值 | 说明 | Description |
| ------------ | -------- | ---------- | -------- | ---------- | -------------- |
| projectId | string ||| 项目名称 | project name |
| repoName | string ||| 仓库名称 | repo name |
| pageNumber | int || 1 | 当前页 | current page |
| pageSize | int || 20 | 分页大小 | page size |
- 响应体

```json
Expand All @@ -83,7 +86,8 @@
"repoName" : "generic-local",
"path" : "/123",
"userId" : "admin",
"createdDate" : "2020-07-27T16:02:31.394"
"createdDate" : "2020-07-27T16:02:31.394",
"type": "USER"
}
]
},
Expand All @@ -92,32 +96,32 @@
```
- record字段说明

| 字段 | 类型 | 说明 | Description |
| --------- |--------|----------| ------------------- |
| id | string | id | id |
| projectId | string | 节点所属项目 | node project id |
| repoName | string | 节点所属仓库 | node repository name |
| path | string | 目录完整路径 | node path |
| userId | string | 创建者 | userId |
| createdDate | string | 创建时间 | create time |
| type | string | 类型 | data type |

| 字段 | 类型 | 说明 | Description |
| ------------- | -------- | -------------- | ---------------------- |
| id | string | id | id |
| projectId | string | 节点所属项目 | node project id |
| repoName | string | 节点所属仓库 | node repository name |
| path | string | 目录完整路径 | node path |
| userId | string | 创建者 | userId |
| createdDate | string | 创建时间 | create time |

## 删除收藏文件夹
## 删除收藏

- API: DELETE /repository/api/favorite/delete/{id}
- API 名称: delete favorite
- 功能说明:

- 中文:删除收藏文件夹
- English:delete favorite
- 中文:删除收藏
- English:delete favorite
- 请求体
此接口请求体为空
- 请求字段说明

| 字段 | 类型 | 是否必须 | 默认值 | 说明 | Description |
| --- | ----- | ------ | ----- | --- | ------------ |
| id | string ||| id | id |

| 字段 | 类型 | 是否必须 | 默认值 | 说明 | Description |
| ------ | -------- | ---------- | -------- | ------ | ------------- |
| id | string ||| id | id |
- 响应体

```json
Expand Down
11 changes: 11 additions & 0 deletions scripts/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ NAMESPACE=bkrepo
USERNAME=
PASSWORD=
SLIM_PACKAGE_PATH=
LATEST=0
BACKENDS=(repository auth generic oci helm npm pypi replication opdata)

cd $(dirname $0)
Expand All @@ -44,6 +45,7 @@ usage () {
[ --init-rbac [可选] 打包init-rbac镜像 ]
[ -v, --version [可选] 镜像版本tag, 默认latest ]
[ -p, --push [可选] 推送镜像到docker远程仓库,默认不推送 ]
[ -l, --latest [可选] 是否更新并推送latest tag ]
[ -r, --registry [可选] docker仓库地址, 默认docker.io ]
[ -n, --namespace [可选] docker仓库地址, 默认docker.io ]
[ --username [可选] docker仓库用户名 ]
Expand Down Expand Up @@ -102,6 +104,9 @@ while (( $# > 0 )); do
-p | --push )
PUSH=1
;;
-l | --latest )
LATEST=1
;;
-r | --registry )
shift
REGISTRY=$1
Expand Down Expand Up @@ -153,8 +158,14 @@ if [[ ($ALL -eq 1 || $ALL_IN_ONE -eq 1) && -n "$SLIM_PACKAGE_PATH" ]] ; then
rm -rf $tmp_dir/*
cp $SLIM_PACKAGE_PATH $tmp_dir/
docker build -f $ROOT_DIR/support-files/docker/bkrepo.Dockerfile -t $REGISTRY/$NAMESPACE/bkrepo:$VERSION $tmp_dir --no-cache --network=host
if [[ $LATEST -eq 1 ]] ; then
docker tag $REGISTRY/$NAMESPACE/bkrepo:latest $REGISTRY/$NAMESPACE/bkrepo:$VERSION
fi
if [[ $PUSH -eq 1 ]] ; then
docker push $REGISTRY/$NAMESPACE/bkrepo:$VERSION
if [[ $LATEST -eq 1 ]] ; then
docker push $REGISTRY/$NAMESPACE/bkrepo:latest
fi
fi
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,15 @@ class SubScanTaskDao(
.set(TSubScanTask::lastModifiedDate.name, now)
.set(TSubScanTask::status.name, status.name)
if (status == EXECUTING) {
update.set(TSubScanTask::timeoutDateTime.name, timeoutDateTime)
update.set(TSubScanTask::startDateTime.name, now)
} else if (status == PULLED) {
update.set(TSubScanTask::heartbeatDateTime.name, now)
update.set(TSubScanTask::timeoutDateTime.name, timeoutDateTime)
update.inc(TSubScanTask::executedTimes.name, 1)
} else {
update.unset(TSubScanTask::timeoutDateTime.name)
}
if (status == EXECUTING || status == PULLED) {
update.set(TSubScanTask::heartbeatDateTime.name, now)
if (status != PULLED && status != EXECUTING) {
update.unset(TSubScanTask::timeoutDateTime.name)
update.unset(TSubScanTask::heartbeatDateTime.name)
}

val updateResult = updateFirst(query, update)
Expand All @@ -145,14 +146,6 @@ class SubScanTaskDao(
return updateFirst(Query(criteria), update)
}

fun incExecutedTimes(subTaskId: String): UpdateResult {
val criteria = Criteria.where(ID).isEqualTo(subTaskId)
val update = Update()
.set(TSubScanTask::lastModifiedDate.name, LocalDateTime.now())
.inc(TSubScanTask::executedTimes.name, 1)
return updateFirst(Query(criteria), update)
}

fun countStatus(status: SubScanTaskStatus): Long {
return count(Query(TSubScanTask::status.isEqualTo(status.name)))
}
Expand Down
Loading

0 comments on commit 0141071

Please sign in to comment.