diff --git a/docs/releasing.md b/docs/releasing.md index bc96fe1a1..e24f168ae 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -62,44 +62,54 @@ master. This step is not necessarily required if the alpine base image has recently been updated, but it is good to pick up any recent bug -fixes. Updating the alpine base image is different to other packages -and it must be performed on `x86_64` first: +fixes. Updating the alpine base image is different to other packages. +You must perform the arch-specific image builds, pushes and updates on each +architecture first - these can be done in parallel, if you choose. When done, +you then copy the updated `versions.` to one place, commit them, and +push the manifest. -```sh -cd $LK_ROOT/tools/alpine -make push -``` +Details: -This will update `linuxkit/alpine` and change the `versions.x86_64` -file. Check it in and push to GitHub: +#### Build and Push Per-Architecture -```sh -git commit -a -s -m "tools/alpine: Update to latest" -git push $LK_REMOTE rel_$LK_RELEASE -``` - -Now, on each build machine for the other supported architectures, in turn: +On each supported platform, build and update `linuxkit/alpine`, which will update the `versions.` +file.: ```sh git fetch git checkout rel_$LK_RELEASE cd $LK_ROOT/tools/alpine make push -git commit -a --amend -git push --force $LK_REMOTE rel_$LK_RELEASE ``` -With all supported architectures updated, head back to the `x86_64` -machine and update the release branch: +Repeat on each platform. + +#### Commit Changed Versions Files + +When all of the platforms are done, copy the changed `versions.` from each platform to one please, commit and push. +In the below, replace `linuxkit-arch` with each build machine's name: ```sh -git fetch && git reset --hard $LK_REMOTE/rel_$LK_RELEASE +# one of these will not be necessary, as you will likely be executing it on one of these machines +scp linuxkit-s390x:$LK_ROOT/tools/alpine/versions.s390x $LK_ROOT/tools/alpine/versions.s390x +scp linuxkit-aarch64:$LK_ROOT/tools/alpine/versions.aarch64 $LK_ROOT/tools/alpine/versions.aarch64 +scp linuxkit-x86_64:$LK_ROOT/tools/alpine/versions.x86_64 $LK_ROOT/tools/alpine/versions.x86_64 +git commit -a -s -m "tools/alpine: Update to latest" +git push $LK_REMOTE rel_$LK_RELEASE +``` + +#### Update and Push Multi-Arch Index + +Push out the multi-arch index: + +```sh +make push-manifest ``` Stash the tag of the alpine base image in an environment variable: ```sh -LK_ALPINE=$(head -1 alpine/versions.x86_64 | sed 's,[#| ]*,,' | sed 's,\-.*$,,' | cut -d':' -f2) +LK_ALPINE=$(make show-tag) ``` diff --git a/tools/alpine/Makefile b/tools/alpine/Makefile index d3416d3cf..df9fb650b 100644 --- a/tools/alpine/Makefile +++ b/tools/alpine/Makefile @@ -15,10 +15,19 @@ ifeq ($(ARCH), s390x) DEPS += packages.s390x endif +ORG?=linuxkit +IMAGE?=alpine +TAG?=$(shell git ls-tree --full-tree HEAD -- $(PWD) | awk '{print $$3}') +DIRTY?=$(shell git diff-index HEAD -- $(PWD)) +ifneq ($(DIRTY),) +TAG := $(TAG)-dirty +endif + + default: push show-tag: - @sed -n -e '1s/# \(.*\/.*:[0-9a-f]\{40\}\)/\1/p;q' versions.$(ARCH) + @echo "$(ORG)/$(IMAGE):$(TAG)" iid: Dockerfile Makefile $(DEPS) docker build --no-cache --iidfile iid . @@ -34,9 +43,11 @@ push: hash iid versions.$(ARCH) docker pull $(ORG)/$(IMAGE):$(shell cat hash) || \ (docker tag $(shell cat iid) $(ORG)/$(IMAGE):$(shell cat hash) && \ docker push $(ORG)/$(IMAGE):$(shell cat hash)) - ./push-manifest.sh $(ORG) $(IMAGE) rm -f iid +push-manifest: + ./push-manifest.sh $(ORG) $(IMAGE) + build: hash iid versions.$(ARCH) docker pull $(ORG)/$(IMAGE):$(shell cat hash) || \ docker tag $(shell cat iid) $(ORG)/$(IMAGE):$(shell cat hash) diff --git a/tools/alpine/push-manifest.sh b/tools/alpine/push-manifest.sh index 8a5e81bbc..a457cef92 100755 --- a/tools/alpine/push-manifest.sh +++ b/tools/alpine/push-manifest.sh @@ -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" \ No newline at end of file +echo "$OUT"