Edge Routing Monitor #2870
This file contains hidden or 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
| name: Edge Routing Monitor | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' | |
| workflow_dispatch: | |
| jobs: | |
| probe-redirects: | |
| name: Test Apex and WWW | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| domain: ["matrixos.org", "www.matrixos.org"] | |
| steps: | |
| - name: Assert 301 Redirect to GitHub | |
| run: | | |
| TARGET="https://github.com/lxnay/matrixos" | |
| RESULT=$(curl -s -o /dev/null -w "%{http_code}|%{redirect_url}" https://${{ matrix.domain }}) | |
| STATUS=$(echo "$RESULT" | cut -d'|' -f1) | |
| LOCATION=$(echo "$RESULT" | cut -d'|' -f2) | |
| if [ "$STATUS" != "301" ]; then | |
| echo "::error::[${{ matrix.domain }}] Expected HTTP 301, got $STATUS" | |
| exit 1 | |
| fi | |
| if [[ "$LOCATION" != "$TARGET"* ]]; then | |
| echo "::error::[${{ matrix.domain }}] Expected redirect to $TARGET, got $LOCATION" | |
| exit 1 | |
| fi | |
| probe-subdomains: | |
| name: Test Infrastructure Subdomains | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| subdomain: ["images.matrixos.org", "ostree.matrixos.org"] | |
| steps: | |
| - name: Assert Subdomain is healthy | |
| run: | | |
| TARGET="https://github.com/lxnay/matrixos" | |
| RESULT=$(curl -s -o /dev/null -w "%{http_code}|%{redirect_url}" https://${{ matrix.subdomain }}) | |
| STATUS=$(echo "$RESULT" | cut -d'|' -f1) | |
| LOCATION=$(echo "$RESULT" | cut -d'|' -f2) | |
| # If it returns a 301 to our GitHub repo, the apex rule leaked | |
| if [ "$STATUS" == "301" ] && [[ "$LOCATION" == "$TARGET"* ]]; then | |
| echo "::error::CRITICAL: ${{ matrix.subdomain }} is not responding with 301 and expected Location" | |
| exit 1 | |
| fi | |
| echo "Success: ${{ matrix.subdomain }} routed correctly (Status: $STATUS)" |