A position left out together with its stop kept the account prudent for good: the stop was still asked for shares that no longer exist. The cover required now stops at what the account holds, the stops are compared again after the choice, and where one is still missing Align takes the excluded position up again. After the choice the account waits for the stop with its own reason, so it returns to normal by itself also past the 15 minutes; a new difference still gets its own 15 minutes. A right password alone no longer clears the wrong second-factor codes: it takes back only its own attempt. Capital and shares are planned and written in one transaction, so overlapping changes cannot apply twice and an interruption leaves nothing halfway; sending the same figures again completes what an old one left. The cash that purchases under way still hold is no longer given away, counted as the risk engine counts it. /health said healthy when the trading engine had failed to start. It now says so at once, or after ten minutes of a stalled start, and the host tries the start again every minute; the guard still sees a start that does not move. The image of the manual publication says its version and its commit, marked when the tree is dirty, and publish.sh refuses before any login an image that does not come from the commit of the tag. refs #75 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
3.0 KiB
Bash
60 lines
3.0 KiB
Bash
#!/bin/sh
|
|
# Publishes an image already built and tried (SPEC 15.5, ADR 0002 and 0020).
|
|
# Usage: publish.sh <local image> <tag vX.Y.Z[-something]>
|
|
# From the environment: REGISTRY, REGISTRY_USER, REGISTRY_TOKEN (write:package). The token reaches docker only on its
|
|
# input and stays in a temporary folder removed at the end.
|
|
set -eu
|
|
|
|
image="$1"
|
|
tag="$2"
|
|
root=$(cd "$(dirname "$0")/../.." && pwd)
|
|
fail() {
|
|
echo "Pubblicazione non riuscita: $1" >&2
|
|
exit 1
|
|
}
|
|
|
|
printf '%s\n' "$tag" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$' || fail "il tag '$tag' non è una versione (vX.Y.Z)."
|
|
version=${tag#v}
|
|
expected=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' "$root/Directory.Build.props")
|
|
[ "${version%%-*}" = "$expected" ] || fail "il tag $tag non corrisponde alla versione $expected di Directory.Build.props."
|
|
[ -n "${REGISTRY:-}" ] || fail "manca REGISTRY."
|
|
[ -n "${REGISTRY_USER:-}" ] || fail "manca REGISTRY_USER."
|
|
[ -n "${REGISTRY_TOKEN:-}" ] || fail "manca il segreto REGISTRY_TOKEN (token Gitea con il permesso write:package)."
|
|
name="$REGISTRY/balbosoft/anubis"
|
|
|
|
# The image says what it was made from (its labels): only what comes from the commit of the tag is published as that tag.
|
|
# Without the tag here, as in the CI, the commit checked out is the tag's.
|
|
commit=$(git -C "$root" rev-parse --verify --quiet "refs/tags/$tag^{commit}" || git -C "$root" rev-parse --verify --quiet HEAD) || fail "non riesco a leggere il commit del tag."
|
|
label() {
|
|
docker image inspect --format "{{ index .Config.Labels \"org.opencontainers.image.$1\" }}" "$image"
|
|
}
|
|
built=$(label version) || fail "non trovo l'immagine $image."
|
|
# The image built by hand for vX.Y.Z-something says X.Y.Z, the version of Directory.Build.props: the commit tells them apart.
|
|
[ "$built" = "$version" ] || [ "$built" = "$expected" ] || fail "l'immagine $image dice di essere la versione '$built', non $version: ricostruiscila."
|
|
source=$(label revision) || fail "non trovo l'immagine $image."
|
|
[ "$source" = "$commit" ] || fail "l'immagine $image viene dal commit '$source', non da $commit: ricostruiscila dal commit del tag, senza modifiche in sospeso."
|
|
|
|
# latest moves only for the highest plain version among the tags of the repository.
|
|
latest=""
|
|
case "$version" in
|
|
*-*) ;;
|
|
*)
|
|
tags=$(git -C "$root" ls-remote --tags --refs origin 'v*') || fail "non riesco a leggere i tag del repository."
|
|
newest=$(printf '%s\n' "$tags" "x refs/tags/$tag" | sed -n 's:.*refs/tags/v\([0-9]*\.[0-9]*\.[0-9]*\)$:\1:p' | sort -t. -k1,1n -k2,2n -k3,3n | tail -n 1)
|
|
if [ "$newest" = "$version" ]; then latest=1; fi
|
|
;;
|
|
esac
|
|
|
|
DOCKER_CONFIG=$(mktemp -d)
|
|
export DOCKER_CONFIG
|
|
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
|
|
printf '%s' "$REGISTRY_TOKEN" | docker login "$REGISTRY" --username "$REGISTRY_USER" --password-stdin
|
|
docker tag "$image" "$name:$version"
|
|
docker push "$name:$version"
|
|
if [ -n "$latest" ]; then
|
|
docker tag "$image" "$name:latest"
|
|
docker push "$name:latest"
|
|
fi
|
|
|
|
echo "Pubblicata $name:$version${latest:+ (e latest)}."
|