Skip to content

Commit

Permalink
v4.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
玉楼 committed Apr 19, 2024
0 parents commit 424f28a
Show file tree
Hide file tree
Showing 304 changed files with 40,536 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .aci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
version: "2.0"

only:
triggerType:
- pullRequest
- tagPush
- push

stages:
- 合规扫描
- 代码检查


jobs:
Header 扫描:
stage: 合规扫描
component: shell-with-clone
inputs:
script: |
#!/bin/bash
TARGET_DIR="${BASE_WORKSPACE}"
echo "$TARGET_DIR"
COPYRIGHT_TEXT=$'/*\n'
COPYRIGHT_TEXT+=$' * Copyright (c) 2024 OceanBase.\n'
COPYRIGHT_TEXT+=$' *\n'
COPYRIGHT_TEXT+=$' * Licensed under the Apache License, Version 2.0 (the "License");\n'
COPYRIGHT_TEXT+=$' * you may not use this file except in compliance with the License.\n'
COPYRIGHT_TEXT+=$' * You may obtain a copy of the License at\n'
COPYRIGHT_TEXT+=$' *\n'
COPYRIGHT_TEXT+=$' * http://www.apache.org/licenses/LICENSE-2.0\n'
COPYRIGHT_TEXT+=$' *\n'
COPYRIGHT_TEXT+=$' * Unless required by applicable law or agreed to in writing, software\n'
COPYRIGHT_TEXT+=$' * distributed under the License is distributed on an "AS IS" BASIS,\n'
COPYRIGHT_TEXT+=$' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n'
COPYRIGHT_TEXT+=$' * See the License for the specific language governing permissions and\n'
COPYRIGHT_TEXT+=$' * limitations under the License.\n'
COPYRIGHT_TEXT+=$' */'
non_compliant_files=()
temp_file=$(mktemp)
find "$TARGET_DIR" -type f -name "*.go" > "$temp_file"
while IFS= read -r file; do
start_of_file=$(head -n 15 "$file")
if [[ "$start_of_file" != "$COPYRIGHT_TEXT" ]]; then
non_compliant_files+=("$file")
fi
done < "$temp_file"
rm "$temp_file"
if [ ${#non_compliant_files[@]} -ne 0 ]; then
echo -e "\033[31mError: The following files are missing the correct copyright header:\033[0m"
for file in "${non_compliant_files[@]}"; do
echo -e "\033[31m${file}\033[0m"
done
exit 1
else
echo "All files have the correct copyright header."
fi
exit 0
编译检查:
stage: 代码检查
component: shell-with-clone
inputs:
script: |
#!/bin/bash
if [[ `uname -m` == aarch64 ]]; then
wget https://studygolang.com/dl/golang/go1.20.6.linux-arm64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go1.20.6.linux-arm64.tar.gz
cp /usr/local/go/bin/go /usr/local/bin/
else
wget https://studygolang.com/dl/golang/go1.20.6.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go1.20.6.linux-amd64.tar.gz
cp /usr/local/go/bin/go /usr/local/bin/
fi
go env -w GOPROXY=https://goproxy.cn GOPATH="/usr/local"
go install github.com/go-bindata/go-bindata/[email protected]+incompatible
cd "${BASE_WORKSPACE}/codeWorkspace"
make pre-build build-with-swagger
规范检查:
stage: 代码检查
component: golang-sast
inputs:
excludes:
- "**_test.go**"
config:
execute:
timeout: 600
afterExecute:
checkRule:
- ${{outputs.critical}} <= 10
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
src/**/*.pyc
src/**/build

# go Binary files
bin/*
cmd/agent/ocsagent
go.work
go.work.sum

# go test files and generated files
bindata/
agent/api/docs/*
vendor

# macOS files
.DS_Store


.idea/*
*.iml
.vscode/*
.OWNERS
32 changes: 32 additions & 0 deletions .secignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
BFlow Secret Scan Ignore List #
##########################################################
# Above the segmentation lines there are suspected privacy information #
# Please use the file name as the first line and the igored information #
# should be started with tab. #
# Under the segmentation lines there are the folders which you need to ignore #
##########################################################
**
https://github.com/*
https://goproxy.cn
https://open.oceanbase.com
http://www.apache.org/licenses/
--------------------------------------------------------
# Should use GLOB wildcard to config and analysis the ignored folder
# The root patch shold start with '/'
/README.md
/README-CN.md
/LICENSE
/CODE_OF_CONDUCT.md
/NOTICE
/COMPILE.md
/.git/**
/rpm/obshell.spec
/go.mod
/go.sum
/Makefile.common
--------------------------------------------------------
# Config the ignored fold to escape the Chinese scan by GLOB wildcard
--------------------------------------------------------
# Set md5 of pemFile string to filter
# This section must be end up with '--------------------------------------------------------'!!!
--------------------------------------------------------
45 changes: 45 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity, and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality about the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4.

For answers to common questions about this code of conduct, see [FAQ](https://www.contributor-covenant.org/faq).
47 changes: 47 additions & 0 deletions COMPILE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Compile

## Install Go environment
[Download and install](https://golang.org/doc/install)

## Supported OS
|OS|Version|Arch|Compile|Execute|
|:---:|:---:|:---:|:---:|:---:|
|CentOS|7.9 / 8.4|x86_64|Yes|Yes|
|Debian|9.13 / 10.11 / 11.2|x86_64|Yes|Yes|
|Fedora|33|x86_64|Yes|Yes|
|OpenSUSE|15.2|x86_64|Yes|Yes|
|Anolis OS|8.2|x86_64|Yes|Yes|
|Ubuntu|16.04 / 18.04 / 20.04|x86_64|Yes|Yes|

## Get the code, build and run
### Clone
Clone the source code to your development machine:
```shell
git clone https://github.com/oceanbase/obshell.git
```
### pre-build

install bindata and swagger:
```shell
go install github.com/go-bindata/go-bindata/...@latest
go install github.com/swaggo/swag/cmd/swag@latest
```
bindata and swagger will be installed in $GOPATH.

if the $PATH doesn't include %GOPATH in you environment, you need to move the bindata and swagger to you $PATH, or make $PATH include $GOPATH.

Then:
```shell
make pre-build
```

### Build
Build OBShell from the source code in debug mode or release mode:
#### Debug mode
```shell
make build
```
#### Release mode
```shell
make build-release
```
63 changes: 63 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
The development guide is located under the [docs](README.md) folder.

# Contribution Guidelines

Welcome to [OBShell]! We're thrilled that you'd like to contribute. Your help is essential for making it better.

## Getting Started

Before you start contributing, please make sure you have read and understood our [Code of Conduct](CODE_OF_CONDUCT.md).

### Fork the Repository

First, fork the [obshell repository](https://github.com/oceanbase/obshell) to your own GitHub account. This will create a copy of the project under your account.


### Clone Your Own Repository
```bash
git clone https://github.com/`your-github-name`/obshell
```
### Navigate to the Project Directory 📁
```bash
cd obshell
```
Create a new branch for your feature or bug fix:
```bash
git checkout -b feature-branch
```

> feature-branch is the name of the branch where you will be making your changes. You can name this whatever you want.
Make your changes and commit them:
```bash
git add .
git commit -m "Description of your changes"
```
Push your changes to your fork:
```bash
git push origin feature-branch
```
Finally Click on `Compare & Pull request` to contribute on this repository.

### The Flow After You Create the Pull Request
After you create the pull request, a member of the OBShell team will review your changes and provide feedback. Once satisfied, they will merge your pull request.

And there are some CI checks to pass before your pull request can be merged. Currently, there are two types of CI checks:
- **Compile**: This check will compile the code on CentOS and Ubuntu.
- **Farm**: This check will run the unit tests and some mysql test cases.

> Note: If the farm failed and you think it is not related to your changes, you can ask the reviewer to re-run the farm or the reviewer will re-run the farm.
### The Flow After Your Pull Request is Merged
In default, the pull request is merged into develop branch which is the default branch of [obshell](https://github.com/oceanbase/obshell). We will merge develop into master branch periodically. So if you want to get the latest code, you can pull the master branch.

## Feature Developing
If you want to develop a new feature, you should create a [discussion](https://github.com/oceanbase/obshell/discussions/new/choose) first. If your idea is accepted, you can create a new issue and start to develop your feature and we will create a feature branch for you. After you finish your feature, you can create a pull request to merge your feature branch into obshell feature branch. The flow like below.

1. Create a [discussion](https://github.com/oceanbase/obshell/discussions/new/choose)
2. Create a new issue
3. Create a new feature branch on [obshell](https://github.com/oceanbase/obshell) for your feature
4. Make your changes and commit them
5. Push your changes to your fork
6. Create a pull request to merge your code into feature branch
7. After your pull request is merged, we will merge your feature branch into master
Loading

0 comments on commit 424f28a

Please sign in to comment.