| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | prefix="${1:-}" |
| 5 | run_id="${2:-}" |
| 6 | sealed_attempt="${3:-}" |
| 7 | |
| 8 | if ! [[ "$run_id" =~ ^[1-9][0-9]*$ && "$sealed_attempt" =~ ^[1-9][0-9]*$ ]]; then |
| 9 | echo "invalid candidate producer identity" >&2 |
| 10 | exit 1 |
| 11 | fi |
| 12 | if ! [[ "$prefix" =~ ^desktop-${run_id}-([1-9][0-9]*)-preflight$ ]]; then |
| 13 | echo "Desktop artifact prefix belongs to another producer" >&2 |
| 14 | exit 1 |
| 15 | fi |
| 16 | if ! test "${BASH_REMATCH[1]}" -le "$sealed_attempt"; then |
| 17 | echo "Desktop artifacts were built after the sealing attempt" >&2 |
| 18 | exit 1 |
| 19 | fi |
| 20 |