Complete durable agent analysis job flow
This commit is contained in:
1 parent
e6afed76b1
commit
6bbf592c27
17 files changed
+551
-44
No files matched your search
+21
-4
@@ -5,8 +5,25 @@ set -euo pipefail
|
||||
: "${RELEASE_TOKEN:?Dedicated Gitea release token is required}"
|
||||
: "${RELEASE_SIGNING_KEY_B64:?Publisher ECDSA P-256 private key is required}"
|
||||
: "${BUILD_SERVER_URL:?Gitea URL is required}"
|
||||
: "${EXPECTED_BUILD_SERVER_URL:?Expected Gitea URL is required}"
|
||||
: "${BUILD_REPOSITORY:?Repository is required}"
|
||||
[[ "$BUILD_SERVER_URL" == https://sources.tordais.cc ]] || { echo 'Unexpected publication host' >&2; exit 1; }
|
||||
registry_host=$(python3 - "$BUILD_SERVER_URL" "$EXPECTED_BUILD_SERVER_URL" <<'PY'
|
||||
import sys
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
actual, expected = (urlsplit(value) for value in sys.argv[1:])
|
||||
def valid_origin(value):
|
||||
return (value.scheme == 'https' and bool(value.hostname) and
|
||||
value.path in ('', '/') and not value.query and not value.fragment and
|
||||
value.username is None and value.password is None)
|
||||
|
||||
if (not valid_origin(actual) or not valid_origin(expected) or
|
||||
actual.hostname.lower() != expected.hostname.lower() or
|
||||
(actual.port or 443) != (expected.port or 443)):
|
||||
raise SystemExit('Unexpected publication host')
|
||||
print(actual.netloc)
|
||||
PY
|
||||
)
|
||||
[[ "$BUILD_REPOSITORY" == arnaud.dartois/Heimdall ]] || { echo 'Unexpected publication repository' >&2; exit 1; }
|
||||
sha=$(git rev-parse HEAD)
|
||||
umask 077
|
||||
@@ -33,14 +50,14 @@ bash scripts/ci/images.sh
|
||||
export DOCKER_CONFIG
|
||||
DOCKER_CONFIG=$(mktemp -d)
|
||||
trap 'rm -rf "$DOCKER_CONFIG"; rm -f "$signing_key"' EXIT
|
||||
printf '%s' "$REGISTRY_TOKEN" | docker login sources.tordais.cc -u "$REGISTRY_USER" --password-stdin
|
||||
printf '%s' "$REGISTRY_TOKEN" | docker login "$registry_host" -u "$REGISTRY_USER" --password-stdin
|
||||
agent_image=$(python3 -c 'import json; print(json.load(open("docker/agent-image.json"))["image"])')
|
||||
[[ "$agent_image" =~ ^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$ && "${agent_image##*/}" != *:* ]] || { echo 'Invalid agent image repository in docker/agent-image.json' >&2; exit 1; }
|
||||
agent_registry=${agent_image%%/*}
|
||||
if [[ "$agent_registry" == "$agent_image" || ( "$agent_registry" != *.* && "$agent_registry" != *:* && "$agent_registry" != localhost* ) ]]; then
|
||||
agent_registry=docker.io
|
||||
fi
|
||||
if [[ "$agent_registry" != sources.tordais.cc ]]; then
|
||||
if [[ "$agent_registry" != "$registry_host" ]]; then
|
||||
: "${AGENT_REGISTRY_USER:?Agent registry user is required for $agent_registry}"
|
||||
: "${AGENT_REGISTRY_TOKEN:?Agent registry token is required for $agent_registry}"
|
||||
printf '%s' "$AGENT_REGISTRY_TOKEN" | docker login "$agent_registry" -u "$AGENT_REGISTRY_USER" --password-stdin
|
||||
@@ -50,7 +67,7 @@ for component in server agent; do
|
||||
if [[ "$component" == agent ]]; then
|
||||
image=$agent_image
|
||||
else
|
||||
image="sources.tordais.cc/arnaud.dartois/heimdall-server"
|
||||
image="$registry_host/arnaud.dartois/heimdall-server"
|
||||
fi
|
||||
for image_tag in "sha-$sha" "${tag#v}"; do
|
||||
if docker manifest inspect "$image:$image_tag" >/dev/null 2>&1; then
|
||||
|
||||
Reference in new issue
Block a user