Skip to content

Commit fcc1112

Browse files
author
Ian Campbell
committed
Update alpine base image in update-linuxkit-hashes.sh
The hash is pulled from the versions.x86_64 (which is used for the multi-arch manifest too). Since we are updating local packages we then run update_hashes after committing. It needs to be after commiting else we would get a `-dirty` suffix on the previous hash instead of the new hash. Signed-off-by: Ian Campbell <ijc@docker.com>
1 parent de63328 commit fcc1112

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

scripts/update-linuxkit-hashes.sh

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,28 @@ git clone $lkurl $tdir/lk
1010

1111
lkrev=$(git -C $tdir/lk show --oneline -s HEAD)
1212

13+
update_hash() {
14+
local tag=$1; shift
15+
echo "Updating to $tag"
16+
17+
image=${tag%:*}
18+
sed -i -e "s,$image:[[:xdigit:]]\{40\}\(-dirty\)\?,$tag,g" $@
19+
}
20+
21+
# First update alpine build bases
22+
23+
# Alpine base image does not use linuxkit pkg, grab the tag from versions.x86_64 instead.
24+
if [ ! -f "$tdir/lk/tools/alpine/versions.x86_64" ] ; then
25+
echo "tools/alpine lacks versions.x86_64 file" >&2
26+
exit 1
27+
fi
28+
tag=$(sed -n -e '1s,^\# \(linuxkit/alpine:[[:xdigit:]]\{40\}\)-amd64$,\1,p' $tdir/lk/tools/alpine/versions.x86_64)
29+
if [ ! -n "$tag" ] ; then
30+
echo "Failed to extract tools/alpine tag" >&2
31+
exit 1
32+
fi
33+
update_hash $tag pkg/*/Dockerfile
34+
1335
for i in $tdir/lk/pkg/* ; do
1436
if [ ! -d "$i" ] ; then
1537
continue
@@ -21,10 +43,7 @@ for i in $tdir/lk/pkg/* ; do
2143
fi
2244

2345
tag=$(linuxkit pkg show-tag "$i")
24-
echo "Updating to $tag"
25-
26-
image=${tag%:*}
27-
sed -i -e "s,$image:[[:xdigit:]]\{40\}\(-dirty\)\?,$tag,g" yml/*.yml
46+
update_hash "$tag" yml/*.yml
2847
done
2948

3049
# Kernel doesn't use `linuxkit pkg` and uses a different
@@ -57,4 +76,10 @@ Commit: $lkrev
5776
Signed-off-by: $uname <$email>
5877
EOF
5978

60-
git commit --only -F $tdir/commit-msg yml/*.yml
79+
git commit --only -F $tdir/commit-msg yml/*.yml pkg/*/Dockerfile
80+
81+
# Now update for the result of changes to pkg/*/Dockerfile, this is
82+
# defered until now so we get the new hash instead of the old hash
83+
# with a -dirty suffix.
84+
make update-hashes
85+
git commit --amend --only --no-edit yml/*.yml

0 commit comments

Comments
 (0)