mirror of https://gitee.com/bigwinds/arangodb
Bug fix/fix syncer login retry (#3371)
This commit is contained in:
parent
bf281688ca
commit
a9e4e2cc25
|
@ -37,6 +37,7 @@ fi
|
|||
|
||||
if test -f /scripts/prepare_buildenv.sh; then
|
||||
echo "Sourcing docker container environment settings"
|
||||
# shellcheck disable=SC1091
|
||||
. /scripts/prepare_buildenv.sh
|
||||
fi
|
||||
if test -z "${PARALLEL_BUILDS}"; then
|
||||
|
@ -644,11 +645,24 @@ fi
|
|||
THIRDPARTY_BIN=""
|
||||
THIRDPARTY_SBIN=""
|
||||
if test -n "${DOWNLOAD_SYNCER_USER}"; then
|
||||
|
||||
OAUTH_REPLY=$(
|
||||
curl -s "https://$DOWNLOAD_SYNCER_USER@api.github.com/authorizations" \
|
||||
--data "{\"scopes\":[\"repo\", \"repo_deployment\"],\"note\":\"Release$$-${OSNAME}\"}"
|
||||
)
|
||||
count=0
|
||||
SEQNO="$$"
|
||||
while test -z "${OAUTH_REPLY}"; do
|
||||
OAUTH_REPLY=$(
|
||||
curl -s "https://$DOWNLOAD_SYNCER_USER@api.github.com/authorizations" \
|
||||
--data "{\"scopes\":[\"repo\", \"repo_deployment\"],\"note\":\"Release${SEQNO}-${OSNAME}\"}"
|
||||
)
|
||||
if test -n "$(echo "${OAUTH_REPLY}" |grep already_exists)"; then
|
||||
# retry with another number...
|
||||
OAUTH_REPLY=""
|
||||
SEQNO=$((SEQNO + 1))
|
||||
count=$((count + 1))
|
||||
if test "${count}" -gt 20; then
|
||||
echo "failed to login to github! Giving up."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
OAUTH_TOKEN=$(echo "$OAUTH_REPLY" | \
|
||||
grep '"token"' |\
|
||||
sed -e 's;.*": *";;' -e 's;".*;;'
|
||||
|
@ -657,14 +671,12 @@ if test -n "${DOWNLOAD_SYNCER_USER}"; then
|
|||
grep '"id"' |\
|
||||
sed -e 's;.*": *;;' -e 's;,;;'
|
||||
)
|
||||
if test -z "${OAUTH_ID}"; then
|
||||
echo "failed to login to github! Giving up."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2064
|
||||
trap "curl -s -X DELETE \"https://$DOWNLOAD_SYNCER_USER@api.github.com/authorizations/${OAUTH_ID}\"" EXIT
|
||||
|
||||
if test -f "${SRC}/SYNCER_REV"; then
|
||||
SYNCER_REV=$(cat ${SRC}/SYNCER_REV)
|
||||
SYNCER_REV=$(cat "${SRC}/SYNCER_REV")
|
||||
else
|
||||
SYNCER_REV=$(curl -s "https://api.github.com/repos/arangodb/arangosync/releases?access_token=${OAUTH_TOKEN}" | \
|
||||
grep tag_name | \
|
||||
|
@ -795,6 +807,7 @@ set -e
|
|||
|
||||
if test "${PARTIAL_STATE}" == 0; then
|
||||
rm -rf CMakeFiles CMakeCache.txt CMakeCPackOptions.cmake cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake
|
||||
# shellcheck disable=SC2068
|
||||
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \
|
||||
cmake "${SOURCE_DIR}" ${CONFIGURE_OPTIONS[@]} -G "${GENERATOR}" || exit 1
|
||||
fi
|
||||
|
@ -809,6 +822,7 @@ fi
|
|||
TRIES=0;
|
||||
set +e
|
||||
while /bin/true; do
|
||||
# shellcheck disable=SC2068
|
||||
${MAKE_CMD_PREFIX} ${MAKE} ${MAKE_PARAMS[@]}
|
||||
RC=$?
|
||||
if test "${isCygwin}" == 1 -a "${RC}" != 0 -a "${TRIES}" == 0; then
|
||||
|
@ -917,6 +931,7 @@ if test -n "${TARGET_DIR}"; then
|
|||
${SED} -e "s/.*optimized;//" -e "s/;.*//" -e "s;/lib.*lib;;" -e "s;\([a-zA-Z]*\):;/cygdrive/\1;"
|
||||
)
|
||||
DLLS=$(find "${SSLDIR}" -name \*.dll |grep -i release)
|
||||
# shellcheck disable=SC2086
|
||||
cp ${DLLS} "bin/${BUILD_CONFIG}"
|
||||
cp "bin/${BUILD_CONFIG}/"* bin/
|
||||
cp "tests/${BUILD_CONFIG}/"*exe bin/
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
SRC_DIR="${SCRIPT_DIR}/../"
|
||||
ENTERPRISE_SRC_DIR=${SRC_DIR}enterprise
|
||||
ENTERPRISE_SRC_DIR="${SRC_DIR}enterprise"
|
||||
|
||||
FORCE_TAG=0
|
||||
TAG=1
|
||||
|
@ -17,9 +17,9 @@ PARALLEL=8
|
|||
SED=sed
|
||||
isMac=0
|
||||
if test "$(uname)" == "Darwin"; then
|
||||
isMac=1
|
||||
SED=gsed
|
||||
OSNAME=darwin
|
||||
isMac=1
|
||||
fi
|
||||
|
||||
if flex --version; then
|
||||
|
@ -120,11 +120,11 @@ while [ "$#" -gt 0 ]; do
|
|||
esac
|
||||
done
|
||||
|
||||
if [ -d ${ENTERPRISE_SRC_DIR} ]; then
|
||||
if [ -d "${ENTERPRISE_SRC_DIR}" ]; then
|
||||
echo "enterprise directory missing"
|
||||
fi
|
||||
|
||||
if echo ${VERSION} | grep -q -- '-'; then
|
||||
if echo "${VERSION}" | grep -q -- '-'; then
|
||||
echo "${VERSION} mustn't contain minuses! "
|
||||
exit 1
|
||||
fi
|
||||
|
@ -148,13 +148,59 @@ if test -z "${DOWNLOAD_SYNCER_USER}"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
GITSHA=`git log -n1 --pretty='%h'`
|
||||
if git describe --exact-match --tags ${GITSHA}; then
|
||||
GITARGS=`git describe --exact-match --tags ${GITSHA}`
|
||||
count=0
|
||||
SEQNO="$$"
|
||||
while test -z "${OAUTH_REPLY}"; do
|
||||
OAUTH_REPLY=$(
|
||||
curl -s "https://$DOWNLOAD_SYNCER_USER@api.github.com/authorizations" \
|
||||
--data "{\"scopes\":[\"repo\", \"repo_deployment\"],\"note\":\"Release-tag-${SEQNO}-${OSNAME}\"}"
|
||||
)
|
||||
if test -n "$(echo "${OAUTH_REPLY}" |grep already_exists)"; then
|
||||
# retry with another number...
|
||||
OAUTH_REPLY=""
|
||||
SEQNO=$((SEQNO + 1))
|
||||
count=$((count + 1))
|
||||
if test "${count}" -gt 20; then
|
||||
echo "failed to login to github! Giving up."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
OAUTH_TOKEN=$(echo "$OAUTH_REPLY" | \
|
||||
grep '"token"' |\
|
||||
sed -e 's;.*": *";;' -e 's;".*;;'
|
||||
)
|
||||
OAUTH_ID=$(echo "$OAUTH_REPLY" | \
|
||||
grep '"id"' |\
|
||||
sed -e 's;.*": *;;' -e 's;,;;'
|
||||
)
|
||||
|
||||
# shellcheck disable=SC2064
|
||||
trap "curl -s -X DELETE \"https://$DOWNLOAD_SYNCER_USER@api.github.com/authorizations/${OAUTH_ID}\"" EXIT
|
||||
|
||||
|
||||
GET_SYNCER_REV=$(curl -s "https://api.github.com/repos/arangodb/arangosync/releases?access_token=${OAUTH_TOKEN}")
|
||||
|
||||
SYNCER_REV=$(echo "${GET_SYNCER_REV}"| \
|
||||
grep tag_name | \
|
||||
head -n 1 | \
|
||||
${SED} -e "s;.*: ;;" -e 's;";;g' -e 's;,;;'
|
||||
)
|
||||
if test -z "${SYNCER_REV}"; then
|
||||
echo "failed to determine the revision of arangosync with github!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "${SYNCER_REV}" > SYNCER_REV
|
||||
|
||||
|
||||
GITSHA=$(git log -n1 --pretty='%h')
|
||||
if git describe --exact-match --tags "${GITSHA}"; then
|
||||
GITARGS=$(git describe --exact-match --tags "${GITSHA}")
|
||||
echo "I'm on tag: ${GITARGS}"
|
||||
else
|
||||
GITARGS=`git branch --no-color| grep '^\*' | sed "s;\* *;;"`
|
||||
if echo $GITARGS |grep -q ' '; then
|
||||
GITARGS=$(git branch --no-color| grep '^\*' | sed "s;\* *;;")
|
||||
if echo "$GITARGS" |grep -q ' '; then
|
||||
GITARGS=devel
|
||||
fi
|
||||
echo "I'm on Branch: ${GITARGS}"
|
||||
|
@ -163,11 +209,12 @@ fi
|
|||
|
||||
|
||||
|
||||
VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
|
||||
VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
|
||||
VERSION_REVISION=`echo $VERSION | awk -F. '{print $3}'`
|
||||
VERSION_MAJOR=$(echo "$VERSION" | awk -F. '{print $1}')
|
||||
VERSION_MINOR=$(echo "$VERSION" | awk -F. '{print $2}')
|
||||
VERSION_REVISION=$(echo "$VERSION" | awk -F. '{print $3}')
|
||||
VERSION_PACKAGE="1"
|
||||
|
||||
# shellcheck disable=SC2002
|
||||
cat CMakeLists.txt \
|
||||
| sed -e "s~set(ARANGODB_VERSION_MAJOR.*~set(ARANGODB_VERSION_MAJOR \"$VERSION_MAJOR\")~" \
|
||||
| sed -e "s~set(ARANGODB_VERSION_MINOR.*~set(ARANGODB_VERSION_MINOR \"$VERSION_MINOR\")~" \
|
||||
|
@ -179,7 +226,7 @@ mv CMakeLists.txt.tmp CMakeLists.txt
|
|||
|
||||
CMAKE_CONFIGURE="-DUSE_MAINTAINER_MODE=ON"
|
||||
|
||||
if [ `uname` == "Darwin" ]; then
|
||||
if [ "${isMac}" == 1 ]; then
|
||||
CMAKE_CONFIGURE="${CMAKE_CONFIGURE} -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11"
|
||||
fi
|
||||
|
||||
|
@ -188,18 +235,21 @@ if [ "$BUILD" != "0" ]; then
|
|||
rm -rf build && mkdir build
|
||||
(
|
||||
cd build
|
||||
# shellcheck disable=SC2086
|
||||
cmake .. ${CMAKE_CONFIGURE}
|
||||
make clean_autogenerated_files
|
||||
# shellcheck disable=SC2086
|
||||
cmake .. ${CMAKE_CONFIGURE}
|
||||
make -j ${PARALLEL}
|
||||
make -j "${PARALLEL}"
|
||||
)
|
||||
|
||||
echo "COMPILING ENTERPRISE"
|
||||
rm -rf build-enterprise && mkdir build-enterprise
|
||||
(
|
||||
cd build-enterprise
|
||||
# shellcheck disable=SC2086
|
||||
cmake .. ${CMAKE_CONFIGURE} -DUSE_ENTERPRISE=ON
|
||||
make -j ${PARALLEL}
|
||||
make -j "${PARALLEL}"
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -208,26 +258,6 @@ if [ "$LINT" == "1" ]; then
|
|||
./utils/jslint.sh
|
||||
fi
|
||||
|
||||
OAUTH_REPLY=$(
|
||||
curl -s "https://$DOWNLOAD_SYNCER_USER@api.github.com/authorizations" \
|
||||
--data '{"scopes":["repo", "repo_deployment"],"note":"Release"}'
|
||||
)
|
||||
OAUTH_TOKEN=$(echo "$OAUTH_REPLY" | \
|
||||
grep '"token"' |\
|
||||
sed -e 's;.*": *";;' -e 's;".*;;'
|
||||
)
|
||||
OAUTH_ID=$(echo "$OAUTH_REPLY" | \
|
||||
grep '"id"' |\
|
||||
sed -e 's;.*": *;;' -e 's;,;;'
|
||||
)
|
||||
curl -s "https://api.github.com/repos/arangodb/arangosync/releases?access_token=${OAUTH_TOKEN}" | \
|
||||
grep tag_name | \
|
||||
head -n 1 | \
|
||||
${SED} -e "s;.*: ;;" -e 's;";;g' -e 's;,;;' > SYNCER_REV
|
||||
|
||||
curl -s -X DELETE "https://$DOWNLOAD_SYNCER_USER@api.github.com/authorizations/${OAUTH_ID}"
|
||||
|
||||
|
||||
# we utilize https://developer.github.com/v3/repos/ to get the newest release of the arangodb starter:
|
||||
curl -s https://api.github.com/repos/arangodb-helper/arangodb/releases | \
|
||||
grep tag_name | \
|
||||
|
@ -295,7 +325,7 @@ if [ "$TAG" == "1" ]; then
|
|||
git push --tags -f
|
||||
fi
|
||||
|
||||
cd ${ENTERPRISE_SRC_DIR}
|
||||
cd "${ENTERPRISE_SRC_DIR}"
|
||||
git commit --allow-empty -m "release version $VERSION enterprise" -a
|
||||
git push
|
||||
|
||||
|
|
Loading…
Reference in New Issue