File: check-cachekey.sh

package info (click to toggle)
coq-doc 8.20.0-2
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid, trixie
  • size: 46,708 kB
  • sloc: ml: 234,429; sh: 4,686; python: 3,359; ansic: 2,644; makefile: 842; lisp: 172; javascript: 87; xml: 24; sed: 2
file content (33 lines) | stat: -rwxr-xr-x 818 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

REDBOLD="\033[31;1m"
RESET="\033[0m"

redprint()
{
  if [ "$COQ_CI_COLOR" ]; then
    printf "$REDBOLD%s$RESET\n" "$1"
  else
    printf '%s\n' "$1"
  fi
}

base_hash=$(md5sum dev/ci/docker/old_ubuntu_lts/Dockerfile | head -c 10)
base_key=$(grep BASE_CACHEKEY: .gitlab-ci.yml)
base_keyhash=${base_key%\"}
base_keyhash=${base_keyhash##*-}

if ! [ "$base_hash" = "$base_keyhash" ]; then
    >&2 redprint "Bad BASE_CACHEKEY: expected '$base_hash' but got '$base_keyhash'"
    exit 1
fi

edge_hash=$(md5sum dev/ci/docker/edge_ubuntu/Dockerfile | head -c 10)
edge_key=$(grep EDGE_CACHEKEY: .gitlab-ci.yml)
edge_keyhash=${edge_key%\"}
edge_keyhash=${edge_keyhash##*-}

if ! [ "$edge_hash" = "$edge_keyhash" ]; then
    >&2 redprint "Bad EDGE_CACHEKEY: expected '$edge_hash' but got '$edge_keyhash'"
    exit 1
fi