Skip to content

Commit

Permalink
feat: 消息模板初始化sql TencentBlueKing#5150 解决冲突
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzcao committed Sep 15, 2021
2 parents ac8e065 + 93007e2 commit 6f54ecf
Show file tree
Hide file tree
Showing 228 changed files with 5,680 additions and 5,564 deletions.
190 changes: 190 additions & 0 deletions .github/workflows/release_for_k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
name: Tag Realse
on:
push:
tags:
- 'k*'

jobs:
frontend:
name: Build frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install && yarn start && yarn public
working-directory: src/frontend
- uses: actions/upload-artifact@v1
with:
name: frontend
path: src/frontend/frontend/

agent:
name: Build agent on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
fail-fast: true
max-parallel: 3
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.12
- uses: actions/checkout@v2
- run: make clean build_linux
working-directory: src/agent/
if: matrix.os == 'ubuntu-latest'
- run: make clean build_macos
working-directory: src/agent/
if: matrix.os == 'macos-latest'
- run: build_windows.bat
shell: cmd
working-directory: src/agent/
if: matrix.os == 'windows-latest'
- uses: actions/upload-artifact@v1
with:
name: agent
path: src/agent/bin/

backend:
name: Build backend and release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: init mysql
run: |
sudo /etc/init.d/mysql start
export MYSQL_PWD=root
for i in *.sql;do echo $i;mysql -h localhost -uroot < $i;done
working-directory: support-files/sql
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Gradle
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle Build Backend Service
working-directory: src/backend/ci
run: ./gradlew clean test build :core:worker:worker-agent:shadowJar -Ddevops.assemblyMode=K8S -DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/"

- name: Create artifact - Step1:init
run: |
true # 暂无init需求, 保留此步骤.
- name: Create artifact - Step2:get Agent
uses: actions/download-artifact@v1
with:
name: agent
path: src/agent/bin/

- name: Create artifact - Step3:get Frontend
uses: actions/download-artifact@v1
with:
name: frontend
path: src/frontend/frontend

- name: Create artifact - Step4:make package
id: create-artifact
run: |
version="$(basename $GITHUB_REF)"
echo "::set-output name=version::$version"
ci_ms_wip="sign,monitoring" ci_pkg_dir=/dev/shm/ci ./scripts/packager-ci.sh "$version" bkci-slim.tar.gz
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: bk-ci ${{ github.ref }}
draft: true
prerelease: true

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bkci-slim.tar.gz
asset_name: bkci-slim.tar.gz
asset_content_type: application/gzip

- name: download codecc
uses: actions/download-artifact@v1
with:
name: codecc
path: ./

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bkcodecc-slim.tar.gz
asset_name: bkcodecc-slim.tar.gz
asset_content_type: application/gzip

codecc:
name: Build CodeCC
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: CodeCC Cache Gradle
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-codecc-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-codecc-gradle-
- name: Gradle Build
id: codecc-backend
uses: eskatos/gradle-command-action@v1
with:
gradle-version: 4.6
build-root-directory: src/backend/codecc
arguments: clean copyToRelease -DmavenRepoUrl="https://maven.aliyun.com/nexus/content/groups/public/"

