-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: Optimize deployment scripts and support local deployment
- Loading branch information
1 parent
99ec0ec
commit 46ef921
Showing
3 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,42 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
NOW_DIR=`cd $(dirname $0); pwd` | ||
VERSION=$1 | ||
if [ -z "$VERSION" ]; then | ||
echo "version is empty" | ||
exit 1 | ||
fi | ||
echo "version: ${VERSION}" | ||
|
||
function downloadfile() { | ||
url=$1 | ||
filename=$2 | ||
echo "download from: ${url}" | ||
if [ ! -e "${filename}" ]; then | ||
curl -o "${filename}" "${url}" | ||
fi | ||
echo "download success: ${filename}" | ||
} | ||
|
||
ROOT_PATH=$(dirname $(readlink -f $0))/chaosmeta_build | ||
echo "${ROOT_PATH}" | ||
mkdir -p "${ROOT_PATH}"/build | ||
mkdir -p "${ROOT_PATH}"/config | ||
mkdir -p "${ROOT_PATH}"/yamls | ||
ROOT_PATH=${NOW_DIR}/../ | ||
if [ "${VERSION}" != "local" ]; then | ||
ROOT_PATH=${NOW_DIR}/chaosmeta_build | ||
echo "${ROOT_PATH}" | ||
mkdir -p "${ROOT_PATH}"/build "${ROOT_PATH}"/config "${ROOT_PATH}"/yamls | ||
preurl=https://raw.githubusercontent.com/traas-stack/chaosmeta/"${VERSION}"/chaosmeta-inject-operator | ||
|
||
curl -o "${ROOT_PATH}"/config/chaosmeta-inject.json https://raw.githubusercontent.com/traas-stack/chaosmeta/"${VERSION}"/chaosmeta-inject-operator/config/chaosmeta-inject.json | ||
curl -o "${ROOT_PATH}"/build/build.sh https://raw.githubusercontent.com/traas-stack/chaosmeta/"${VERSION}"/chaosmeta-inject-operator/build/build.sh | ||
curl -o "${ROOT_PATH}"/yamls/chaosmeta.yaml https://raw.githubusercontent.com/traas-stack/chaosmeta/"${VERSION}"/chaosmeta-inject-operator/build/yamls/chaosmeta.yaml | ||
curl -o "${ROOT_PATH}"/yamls/chaosmeta-daemonset.yaml https://raw.githubusercontent.com/traas-stack/chaosmeta/"${VERSION}"/chaosmeta-inject-operator/build/yamls/chaosmeta-daemonset.yaml | ||
downloadfile "${preurl}"/config/chaosmeta-inject.json "${ROOT_PATH}"/config/chaosmeta-inject.json | ||
downloadfile "${preurl}"/build/build.sh "${ROOT_PATH}"/build/build.sh | ||
downloadfile "${preurl}"/build/yamls/chaosmeta.yaml "${ROOT_PATH}"/yamls/chaosmeta.yaml | ||
downloadfile "${preurl}"/build/yamls/chaosmeta-daemonset.yaml "${ROOT_PATH}"/yamls/chaosmeta-daemonset.yaml | ||
fi | ||
|
||
kubectl apply -f "${ROOT_PATH}"/yamls/chaosmeta.yaml | ||
kubectl apply -f "${ROOT_PATH}"/yamls/chaosmeta-daemonset.yaml | ||
sh "${ROOT_PATH}"/build/build.sh | ||
if [ "${VERSION}" != "local" ]; then | ||
sh "${ROOT_PATH}"/build/build.sh | ||
else | ||
sh "${ROOT_PATH}"/build.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
NOW_DIR=`cd $(dirname $0); pwd` | ||
VERSION=$1 | ||
ROOT_PATH=$(dirname $(readlink -f $0))/chaosmeta_build | ||
echo "${ROOT_PATH}" | ||
mkdir -p "${ROOT_PATH}"/yamls | ||
curl -o "${ROOT_PATH}"/yamls/chaosmeta.yaml https://raw.githubusercontent.com/traas-stack/chaosmeta/"${VERSION}"/chaosmeta-inject-operator/build/yamls/chaosmeta.yaml | ||
if [ -z "$VERSION" ]; then | ||
echo "version is empty" | ||
exit 1 | ||
fi | ||
echo "version: ${VERSION}" | ||
|
||
function downloadfile() { | ||
url=$1 | ||
filename=$2 | ||
echo "download from: ${url}" | ||
if [ ! -e "${filename}" ]; then | ||
curl -o "${filename}" "${url}" | ||
fi | ||
echo "download success: ${filename}" | ||
} | ||
|
||
ROOT_PATH=${NOW_DIR}/../ | ||
if [ "${VERSION}" != "local" ]; then | ||
ROOT_PATH=${NOW_DIR}/chaosmeta_build | ||
echo "${ROOT_PATH}" | ||
mkdir -p "${ROOT_PATH}"/yamls | ||
filename="${ROOT_PATH}"/yamls/chaosmeta.yaml | ||
|
||
if [ ! -e "${filename}" ]; then | ||
downloadfile https://raw.githubusercontent.com/traas-stack/chaosmeta/"${VERSION}"/chaosmeta-inject-operator/build/yamls/chaosmeta.yaml "${filename}" | ||
fi | ||
fi | ||
|
||
kubectl delete -f "${ROOT_PATH}"/yamls/chaosmeta.yaml |