diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1699e65..6222568 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,49 +1,52 @@ name: Test on: # Run CI on all pushes to the master and release/** branches, and on all new # pull requests, and on all pushes to pull requests (even if a pull request # is not against master). push: branches: - "master" - "releases/**" pull_request: env: DOCKER_COMPOSE_VERSION: 1.24.1 +defaults: + run: + shell: bash jobs: test: strategy: # Only run one job at a time as they are quite demanding max-parallel: 1 matrix: py2: ["", "1"] runs-on: ubuntu-18.04 name: "test${{ matrix.py2 == '1' && ' PY2' || ''}}" steps: - name: Pin docker-compose run: | sudo rm /usr/local/bin/docker-compose curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose chmod +x docker-compose sudo mv docker-compose /usr/local/bin - name: Checkout uses: actions/checkout@v2 - name: Install and test env: COMPOSE_PARALLEL_LIMIT: 50 COMPOSE_HTTP_TIMEOUT: 450 SENTRY_PYTHON2: ${{ matrix.py2 == '1' || '' }} run: | ./install.sh ./test.sh printf "Testing in-place upgrade" ./install.sh --minimize-downtime ./test.sh - name: Inspect failure if: failure() run: | docker-compose ps docker-compose logs diff --git a/install/geoip.sh b/install/geoip.sh index 8d7c81a..c90b56d 100755 --- a/install/geoip.sh +++ b/install/geoip.sh @@ -1,37 +1,36 @@ #!/usr/bin/env bash -if [ ! -f 'install.sh' ]; then echo 'Where are you?'; exit 1; fi +if [[ ! -f 'install.sh' ]]; then echo 'Where are you?'; exit 1; fi source ./install/docker-aliases.sh install_geoip() { local mmdb='geoip/GeoLite2-City.mmdb' local conf='geoip/GeoIP.conf' local result='Done' echo "Setting up IP address geolocation ..." if [[ ! -f "$mmdb" ]]; then echo -n "Installing (empty) IP address geolocation database ... " cp "$mmdb.empty" "$mmdb" echo "done." else echo "IP address geolocation database already exists." fi if [[ ! -f "$conf" ]]; then echo "IP address geolocation is not configured for updates." echo "See https://develop.sentry.dev/self-hosted/geolocation/ for instructions." result='Error' else echo "IP address geolocation is configured for updates." echo "Updating IP address geolocation database ... " - $dcr geoipupdate - if [ $? -gt 0 ]; then + if ! $dcr geoipupdate; then result='Error' fi echo "$result updating IP address geolocation database." fi echo "$result setting up IP address geolocation." } install_geoip diff --git a/install/py2-warning.sh b/install/py2-warning.sh index 5843c3b..2457893 100755 --- a/install/py2-warning.sh +++ b/install/py2-warning.sh @@ -1,27 +1,22 @@ #!/usr/bin/env bash -if [ ! -f 'install.sh' ]; then echo 'Where are you?'; exit 1; fi +if [[ ! -f 'install.sh' ]]; then echo 'Where are you?'; exit 1; fi source ./install/docker-aliases.sh -py2_warning() { - if [[ -n $($dcr --no-deps --entrypoint python web --version | grep 'Python 2') ]]; then - cat <<"EOW" +# Note the stderr>stdout redirection because Python thinks `--version` should +# be on stderr: https://stackoverflow.com/a/31715011/90297 +if $dcr --no-deps --entrypoint python web --version 2>&1 | grep -q 'Python 2'; then + echo " _ _ ____ ____ _ _______ ____ _____ _____ ____ _____ ______ _ _ | || | |_ _| |_ _|/ \ |_ __ \ |_ \|_ _||_ _||_ \|_ _|.' ___ | | || | | || | \ \ /\ / / / _ \ | |__) | | \ | | | | | \ | | / .' \_| | || | | || | \ \/ \/ / / ___ \ | __ / | |\ \| | | | | |\ \| | | | ____ | || | -|_||_| \ /\ /_/ / \ \_ _| | \ \_ _| |_\ |_ _| |_ _| |_\ |_\ `.___] ||_||_| -(_)(_) \/ \/|____| |____||____| |___||_____|\____||_____||_____|\____|`._____.' (_)(_) +|_||_| \ /\ /_/ / \ \_ _| | \ \_ _| |_\ |_ _| |_ _| |_\ |_\ \`.___] ||_||_| +(_)(_) \/ \/|____| |____||____| |___||_____|\____||_____||_____|\____|\`._____.' (_)(_) -EOW - echo 'You are using Sentry with Python 2, which is deprecated.' - echo 'Sentry 21.1 will be the last version with Python 2 support.' - fi -} - -py2_warning -# Run a simple command that would exit with code 0 so the calling script won't think -# there was a failure in this script. (otherwise it fails when Python 2 is *NOT* detected) -# as the exit code for the `grep` call will be `-1` indicating no match found. -echo '' +" + echo '-----------------------------------------------------------' + echo 'You are using Sentry with Python 2, which is deprecated.' + echo 'Sentry 21.1 will be the last version with Python 2 support.' +fi