- name: frontend
id: codecc-frontend
run: |
cd src/frontend/devops-codecc
rm -rf dist
npm i
npm run build
if [ -f dist/index.html ]; then
mv dist/index.html dist/frontend#index.html
fi
- name: Create artifact - make package
id: create-artifact
run: |
version="$(basename $GITHUB_REF)"
echo "::set-output name=version::$version"
codecc_pkg_dir=/dev/shm/codecc ./scripts/deploy-codecc/packager-codecc.sh "$version" bkcodecc-slim.tar.gz "$PWD"
- uses: actions/upload-artifact@v1
with:
name: codecc
path: bkcodecc-slim.tar.gz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ out
.history
.codecc
build.yml
*.ipa
4 changes: 2 additions & 2 deletions docs/install/backend.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ There are 10 microservices (artifactory, dispatch, environment, log, plugin, pro
## 1. System Requirements

- JDK 1.8
- Gradle 4.8
- Gradle 6.7
- Redis 2.8.17
- MySQL 5.7
- ES 5.6
- ES 7.4
- Consul 1.0 [Consul Installation](consul.en.md)
- RabbitMQ 3.7.15 [RabbitMQ Deployment](rabbitmq.en.md)

Expand Down
4 changes: 2 additions & 2 deletions docs/install/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
## 1.系统要求

jdk: 1.8
gradle: 4.8
gradle: 6.7
redis: 2.8.17
mysql 5.7
es: 5.6
es: 7.4
consul: 1.0 [Consul安装](consul.md)
rabbitmq: 3.7.15 [rabbitmq部署](rabbitmq.md)

Expand Down
4 changes: 2 additions & 2 deletions docs/overview/installation.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ The following directories are explained in detail.

- CentOS 7.x
- JDK 1.8
- Gradle 4.8
- Gradle 6.7
- Redis 2.8.17
- MySQL 5.7
- ES 5.6
- ES 7.4
- RabbitMQ 3.7.15 [RabbitMQ Installation Document](../install/rabbitmq.en.md)
- Consul 1.0+ [Consul Installation](../install/consul.en.md)

Expand Down
4 changes: 2 additions & 2 deletions docs/overview/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@

- CentOS 7.X
- jdk: 1.8
- gradle: 4.8
- gradle: 6.7
- redis: 2.8.17
- mysql 5.7
- es: 5.6
- es: 7.4
- rabbitmq: 3.7.15 [rabbitMQ 安装文档](../install/rabbitmq.md)
- Consul 1.0+ [Consul安装](../install/consul.md)

Expand Down
2 changes: 1 addition & 1 deletion docs/overview/source_compile.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The gateway is built with Lua scripts and Nginx configurations, so no compilatio

- MySQL 5.7
- JDK 1.8
- Gradle 4.8 – 4.10
- Gradle 6.7

#### Database Initialization

Expand Down
2 changes: 1 addition & 1 deletion docs/overview/source_compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ yarn public

- MySQL 5.7
- JDK 1.8
- Gradle 4.8 - 4.10
- Gradle 6.7

#### 数据库初始化

Expand Down
2 changes: 1 addition & 1 deletion docs/wiki/collaborative_development_guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#### 1.2、安装gradle

​ bk-ci使用gradle作为构建工具,gradle的版本建议使用4.8-4.10,gradle可以直接从gradle官网下载下来安装即可(gradle官网地址详见:[gradle官网](https://gradle.org/))。
​ bk-ci使用gradle作为构建工具,gradle的版本建议使用6.7,gradle可以直接从gradle官网下载下来安装即可(gradle官网地址详见:[gradle官网](https://gradle.org/))。

#### 1.3、安装IDE开发工具

Expand Down
12 changes: 11 additions & 1 deletion scripts/bk-ci-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LAN_IP=${LAN_IP:-$(ip route show | grep -Pom 1 "(?<=src )[0-9.]+")}

BKCE_RENDER_CMD="$CTRL_DIR/bin/render_tpl" # 蓝鲸社区版的render, 需要env文件及$BK_HOME.
CI_RENDER_CMD="$(dirname "$0")/render_tpl" # bk-ci里的默认读取本地的bkenv.properties文件.
GEN_DOCKER_CONF_CMD="$(dirname "$0a")/bk-ci-gen-docker-conf.sh"
GEN_DOCKER_CONF_CMD="$(dirname "$0")/bk-ci-gen-docker-conf.sh"

# 批量检查变量名为空的情况.
check_empty_var (){
Expand Down Expand Up @@ -255,6 +255,16 @@ setup_ci_dockerhost (){
env_line_set "$start_env" "LD_LIBRARY_PATH" "$BK_CI_HOME/$proj/sigar/"
}

setup_ci_turbo (){
local proj=$1
setup_ci__ms_common "$proj" || return 11
# turbo日志路径为 turbo-devops/turbo-devops.log
update_link_to_target "$MS_DIR/logs/$MS_NAME.log" "$MS_LOGS_DIR/$MS_NAME-$BK_CI_CONSUL_DISCOVERY_TAG/$MS_NAME-$BK_CI_CONSUL_DISCOVERY_TAG.log" || return 3
# 需要自定义启动参数.
env_line_set "$start_env" "JAVA_OPTS" "-Dturbo.thirdparty.propdir=$BK_HOME/etc/ci/thirdparty"
render_ci quartz # 额外渲染 #etc#ci#thirdparty#quartz.properties
}

# 校验网关关键配置, 设置家目录, 设置启动用户或setcap?
setup_ci_gateway (){
#check_empty_var BK_CI_DATA_DIR BK_CI_HOME BK_CI_LOGS_DIR || return 15
Expand Down
1 change: 1 addition & 0 deletions scripts/bk-ci-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ start_ci__springboot (){
java_pid=$!
echo "$java_pid" > "$pid_file" || return 24
echo "java pid is $java_pid."
[ "$MS_NAME" = "turbo" ] && return 0
# 此处阻塞.
if ! wait_springboot_up "$java_pid" "$API_PORT"; then
echo "wait_springboot_up: unable to confirm app status from http://127.0.0.1:$API_PORT/management/health"
Expand Down
49 changes: 46 additions & 3 deletions scripts/bkenv.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ci.env template, generated at 2021-05-27 19:57:19
# ci.env template, generated at 2021-09-09 16:40:32

##########
# 0-依赖声明
Expand Down Expand Up @@ -33,8 +33,10 @@ BK_REPO_HOST=
BK_SSM_HOST=
# BK_SSM_PORT无默认值. 无需修改. 声明依赖, 蓝鲸环境下会自动填充. 其他环境无需填写.
BK_SSM_PORT=
# BK_CI_NOTIFY_WEWORK_API_URL 默认值为:https://qyapi.weixin.qq.com, 企业微信服务端host,用于调用企业微信api接口.
BK_CI_NOTIFY_WEWORK_API_URL=https://qyapi.weixin.qq.com
# BK_TURBO_PRIVATE_URL默认为http://bk-turbo.service.consul. 按需修改. turbo网关
BK_TURBO_PRIVATE_URL=http://bk-turbo.service.consul
# BK_TURBO_PUBLIC_URL默认为http://turbo.$BK_DOMAIN. 按需修改. turbo网关
BK_TURBO_PUBLIC_URL=http://turbo.$BK_DOMAIN

##########
# 1-基础配置
Expand Down Expand Up @@ -77,6 +79,8 @@ BK_CI_IAM_CALLBACK_USER=bk_iam
BK_CI_IAM_WEB_URL=
# BK_CI_IAM_ENV默认为prod. 废弃. 待清理配置文件及相关代码.
BK_CI_IAM_ENV=prod
# BK_CI_IAM_WEB_URL默认为$BK_PAAS_PUBLIC_URL/o/bk_iam. 请勿修改. IAM SaaS入口url, 用于拼接权限申请页面.
BK_CI_IAM_WEB_URL=$BK_PAAS_PUBLIC_URL/o/bk_iam
# BK_CI_JOB_FQDN无默认值. 废弃. 待清理配置文件及相关代码.
BK_CI_JOB_FQDN=
# BK_CI_JWT_RSA_PRIVATE_KEY无默认值. 按需修改. JWT RSA密钥对. 单行, 需要确保最终渲染为\n. 建议使用附带的脚本生成.
Expand Down Expand Up @@ -199,6 +203,9 @@ BK_CI_REPOSITORY_SVN_WEBHOOK_URL=
BK_CI_STORE_USER_AVATARS_URL=$BK_PAAS_PUBLIC_URL/console/static/img/getheadimg.jpg?
# BK_CI_FQDN_CERT BKCI站点的HTTPS证书存储位置, 默认值为空表示没有开启HTTPS,用于Agent与BKCI走HTTPS通信使用
BK_CI_FQDN_CERT=
# BK_CI_NOTIFY_WEWORK_API_URL 默认值为:https://qyapi.weixin.qq.com, 企业微信服务端host,用于调用企业微信api接口.
BK_CI_NOTIFY_WEWORK_API_URL=https://qyapi.weixin.qq.com

##########
# 4-微服务依赖
##########
Expand Down Expand Up @@ -258,6 +265,40 @@ BK_CI_S3_BUCKET_NAME=
BK_CI_S3_ENDPOINT_URL=
# BK_CI_S3_SECRET_KEY无默认值. 废弃. 待清理配置文件及相关代码.
BK_CI_S3_SECRET_KEY=
# BK_CI_TURBO_CONSUL_DISCOVERY_TAG默认为$BK_CI_CONSUL_DISCOVERY_TAG. 无需修改. 需要和ci保持一致
BK_CI_TURBO_CONSUL_DISCOVERY_TAG=$BK_CI_CONSUL_DISCOVERY_TAG
# BK_CI_TURBO_MONGODB_ADDR默认为127.0.0.1:27017. 按需修改.
BK_CI_TURBO_MONGODB_ADDR=127.0.0.1:27017
# BK_CI_TURBO_MONGODB_DB_NAME默认为turbo_prod. 无需修改. ci-turbo主数据库.
BK_CI_TURBO_MONGODB_DB_NAME=turbo_prod
# BK_CI_TURBO_MONGODB_PASSWORD无默认值. 按需修改.
BK_CI_TURBO_MONGODB_PASSWORD=
# BK_CI_TURBO_MONGODB_USER无默认值. 按需修改.
BK_CI_TURBO_MONGODB_USER=
# BK_CI_TURBO_QUARTZ_MONGODB_ADDR默认为127.0.0.1:27017. 按需修改.
BK_CI_TURBO_QUARTZ_MONGODB_ADDR=127.0.0.1:27017
# BK_CI_TURBO_QUARTZ_MONGODB_DB_NAME默认为turbo_quartz. 无需修改. quartz需要独立db.
BK_CI_TURBO_QUARTZ_MONGODB_DB_NAME=turbo_quartz
# BK_CI_TURBO_QUARTZ_MONGODB_PASSWORD无默认值. 按需修改.
BK_CI_TURBO_QUARTZ_MONGODB_PASSWORD=
# BK_CI_TURBO_QUARTZ_MONGODB_USER无默认值. 按需修改.
BK_CI_TURBO_QUARTZ_MONGODB_USER=
# BK_CI_TURBO_RABBITMQ_ADDR默认为$BK_CI_RABBITMQ_ADDR. 按需修改. 独立mq, 可复用ci的.
BK_CI_TURBO_RABBITMQ_ADDR=$BK_CI_RABBITMQ_ADDR
# BK_CI_TURBO_RABBITMQ_PASSWORD默认为$BK_CI_RABBITMQ_PASSWORD. 按需修改.
BK_CI_TURBO_RABBITMQ_PASSWORD=$BK_CI_RABBITMQ_PASSWORD
# BK_CI_TURBO_RABBITMQ_USER默认为$BK_CI_RABBITMQ_USER. 按需修改.
BK_CI_TURBO_RABBITMQ_USER=$BK_CI_RABBITMQ_USER
# BK_CI_TURBO_RABBITMQ_VHOST默认为$BK_CI_RABBITMQ_VHOST. 按需修改. 独立mq, 可复用ci的.
BK_CI_TURBO_RABBITMQ_VHOST=$BK_CI_RABBITMQ_VHOST
# BK_CI_TURBO_REDIS_DB默认为$BK_CI_REDIS_DB. 按需修改.
BK_CI_TURBO_REDIS_DB=$BK_CI_REDIS_DB
# BK_CI_TURBO_REDIS_HOST默认为$BK_CI_REDIS_HOST. 按需修改. 独立redis, 可复用ci的.
BK_CI_TURBO_REDIS_HOST=$BK_CI_REDIS_HOST
# BK_CI_TURBO_REDIS_PASSWORD默认为$BK_CI_REDIS_PASSWORD. 按需修改.
BK_CI_TURBO_REDIS_PASSWORD=$BK_CI_REDIS_PASSWORD
# BK_CI_TURBO_REDIS_PORT默认为$BK_CI_REDIS_PORT. 按需修改.
BK_CI_TURBO_REDIS_PORT=$BK_CI_REDIS_PORT

##########
# 5-api port
Expand Down Expand Up @@ -308,5 +349,7 @@ BK_CI_SIGN_API_PORT=21950
BK_CI_STORE_API_PORT=21918
# BK_CI_TICKET_API_PORT默认为21915. 无需修改.
BK_CI_TICKET_API_PORT=21915
# BK_CI_TURBO_API_PORT默认为21955. 无需修改.
BK_CI_TURBO_API_PORT=21955
# BK_CI_WEBSOCKET_API_PORT默认为21924. 无需修改.
BK_CI_WEBSOCKET_API_PORT=21924
Loading

0 comments on commit 6f54ecf

Please sign in to comment.