calculate manifest hash-tag using git ls-tree

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher
2021-05-10 12:36:07 +03:00
parent c4d8b1a250
commit 4adc04a24d
3 changed files with 51 additions and 25 deletions

View File

@@ -17,8 +17,13 @@ IMAGE=$2
IMG_X86_64=$(head -1 versions.x86_64 | sed 's,[#| ]*,,')
IMG_ARM64=$(head -1 versions.aarch64 | sed 's,[#| ]*,,')
IMG_s390x=$(head -1 versions.s390x | sed 's,[#| ]*,,')
# Extract the TAG from the x86_64 name and build the manifest target name
TAG=$(echo "$IMG_X86_64" | sed 's,\-.*$,,' | cut -d':' -f2)
# Extract the TAG from the tree hash - just like how "linuxkit pkg show-tag" does it - name and build the manifest target name
TAG=$(git ls-tree --full-tree HEAD -- $(pwd) | awk '{print $3}')
DIRTY=$(git diff-index HEAD -- $(pwd))
if [ -n "$DIRTY"]; then
echo "will not push out manifest when git tree is dirty" >&2
exit 1
fi
TARGET="$ORG/$IMAGE:$TAG"
YAML=$(mktemp)
@@ -77,4 +82,4 @@ fi
# Push manifest list
OUT=$(manifest-tool $MT_ARGS push from-spec --ignore-missing "$YAML")
rm "$YAML"
echo "$OUT"
echo "$OUT"