mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 17:45:59 +08:00
feat: add scripts
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
+15
-5
@@ -33,10 +33,20 @@ readonly OPENIM_SUPPORTED_CLIENT_PLATFORMS=(
|
||||
# If you update this list, please also update build/BUILD.
|
||||
openim::golang::server_targets() {
|
||||
local targets=(
|
||||
openim-apiserver
|
||||
openim-authz-server
|
||||
openim-pump
|
||||
openim-watcher
|
||||
openim_api
|
||||
openim_cmdutils
|
||||
openim_cmdutils
|
||||
openim_crontask
|
||||
openim_msggateway
|
||||
openim_msgtransfer
|
||||
openim_push
|
||||
openim_rpc_auth
|
||||
openim_rpc_conversation
|
||||
openim_rpc_friend
|
||||
openim_rpc_group
|
||||
openim_rpc_msg
|
||||
openim_rpc_third
|
||||
openim_rpc_user
|
||||
)
|
||||
echo "${targets[@]}"
|
||||
}
|
||||
@@ -137,7 +147,7 @@ openim::golang::setup_platforms
|
||||
# The set of client targets that we are building for all platforms
|
||||
# If you update this list, please also update build/BUILD.
|
||||
readonly OPENIM_CLIENT_TARGETS=(
|
||||
iamctl
|
||||
imctl
|
||||
)
|
||||
readonly OPENIM_CLIENT_BINARIES=("${OPENIM_CLIENT_TARGETS[@]##*/}")
|
||||
|
||||
|
||||
+26
-7
@@ -137,12 +137,13 @@ function openim::release::package_src_tarball() {
|
||||
! \( \
|
||||
\( -path "${OPENIM_ROOT}"/_\* -o \
|
||||
-path "${OPENIM_ROOT}"/.git\* -o \
|
||||
-path "${OPENIM_ROOT}"/.github\* -o \
|
||||
-path "${OPENIM_ROOT}"/.gitignore\* -o \
|
||||
-path "${OPENIM_ROOT}"/.gsemver.yaml\* -o \
|
||||
-path "${OPENIM_ROOT}"/.gsemver.yml\* -o \
|
||||
-path "${OPENIM_ROOT}"/.config\* -o \
|
||||
-path "${OPENIM_ROOT}"/.chglog\* -o \
|
||||
-path "${OPENIM_ROOT}"/.gitlint -o \
|
||||
-path "${OPENIM_ROOT}"/.golangci.yaml -o \
|
||||
-path "${OPENIM_ROOT}"/.golangci.yml -o \
|
||||
-path "${OPENIM_ROOT}"/.goreleaser.yml -o \
|
||||
-path "${OPENIM_ROOT}"/.note.md -o \
|
||||
-path "${OPENIM_ROOT}"/.todo.md \
|
||||
@@ -274,6 +275,15 @@ function openim::release::sha1() {
|
||||
fi
|
||||
}
|
||||
|
||||
function openim::release::sha256() {
|
||||
if which sha256sum >/dev/null 2>&1; then
|
||||
sha256sum "$1" | awk '{ print $1 }'
|
||||
else
|
||||
shasum -a256 "$1" | awk '{ print $1 }'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function openim::release::build_conformance_image() {
|
||||
local -r arch="$1"
|
||||
local -r registry="$2"
|
||||
@@ -396,10 +406,19 @@ function openim::release::package_iam_manifests_tarball() {
|
||||
local dst_dir="${release_stage}"
|
||||
mkdir -p "${dst_dir}"
|
||||
cp -r ${src_dir}/* "${dst_dir}"
|
||||
#cp "${src_dir}/openim-apiserver.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim-authz-server.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim-pump.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim-watcher.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim-api.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_cmdutils.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_crontask.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_msggateway.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_msgtransfer.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_push.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_rpc_auth.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_rpc_conversation.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_rpc_friend.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_rpc_group.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_rpc_msg.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_rpc_third.yaml" "${dst_dir}"
|
||||
#cp "${src_dir}/openim_rpc_user.yaml" "${dst_dir}"
|
||||
#cp "${OPENIM_ROOT}/cluster/gce/gci/health-monitor.sh" "${dst_dir}/health-monitor.sh"
|
||||
|
||||
openim::release::clean_cruft
|
||||
@@ -603,5 +622,5 @@ function openim::release::generate_changelog() {
|
||||
set +o errexit
|
||||
git add ${OPENIM_ROOT}/CHANGELOG/CHANGELOG-${OPENIM_GIT_VERSION#v}.md
|
||||
git commit -a -m "docs(changelog): add CHANGELOG-${OPENIM_GIT_VERSION#v}.md"
|
||||
git push -f origin master # 最后将 CHANGELOG 也 push 上去
|
||||
git push -f origin main # 最后将 CHANGELOG 也 push 上去
|
||||
}
|
||||
|
||||
+34
-17
@@ -64,7 +64,7 @@ openim::util::wait_for_url() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# Example: openim::util::wait_for_success 120 5 "iamctl get nodes|grep localhost"
|
||||
# Example: openim::util::wait_for_success 120 5 "imctl get nodes|grep localhost"
|
||||
# arguments: wait time, sleep time, shell command
|
||||
# returns 0 if the shell command get output, 1 otherwise.
|
||||
openim::util::wait_for_success(){
|
||||
@@ -212,7 +212,7 @@ openim::util::find-binary() {
|
||||
openim::util::find-binary-for-platform "$1" "$(openim::util::host_platform)"
|
||||
}
|
||||
|
||||
# Run all known doc generators (today gendocs and genman for iamctl)
|
||||
# Run all known doc generators (today gendocs and genman for imctl)
|
||||
# $1 is the directory to put those generated documents
|
||||
openim::util::gen-docs() {
|
||||
local dest="$1"
|
||||
@@ -228,25 +228,42 @@ openim::util::gen-docs() {
|
||||
# least from k/k tree), remove it completely.
|
||||
openim::util::sourced_variable "${genfeddocs}"
|
||||
|
||||
mkdir -p "${dest}/docs/guide/en-US/cmd/iamctl/"
|
||||
"${gendocs}" "${dest}/docs/guide/en-US/cmd/iamctl/"
|
||||
mkdir -p "${dest}/docs/guide/en-US/cmd/imctl/"
|
||||
"${gendocs}" "${dest}/docs/guide/en-US/cmd/imctl/"
|
||||
|
||||
mkdir -p "${dest}/docs/guide/en-US/cmd/"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim-apiserver"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim-authz-server"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim-pump"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim-watcher"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/iamctl" "iamctl"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_api"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_cmdutils"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_crontask"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_msggateway"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_msgtransfer"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_push"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_rpc_auth"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_rpc_conversation"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_rpc_friend"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_rpc_group"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_rpc_msg"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_rpc_third"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/" "openim_rpc_user"
|
||||
"${geniamdocs}" "${dest}/docs/guide/en-US/cmd/imctl" "imctl"
|
||||
|
||||
mkdir -p "${dest}/docs/man/man1/"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim-apiserver"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim-authz-server"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim-pump"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim-watcher"
|
||||
"${genman}" "${dest}/docs/man/man1/" "iamctl"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_api"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_cmdutils"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_crontask"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_msggateway"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_msgtransfer"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_push"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_rpc_auth"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_rpc_conversation"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_rpc_friend"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_rpc_group"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_rpc_msg"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_rpc_third"
|
||||
"${genman}" "${dest}/docs/man/man1/" "openim_rpc_user"
|
||||
|
||||
mkdir -p "${dest}/docs/guide/en-US/yaml/iamctl/"
|
||||
"${genyaml}" "${dest}/docs/guide/en-US/yaml/iamctl/"
|
||||
mkdir -p "${dest}/docs/guide/en-US/yaml/imctl/"
|
||||
"${genyaml}" "${dest}/docs/guide/en-US/yaml/imct/"
|
||||
|
||||
# create the list of generated files
|
||||
pushd "${dest}" > /dev/null || return 1
|
||||
@@ -471,7 +488,7 @@ EOF
|
||||
# flatten the iamconfig files to make them self contained
|
||||
username=$(whoami)
|
||||
${sudo} /usr/bin/env bash -e <<EOF
|
||||
$(openim::util::find-binary iamctl) --iamconfig="${dest_dir}/${client_id}.iamconfig" config view --minify --flatten > "/tmp/${client_id}.iamconfig"
|
||||
$(openim::util::find-binary imct) --iamconfig="${dest_dir}/${client_id}.iamconfig" config view --minify --flatten > "/tmp/${client_id}.iamconfig"
|
||||
mv -f "/tmp/${client_id}.iamconfig" "${dest_dir}/${client_id}.iamconfig"
|
||||
chown ${username} "${dest_dir}/${client_id}.iamconfig"
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user