github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/ops/terraform/remote_files/scripts/apply-http-allowlist.sh (about)

     1  #!/usr/bin/env bash
     2  set -euxo pipefail
     3  
     4  # Script to be used with --job-selection-probe-exec that will:
     5  # - reject jobs with --network=Full
     6  # - reject jobs with --domain=... not in our allowlist
     7  # - accept all other jobs
     8  
     9  ALLOWLIST=./http-domain-allowlist.txt
    10  
    11  TYPE=$(echo "$BACALHAU_JOB_SELECTION_PROBE_DATA" | jq -r '.spec.Network.Type')
    12  test "$TYPE" = 'HTTP' || test "$TYPE" = 'None'
    13  
    14  cd "$(dirname $0)"
    15  MISSING=$(comm -13 \
    16      <(cat "$ALLOWLIST" | grep -v '#' | sort) \
    17      <(echo "$BACALHAU_JOB_SELECTION_PROBE_DATA" | jq -r '.spec.Network.Domains[]' | sort))
    18  
    19  test -z "$MISSING"