From 5f8360cba8c97631b27c964d9aec687d3ea3c191 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz <me@kennethreitz.org> Date: Tue, 13 Mar 2018 20:56:40 -0400 Subject: [PATCH] Metrics (#657) * metrics Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * using pipenv anyway Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * instrument bad failures Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * if not Signed-off-by: Kenneth Reitz <me@kennethreitz.org> --- bin/steps/collectstatic | 2 ++ bin/steps/pip-install | 15 ++++++++++++--- bin/steps/pip-uninstall | 5 ++++- bin/steps/pipenv | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/steps/collectstatic b/bin/steps/collectstatic index 989490be..fbd9b880 100755 --- a/bin/steps/collectstatic +++ b/bin/steps/collectstatic @@ -39,6 +39,8 @@ if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ] && [ "$DJANGO_INSTALL # Display a warning if collectstatic failed. [ "$COLLECTSTATIC_STATUS" -ne 0 ] && { + mcount "failure.collectstatic" + echo echo " ! Error while running '$ python $MANAGE_FILE collectstatic --noinput'." echo " See traceback above for details." diff --git a/bin/steps/pip-install b/bin/steps/pip-install index 4cae628b..9818928a 100755 --- a/bin/steps/pip-install +++ b/bin/steps/pip-install @@ -15,10 +15,19 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then fi set +e - + # Measure that we're using pip. mcount "tool.pip" + # Count expected build failures. + if grep -q 'wsgiref' requirements.txt; then + mcount "failure.wsgiref" + fi + if grep -q '==0.0.0' requirements.txt; then + mcount "failure.none-version" + fi + + /app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent PIP_STATUS="${PIPESTATUS[0]}" set -e @@ -35,8 +44,8 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then /app/.heroku/python/bin/pip freeze --disable-pip-version-check > .heroku/python/requirements-installed.txt echo - - # Install test dependencies, for CI. + + # Install test dependencies, for CI. if [ "$INSTALL_TEST" ]; then if [[ -f "$1/requirements-test.txt" ]]; then puts-step "Installing test dependencies…" diff --git a/bin/steps/pip-uninstall b/bin/steps/pip-uninstall index 9ec05394..58fdbf05 100755 --- a/bin/steps/pip-uninstall +++ b/bin/steps/pip-uninstall @@ -11,7 +11,10 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then cp .heroku/python/requirements-declared.txt requirements-declared.txt - pip-diff --stale requirements-declared.txt requirements.txt --exclude setuptools pip wheel > .heroku/python/requirements-stale.txt + + if ! pip-diff --stale requirements-declared.txt requirements.txt --exclude setuptools pip wheel > .heroku/python/requirements-stale.txt; then + mount "failure.bad-requirements" + fi rm -fr requirements-declared.txt diff --git a/bin/steps/pipenv b/bin/steps/pipenv index 5323add3..7f9e3e55 100755 --- a/bin/steps/pipenv +++ b/bin/steps/pipenv @@ -14,6 +14,7 @@ if [[ -f Pipfile.lock ]]; then # echo "To disable this functionality, run the following command:" # echo "" # echo " $ heroku config:set PIPENV_ALWAYS_INSTALL=1" | indent + mcount "tool.pipenv" export SKIP_PIPENV_INSTALL=1 export SKIP_PIP_INSTALL=1 fi -- GitLab