mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-27 14:02:15 +08:00
feat: add config and images log
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
810b1ccbb3
commit
7327f11794
87
CHANGELOG/CHANGELOG-3.1.md
Normal file
87
CHANGELOG/CHANGELOG-3.1.md
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
# Version logging for OpenIM
|
||||||
|
|
||||||
|
<!-- BEGIN MUNGE: GENERATED_TOC -->
|
||||||
|
|
||||||
|
- [Version logging for OpenIM](#version-logging-for-openim)
|
||||||
|
- [Unreleased](#unreleased)
|
||||||
|
- [v3.1.2-beta.3 - 2023-08-09](#v312-beta3---2023-08-09)
|
||||||
|
- [v3.1.2-beta.2 - 2023-08-09](#v312-beta2---2023-08-09)
|
||||||
|
- [v3.1.2-beta.1 - 2023-08-09](#v312-beta1---2023-08-09)
|
||||||
|
- [v3.1.2-beta.0 - 2023-08-08](#v312-beta0---2023-08-08)
|
||||||
|
- [v3.1.2.beta.0 - 2023-08-08](#v312beta0---2023-08-08)
|
||||||
|
- [v3.1.1-beta.4 - 2023-08-07](#v311-beta4---2023-08-07)
|
||||||
|
- [v3.1.1-beta.3 - 2023-08-05](#v311-beta3---2023-08-05)
|
||||||
|
- [v3.1.1-beta.2 - 2023-08-04](#v311-beta2---2023-08-04)
|
||||||
|
- [v3.1.1-beta.1 - 2023-08-04](#v311-beta1---2023-08-04)
|
||||||
|
- [v3.1.1-alpha.3 - 2023-08-03](#v311-alpha3---2023-08-03)
|
||||||
|
- [v3.1.1-alpha.2 - 2023-08-03](#v311-alpha2---2023-08-03)
|
||||||
|
- [v3.1.1-alpha.1 - 2023-08-02](#v311-alpha1---2023-08-02)
|
||||||
|
- [v3.1.0 - 2023-07-28](#v310---2023-07-28)
|
||||||
|
- [Reverts](#reverts)
|
||||||
|
- [Pull Requests](#pull-requests)
|
||||||
|
|
||||||
|
|
||||||
|
<!-- END MUNGE: GENERATED_TOC -->
|
||||||
|
|
||||||
|
<a name="unreleased"></a>
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
|
||||||
|
<a name="v3.1.2-beta.3"></a>
|
||||||
|
## [v3.1.2-beta.3] - 2023-08-09
|
||||||
|
|
||||||
|
<a name="v3.1.2-beta.2"></a>
|
||||||
|
## [v3.1.2-beta.2] - 2023-08-09
|
||||||
|
|
||||||
|
<a name="v3.1.2-beta.1"></a>
|
||||||
|
## [v3.1.2-beta.1] - 2023-08-09
|
||||||
|
|
||||||
|
<a name="v3.1.2-beta.0"></a>
|
||||||
|
## [v3.1.2-beta.0] - 2023-08-08
|
||||||
|
|
||||||
|
<a name="v3.1.2.beta.0"></a>
|
||||||
|
## [v3.1.2.beta.0] - 2023-08-08
|
||||||
|
|
||||||
|
<a name="v3.1.1-beta.4"></a>
|
||||||
|
## [v3.1.1-beta.4] - 2023-08-07
|
||||||
|
|
||||||
|
<a name="v3.1.1-beta.3"></a>
|
||||||
|
## [v3.1.1-beta.3] - 2023-08-05
|
||||||
|
|
||||||
|
<a name="v3.1.1-beta.2"></a>
|
||||||
|
## [v3.1.1-beta.2] - 2023-08-04
|
||||||
|
|
||||||
|
<a name="v3.1.1-beta.1"></a>
|
||||||
|
## [v3.1.1-beta.1] - 2023-08-04
|
||||||
|
|
||||||
|
<a name="v3.1.1-alpha.3"></a>
|
||||||
|
## [v3.1.1-alpha.3] - 2023-08-03
|
||||||
|
|
||||||
|
<a name="v3.1.1-alpha.2"></a>
|
||||||
|
## [v3.1.1-alpha.2] - 2023-08-03
|
||||||
|
|
||||||
|
<a name="v3.1.1-alpha.1"></a>
|
||||||
|
## [v3.1.1-alpha.1] - 2023-08-02
|
||||||
|
|
||||||
|
<a name="v3.1.0"></a>
|
||||||
|
## v3.1.0 - 2023-07-28
|
||||||
|
### Reverts
|
||||||
|
- update etcd to v3.5.2 ([#206](https://github.com/OpenIMSDK/Open-IM-Server/issues/206))
|
||||||
|
|
||||||
|
### Pull Requests
|
||||||
|
- Merge branch 'tuoyun'
|
||||||
|
|
||||||
|
|
||||||
|
[Unreleased]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.3...HEAD
|
||||||
|
[v3.1.2-beta.3]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.2...v3.1.2-beta.3
|
||||||
|
[v3.1.2-beta.2]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.1...v3.1.2-beta.2
|
||||||
|
[v3.1.2-beta.1]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2-beta.0...v3.1.2-beta.1
|
||||||
|
[v3.1.2-beta.0]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.2.beta.0...v3.1.2-beta.0
|
||||||
|
[v3.1.2.beta.0]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.4...v3.1.2.beta.0
|
||||||
|
[v3.1.1-beta.4]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.3...v3.1.1-beta.4
|
||||||
|
[v3.1.1-beta.3]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.2...v3.1.1-beta.3
|
||||||
|
[v3.1.1-beta.2]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-beta.1...v3.1.1-beta.2
|
||||||
|
[v3.1.1-beta.1]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-alpha.3...v3.1.1-beta.1
|
||||||
|
[v3.1.1-alpha.3]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-alpha.2...v3.1.1-alpha.3
|
||||||
|
[v3.1.1-alpha.2]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.1-alpha.1...v3.1.1-alpha.2
|
||||||
|
[v3.1.1-alpha.1]: https://github.com/OpenIMSDK/Open-IM-Server/compare/v3.1.0...v3.1.1-alpha.1
|
||||||
@ -3,6 +3,8 @@
|
|||||||
- [Changelog](#changelog)
|
- [Changelog](#changelog)
|
||||||
- [OpenIM versioning policy](#openim-versioning-policy)
|
- [OpenIM versioning policy](#openim-versioning-policy)
|
||||||
- [command](#command)
|
- [command](#command)
|
||||||
|
- [install](#install)
|
||||||
|
- [User](#user)
|
||||||
- [create next tag](#create-next-tag)
|
- [create next tag](#create-next-tag)
|
||||||
- [Release version logs](#release-version-logs)
|
- [Release version logs](#release-version-logs)
|
||||||
- [Introduction](#introduction)
|
- [Introduction](#introduction)
|
||||||
@ -22,10 +24,68 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
## command
|
## command
|
||||||
|
|
||||||
|
To use git-chglog you need to configure:
|
||||||
|
|
||||||
|
1. CHANGELOG templates
|
||||||
|
2. git-chglog configuration
|
||||||
|
|
||||||
|
### install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go get github.com/git-chglog/git-chglog/cmd/git-chglog
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## User
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git-chglog --init
|
||||||
|
```
|
||||||
|
|
||||||
|
**Options**
|
||||||
|
|
||||||
|
- What is the URL of your repository?: https://github.com/marmotedu/iam
|
||||||
|
- What is your favorite style?: github
|
||||||
|
- Choose the format of your favorite commit message: <type>(<scope>): <subject> -- feat(core): Add new feature
|
||||||
|
- What is your favorite template style?: standard
|
||||||
|
- Do you include Merge Commit in CHANGELOG?: n
|
||||||
|
- Do you include Revert Commit in CHANGELOG?: y
|
||||||
|
- In which directory do you output configuration files and templates?: .chglog
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git-chglog --tag-filter-pattern 'v2.0.*' -o CHANGELOG-2.0.md
|
git-chglog --tag-filter-pattern 'v2.0.*' -o CHANGELOG-2.0.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Other uses:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git-chglog
|
||||||
|
|
||||||
|
If <tag query> is not specified, it corresponds to all tags.
|
||||||
|
This is the simplest example.
|
||||||
|
|
||||||
|
$ git-chglog 1.0.0..2.0.0
|
||||||
|
|
||||||
|
The above is a command to generate CHANGELOG including commit of 1.0.0 to 2.0.0.
|
||||||
|
|
||||||
|
$ git-chglog 1.0.0
|
||||||
|
|
||||||
|
The above is a command to generate CHANGELOG including commit of only 1.0.0.
|
||||||
|
|
||||||
|
$ git-chglog $(git describe --tags $(git rev-list --tags --max-count=1))
|
||||||
|
|
||||||
|
The above is a command to generate CHANGELOG with the commit included in the latest tag.
|
||||||
|
|
||||||
|
$ git-chglog --output CHANGELOG.md
|
||||||
|
|
||||||
|
The above is a command to output to CHANGELOG.md instead of standard output.
|
||||||
|
|
||||||
|
$ git-chglog --config custom/dir/config.yml
|
||||||
|
|
||||||
|
The above is a command that uses a configuration file placed other than ".chglog/config.yml".
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## create next tag
|
## create next tag
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -51,6 +111,7 @@ git tag 2.0.0
|
|||||||
+ [OpenIM CHANGELOG-V2.3](CHANGELOG-2.3.md)
|
+ [OpenIM CHANGELOG-V2.3](CHANGELOG-2.3.md)
|
||||||
+ [OpenIM CHANGELOG-V2.9](CHANGELOG-2.9.md)
|
+ [OpenIM CHANGELOG-V2.9](CHANGELOG-2.9.md)
|
||||||
+ [OpenIM CHANGELOG-V3.0](CHANGELOG-3.0.md)
|
+ [OpenIM CHANGELOG-V3.0](CHANGELOG-3.0.md)
|
||||||
|
+ [OpenIM CHANGELOG-V3.1](CHANGELOG-3.1.md)
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ OpenIM 支持很多种集群化部署方式,包括但不限于 helm, sealos, k
|
|||||||
- https://github.com/showurl/deploy-openim
|
- https://github.com/showurl/deploy-openim
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 依赖检查
|
### 依赖检查
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@ -64,12 +64,11 @@ cmd/*
|
|||||||
# config directory
|
# config directory
|
||||||
config/* @skiffer-git
|
config/* @skiffer-git
|
||||||
|
|
||||||
# db directory
|
|
||||||
db/sdk @cubxxw @FGadvancer
|
|
||||||
|
|
||||||
# internal directory
|
# internal directory
|
||||||
internal/ @openimsdk/openim @skiffer-git @FGadvancer
|
internal/ @openimsdk/openim @skiffer-git @FGadvancer
|
||||||
|
|
||||||
|
tools @openimsdk/openim @openimsdk/bot @cubxxw @skiffer-git @FGadvancer
|
||||||
|
|
||||||
# logs directory
|
# logs directory
|
||||||
logs/* @skiffer-git @FGadvancer
|
logs/* @skiffer-git @FGadvancer
|
||||||
|
|
||||||
|
|||||||
@ -13,44 +13,34 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
. $(dirname ${BASH_SOURCE})/lib/init.sh
|
. $(dirname ${BASH_SOURCE})/lib/color.sh
|
||||||
|
|
||||||
trap 'echo "Script interrupted."; exit 1' INT
|
trap 'openim::color::echo RED_PREFIX "Script interrupted."; exit 1' INT
|
||||||
|
|
||||||
# Function for colored echo
|
print_with_delay() {
|
||||||
function color_echo() {
|
|
||||||
COLOR=$1
|
|
||||||
shift
|
|
||||||
echo -e "${COLOR}===> $* ${COLOR_SUFFIX}"
|
|
||||||
}
|
|
||||||
|
|
||||||
function print_with_delay() {
|
|
||||||
text="$1"
|
text="$1"
|
||||||
delay="$2"
|
delay="$2"
|
||||||
color="$3"
|
|
||||||
|
|
||||||
for i in $(seq 0 $((${#text}-1))); do
|
for i in $(seq 0 $((${#text}-1))); do
|
||||||
printf "${color}${text:$i:1}${COLOR_SUFFIX}"
|
printf "${text:$i:1}"
|
||||||
sleep $delay
|
sleep $delay
|
||||||
done
|
done
|
||||||
printf "\n"
|
printf "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_progress() {
|
print_progress() {
|
||||||
total="$1"
|
total="$1"
|
||||||
delay="$2"
|
delay="$2"
|
||||||
color="$3"
|
|
||||||
|
|
||||||
printf "${color}["
|
printf "["
|
||||||
for i in $(seq 1 $total); do
|
for i in $(seq 1 $total); do
|
||||||
printf "#"
|
printf "#"
|
||||||
sleep $delay
|
sleep $delay
|
||||||
done
|
done
|
||||||
printf "]${COLOR_SUFFIX}\n"
|
printf "]\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
function openim_logo() {
|
function openim_logo() {
|
||||||
|
|||||||
@ -37,7 +37,8 @@ readonly DOCKER_MACHINE_DRIVER=${DOCKER_MACHINE_DRIVER:-"virtualbox --virtualbox
|
|||||||
# This will canonicalize the path
|
# This will canonicalize the path
|
||||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd -P)
|
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd -P)
|
||||||
|
|
||||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
# Please do not refer to lib after referring to common
|
||||||
|
. $(dirname ${BASH_SOURCE})/lib/init.sh
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
readonly OPENIM_BUILD_IMAGE_REPO=openim-build
|
readonly OPENIM_BUILD_IMAGE_REPO=openim-build
|
||||||
|
|||||||
25
scripts/install/common.sh
Executable file
25
scripts/install/common.sh
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2020 Lingfei Kong <colin404@foxmail.com>. All rights reserved.
|
||||||
|
# Use of this source code is governed by a MIT style
|
||||||
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
|
||||||
|
# Common utilities, variables and checks for all build scripts.
|
||||||
|
set -o errexit
|
||||||
|
set +o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# Sourced flag
|
||||||
|
COMMON_SOURCED=true
|
||||||
|
|
||||||
|
# The root of the build/dist directory
|
||||||
|
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||||
|
|
||||||
|
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||||
|
source "${OPENIM_ROOT}/scripts/install/environment.sh"
|
||||||
|
|
||||||
|
# Execute commands that require root permission without entering a password
|
||||||
|
function openim::common::sudo {
|
||||||
|
echo ${LINUX_PASSWORD} | sudo -S $1
|
||||||
|
}
|
||||||
@ -5,10 +5,10 @@
|
|||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
# OPENIM 项目源码根目录
|
# OPENIM 项目源码根目录
|
||||||
IAM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/../..
|
||||||
|
|
||||||
# 生成文件存放目录
|
# 生成文件存放目录
|
||||||
LOCAL_OUTPUT_ROOT="${IAM_ROOT}/${OUT_DIR:-_output}"
|
LOCAL_OUTPUT_ROOT="${OPENIM_ROOT}/${OUT_DIR:-_output}"
|
||||||
|
|
||||||
# 设置统一的密码,方便记忆
|
# 设置统一的密码,方便记忆
|
||||||
readonly PASSWORD=${PASSWORD:-'iam59!z$'}
|
readonly PASSWORD=${PASSWORD:-'iam59!z$'}
|
||||||
@ -21,7 +21,7 @@ readonly LINUX_PASSWORD=${LINUX_PASSWORD:-${PASSWORD}}
|
|||||||
# 设置安装目录
|
# 设置安装目录
|
||||||
readonly INSTALL_DIR=${INSTALL_DIR:-/tmp/installation}
|
readonly INSTALL_DIR=${INSTALL_DIR:-/tmp/installation}
|
||||||
mkdir -p ${INSTALL_DIR}
|
mkdir -p ${INSTALL_DIR}
|
||||||
readonly ENV_FILE=${IAM_ROOT}/scripts/install/environment.sh
|
readonly ENV_FILE=${OPENIM_ROOT}/scripts/install/environment.sh
|
||||||
|
|
||||||
# MariaDB 配置信息
|
# MariaDB 配置信息
|
||||||
readonly MARIADB_ADMIN_USERNAME=${MARIADB_ADMIN_USERNAME:-root} # MariaDB root 用户
|
readonly MARIADB_ADMIN_USERNAME=${MARIADB_ADMIN_USERNAME:-root} # MariaDB root 用户
|
||||||
@ -19,6 +19,18 @@
|
|||||||
# Usage: `scripts/color.sh`.
|
# Usage: `scripts/color.sh`.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
if [[ ! -v COLOR_OPEN ]]; then
|
||||||
|
COLOR_OPEN=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Function for colored echo
|
||||||
|
openim::color::echo() {
|
||||||
|
COLOR=$1
|
||||||
|
[ $COLOR_OPEN -eq 1 ] && echo -e "${COLOR} $(date '+%Y-%m-%d %H:%M:%S') $@ ${COLOR_SUFFIX}"
|
||||||
|
shift
|
||||||
|
}
|
||||||
|
|
||||||
# Define color variables
|
# Define color variables
|
||||||
# --- Feature ---
|
# --- Feature ---
|
||||||
COLOR_NORMAL='\033[0m';COLOR_BOLD='\033[1m';COLOR_DIM='\033[2m';COLOR_UNDER='\033[4m';
|
COLOR_NORMAL='\033[0m';COLOR_BOLD='\033[1m';COLOR_DIM='\033[2m';COLOR_UNDER='\033[4m';
|
||||||
@ -36,21 +48,9 @@ COLOR_BGREEN='\033[42m';COLOR_BYELLOW='\033[43m';
|
|||||||
COLOR_BBLUE='\033[44m';COLOR_BMAGENTA='\033[45m';
|
COLOR_BBLUE='\033[44m';COLOR_BMAGENTA='\033[45m';
|
||||||
COLOR_BCYAN='\033[46m';COLOR_BWHITE='\033[47m';
|
COLOR_BCYAN='\033[46m';COLOR_BWHITE='\033[47m';
|
||||||
|
|
||||||
# --- make demo (run demo) ---
|
|
||||||
reset=$(tput sgr0)
|
|
||||||
bold=$(tput bold)
|
|
||||||
black=$(tput setaf 0)
|
|
||||||
red=$(tput setaf 1)
|
|
||||||
green=$(tput bold; tput setaf 2)
|
|
||||||
yellow=$(tput bold; tput setaf 3)
|
|
||||||
blue=$(tput bold; tput setaf 6)
|
|
||||||
timeout=$(if [ "$(uname)" == "Darwin" ]; then echo "1"; else echo "0.1"; fi)
|
|
||||||
|
|
||||||
# --- Color definitions ---
|
# --- Color definitions ---
|
||||||
# Color definitions
|
# Color definitions
|
||||||
function openim_color() {
|
|
||||||
COLOR_SUFFIX="\033[0m" # End all colors and special effects
|
COLOR_SUFFIX="\033[0m" # End all colors and special effects
|
||||||
|
|
||||||
BLACK_PREFIX="\033[30m" # Black prefix
|
BLACK_PREFIX="\033[30m" # Black prefix
|
||||||
RED_PREFIX="\033[31m" # Red prefix
|
RED_PREFIX="\033[31m" # Red prefix
|
||||||
GREEN_PREFIX="\033[32m" # Green prefix
|
GREEN_PREFIX="\033[32m" # Green prefix
|
||||||
@ -61,36 +61,18 @@ function openim_color() {
|
|||||||
BOLD_PREFIX="\033[1m" # Bold prefix
|
BOLD_PREFIX="\033[1m" # Bold prefix
|
||||||
UNDERLINE_PREFIX="\033[4m" # Underline prefix
|
UNDERLINE_PREFIX="\033[4m" # Underline prefix
|
||||||
ITALIC_PREFIX="\033[3m" # Italic prefix
|
ITALIC_PREFIX="\033[3m" # Italic prefix
|
||||||
|
|
||||||
CYAN_PREFIX="\033[0;36m" # Cyan prefix
|
CYAN_PREFIX="\033[0;36m" # Cyan prefix
|
||||||
}
|
|
||||||
|
|
||||||
# --- helper functions for logs ---
|
# --- make demo (run demo) ---
|
||||||
function info()
|
reset=$(tput sgr0)
|
||||||
{
|
bold=$(tput bold)
|
||||||
echo -e "[${GREEN_PREFIX}INFO${COLOR_SUFFIX}] " "$@"
|
black=$(tput setaf 0)
|
||||||
}
|
red=$(tput setaf 1)
|
||||||
|
green=$(tput bold; tput setaf 2)
|
||||||
|
yellow=$(tput bold; tput setaf 3)
|
||||||
|
blue=$(tput bold; tput setaf 6)
|
||||||
|
timeout=$(if [ "$(uname)" == "Darwin" ]; then echo "1"; else echo "0.1"; fi)
|
||||||
|
|
||||||
function warn()
|
|
||||||
{
|
|
||||||
echo -e "[${YELLOW_PREFIX}WARN${COLOR_SUFFIX}] " "$@" >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
function fatal()
|
|
||||||
{
|
|
||||||
echo -e "[${RED_PREFIX}ERROR${COLOR_SUFFIX}] " "$@" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function debug()
|
|
||||||
{
|
|
||||||
echo -e "[${BLUE_PREFIX}DEBUG${COLOR_SUFFIX}]===> " "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function success()
|
|
||||||
{
|
|
||||||
echo -e "${BRIGHT_GREEN_PREFIX}===> [SUCCESS] <===${COLOR_SUFFIX}\n=> " "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Print colors you can use
|
# Print colors you can use
|
||||||
openim::color::print_color()
|
openim::color::print_color()
|
||||||
|
|||||||
@ -38,6 +38,7 @@ OPENIM_OUTPUT_BINPATH="${OPENIM_OUTPUT}/bin/platforms"
|
|||||||
OPENIM_OUTPUT_BINTOOLPATH="${OPENIM_OUTPUT}/bin-tools"
|
OPENIM_OUTPUT_BINTOOLPATH="${OPENIM_OUTPUT}/bin-tools"
|
||||||
OPENIM_OUTPUT_TOOLS="${OPENIM_OUTPUT}/tools"
|
OPENIM_OUTPUT_TOOLS="${OPENIM_OUTPUT}/tools"
|
||||||
OPENIM_OUTPUT_TMP="${OPENIM_OUTPUT}/tmp"
|
OPENIM_OUTPUT_TMP="${OPENIM_OUTPUT}/tmp"
|
||||||
|
OPENIM_OUTPUT_LOGS="${OPENIM_OUTPUT}/logs"
|
||||||
|
|
||||||
# This controls rsync compression. Set to a value > 0 to enable rsync
|
# This controls rsync compression. Set to a value > 0 to enable rsync
|
||||||
# compression for build container
|
# compression for build container
|
||||||
|
|||||||
@ -13,10 +13,26 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
# Controls verbosity of the script output and logging.
|
# Controls verbosity of the script output and logging.
|
||||||
OPENIM_VERBOSE="${OPENIM_VERBOSE:-5}"
|
OPENIM_VERBOSE="${OPENIM_VERBOSE:-5}"
|
||||||
|
|
||||||
|
if [[ ! -v OPENIM_VERBOSE ]]; then
|
||||||
|
openim::log::info "OPENIM_VERBOSE is not set; defaulting to \"5\""
|
||||||
|
OPENIM_OUTPUT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../_output" && pwd -P)"
|
||||||
|
OPENIM_VERBOSE="${OPENIM_OUTPUT}/logs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_file="${OPENIM_OUTPUT_LOGS}/openim_$(date '+%Y%m%d').log"
|
||||||
|
|
||||||
|
function echo_log() {
|
||||||
|
echo_log -e "$@" | tee -a "${log_file}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# MAX_LOG_SIZE=10485760 # 10MB
|
||||||
|
|
||||||
|
# Clear logs from 5 days ago
|
||||||
|
# find $OPENIM_OUTPUT_LOGS -type f -name "*.log" -mtime +5 -exec rm -f {} \;
|
||||||
|
|
||||||
# Handler for when we exit automatically on an error.
|
# Handler for when we exit automatically on an error.
|
||||||
# Borrowed from https://gist.github.com/ahendrix/7030300
|
# Borrowed from https://gist.github.com/ahendrix/7030300
|
||||||
openim::log::errexit() {
|
openim::log::errexit() {
|
||||||
@ -58,7 +74,7 @@ openim::log::stack() {
|
|||||||
local stack_skip=${1:-0}
|
local stack_skip=${1:-0}
|
||||||
stack_skip=$((stack_skip + 1))
|
stack_skip=$((stack_skip + 1))
|
||||||
if [[ ${#FUNCNAME[@]} -gt ${stack_skip} ]]; then
|
if [[ ${#FUNCNAME[@]} -gt ${stack_skip} ]]; then
|
||||||
echo "Call stack:" >&2
|
echo_log_log "Call stack:" >&2
|
||||||
local i
|
local i
|
||||||
for ((i=1 ; i <= ${#FUNCNAME[@]} - stack_skip ; i++))
|
for ((i=1 ; i <= ${#FUNCNAME[@]} - stack_skip ; i++))
|
||||||
do
|
do
|
||||||
@ -66,7 +82,7 @@ openim::log::stack() {
|
|||||||
local source_file=${BASH_SOURCE[${frame_no}]}
|
local source_file=${BASH_SOURCE[${frame_no}]}
|
||||||
local source_lineno=${BASH_LINENO[$((frame_no - 1))]}
|
local source_lineno=${BASH_LINENO[$((frame_no - 1))]}
|
||||||
local funcname=${FUNCNAME[${frame_no}]}
|
local funcname=${FUNCNAME[${frame_no}]}
|
||||||
echo " ${i}: ${source_file}:${source_lineno} ${funcname}(...)" >&2
|
echo_log_log " ${i}: ${source_file}:${source_lineno} ${funcname}(...)" >&2
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -85,14 +101,14 @@ openim::log::error_exit() {
|
|||||||
if [[ ${OPENIM_VERBOSE} -ge 4 ]]; then
|
if [[ ${OPENIM_VERBOSE} -ge 4 ]]; then
|
||||||
local source_file=${BASH_SOURCE[${stack_skip}]}
|
local source_file=${BASH_SOURCE[${stack_skip}]}
|
||||||
local source_line=${BASH_LINENO[$((stack_skip - 1))]}
|
local source_line=${BASH_LINENO[$((stack_skip - 1))]}
|
||||||
echo "!!! Error in ${source_file}:${source_line}" >&2
|
echo_log "!!! Error in ${source_file}:${source_line}" >&2
|
||||||
[[ -z ${1-} ]] || {
|
[[ -z ${1-} ]] || {
|
||||||
echo " ${1}" >&2
|
echo_log " ${1}" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
openim::log::stack ${stack_skip}
|
openim::log::stack ${stack_skip}
|
||||||
|
|
||||||
echo "Exiting with status ${code}" >&2
|
echo_log "Exiting with status ${code}" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit "${code}"
|
exit "${code}"
|
||||||
@ -101,21 +117,21 @@ openim::log::error_exit() {
|
|||||||
# Log an error but keep going. Don't dump the stack or exit.
|
# Log an error but keep going. Don't dump the stack or exit.
|
||||||
openim::log::error() {
|
openim::log::error() {
|
||||||
timestamp=$(date +"[%m%d %H:%M:%S]")
|
timestamp=$(date +"[%m%d %H:%M:%S]")
|
||||||
echo "!!! ${timestamp} ${1-}" >&2
|
echo_log "!!! ${timestamp} ${1-}" >&2
|
||||||
shift
|
shift
|
||||||
for message; do
|
for message; do
|
||||||
echo " ${message}" >&2
|
echo_log " ${message}" >&2
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print an usage message to stderr. The arguments are printed directly.
|
# Print an usage message to stderr. The arguments are printed directly.
|
||||||
openim::log::usage() {
|
openim::log::usage() {
|
||||||
echo >&2
|
echo_log >&2
|
||||||
local message
|
local message
|
||||||
for message; do
|
for message; do
|
||||||
echo "${message}" >&2
|
echo_log "${message}" >&2
|
||||||
done
|
done
|
||||||
echo >&2
|
echo_log >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
openim::log::usage_from_stdin() {
|
openim::log::usage_from_stdin() {
|
||||||
@ -135,14 +151,14 @@ openim::log::info() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for message; do
|
for message; do
|
||||||
echo "${message}"
|
echo_log "${message}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Just like openim::log::info, but no \n, so you can make a progress bar
|
# Just like openim::log::info, but no \n, so you can make a progress bar
|
||||||
openim::log::progress() {
|
openim::log::progress() {
|
||||||
for message; do
|
for message; do
|
||||||
echo -e -n "${message}"
|
echo_log -e -n "${message}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,9 +179,18 @@ openim::log::status() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
timestamp=$(date +"[%m%d %H:%M:%S]")
|
timestamp=$(date +"[%m%d %H:%M:%S]")
|
||||||
echo "+++ ${timestamp} ${1}"
|
echo_log "+++ ${timestamp} ${1}"
|
||||||
shift
|
shift
|
||||||
for message; do
|
for message; do
|
||||||
echo " ${message}"
|
echo_log " ${message}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openim::log::success()
|
||||||
|
{
|
||||||
|
local V="${V:-0}"
|
||||||
|
if [[ ${OPENIM_VERBOSE} < ${V} ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo_log -e "${BRIGHT_GREEN_PREFIX}===> [success] <===${COLOR_SUFFIX}\n=> " "$@"
|
||||||
|
}
|
||||||
@ -52,6 +52,12 @@ BIN_TOOLS_DIR := $(OUTPUT_DIR)/bin-tools
|
|||||||
$(shell mkdir -p $(BIN_TOOLS_DIR))
|
$(shell mkdir -p $(BIN_TOOLS_DIR))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# LOGS_DIR: Directory where log files are stored.
|
||||||
|
ifeq ($(origin LOGS_DIR),undefined)
|
||||||
|
LOGS_DIR := $(OUTPUT_DIR)/logs
|
||||||
|
$(shell mkdir -p $(LOGS_DIR))
|
||||||
|
endif
|
||||||
|
|
||||||
# TOOLS_DIR: The directory where tools are stored for build and testing.
|
# TOOLS_DIR: The directory where tools are stored for build and testing.
|
||||||
ifeq ($(origin TOOLS_DIR),undefined)
|
ifeq ($(origin TOOLS_DIR),undefined)
|
||||||
TOOLS_DIR := $(OUTPUT_DIR)/tools
|
TOOLS_DIR := $(OUTPUT_DIR)/tools
|
||||||
|
|||||||
@ -221,8 +221,8 @@ go.updates: tools.verify.go-mod-outdated
|
|||||||
## go.clean: Clean all builds directories and files
|
## go.clean: Clean all builds directories and files
|
||||||
.PHONY: go.clean
|
.PHONY: go.clean
|
||||||
go.clean:
|
go.clean:
|
||||||
@echo "===========> Cleaning all builds TMP_DIR($(TMP_DIR)) AND BIN_DIR($(BIN_DIR)) AND BIN_TOOLS_DIR($(BIN_TOOLS_DIR))"
|
@echo "===========> Cleaning all builds tmp, bin, logs directories and files"
|
||||||
@-rm -vrf $(TMP_DIR) $(BIN_DIR) $(BIN_TOOLS_DIR)
|
@-rm -vrf $(TMP_DIR) $(BIN_DIR) $(BIN_TOOLS_DIR) $(LOGS_DIR)
|
||||||
@echo "===========> End clean..."
|
@echo "===========> End clean..."
|
||||||
|
|
||||||
## copyright.help: Show copyright help
|
## copyright.help: Show copyright help
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user