Commit 7dfdb830 authored by xuwang's avatar xuwang
Browse files

update-downstream-tag.sh: accept env TAG_FILE (2-arg) form



The script required 3 positional args (<repo> <tag_file> <tag>), but ps-cloud
release repos migrated to OTICA call it as <repo> <tag> with TAG_FILE exported
in the environment (their release-* targets). That mismatch made every migrated
release job fail ($# -lt 3 -> usage -> exit 1), e.g. irt-as/apps/pep/pep-api.

Disambiguate by remaining arg count: >=2 -> positional <tag_file> <tag>
(canonical, unchanged; used by makefiles/docker.mk); ==1 -> <tag> with TAG_FILE
from the environment. Backward-compatible with both conventions.

Co-Authored-By: default avatarClaude Opus 4.8 <noreply@anthropic.com>
parent 15c9bac5
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -10,10 +10,11 @@
function usage() {
    echo "Update <downstream_repo>/<tag_file> with <tag> and optional <commit-message>"
    echo "Usage: $(basename $0) <downstream_repo> <tag_file> <tag> [<commit-msg>]"
    echo "   or: $(basename $0) <downstream_repo> <tag> [<commit-msg>]  (TAG_FILE from the environment)"
    echo "<downstream_repo> format: git@<host>:/path/to/repo"
}

if [ "$#" -lt 3 ]; then
if [ "$#" -lt 2 ]; then
    usage
    exit 1
fi
@@ -28,8 +29,18 @@ TAG_VAR=${TAG_VAR:-TAG}

DOWNSTREAM_REPO=$1
shift
# Two accepted forms, disambiguated by the remaining argument count:
#   * positional (canonical, e.g. makefiles/docker.mk):
#       <downstream_repo> <tag_file> <tag> [<commit-msg>]
#   * environment (ps-cloud-compatible): <downstream_repo> <tag> [<commit-msg>]
#       with TAG_FILE supplied via the environment. Legacy release repos set
#       `export TAG_FILE=...` and pass only <tag>; kept so they work unchanged.
if [ "$#" -ge 2 ]; then
    TAG_FILE=${1:-$DEFAULT_TAG_FILE}
    shift
else
    TAG_FILE=${TAG_FILE:-$DEFAULT_TAG_FILE}
fi
TAG=${1:-$DEFAULT_TAG}
shift
# Note: keep the upstream author out of the tracked TAG_FILE header (it becomes