diff --git a/.github/workflows/releaseimage.yml b/.github/workflows/releaseimage.yml index 6e9d63e3..2d17907a 100644 --- a/.github/workflows/releaseimage.yml +++ b/.github/workflows/releaseimage.yml @@ -111,4 +111,6 @@ jobs: - name: push run: | - docker manifest push quay.io/open-cluster-management/${{ matrix.repository }}:${{ needs.env.outputs.RELEASE_VERSION }} + set -e + cd ${{ matrix.repository }} + IMAGE_TAG=${{ needs.env.outputs.RELEASE_VERSION }} make image-manifest-push diff --git a/README.md b/README.md index 3da7b9c5..5abaf6e5 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ All projects must define the following `make` targets: - `image-push`: Push all container images. - `image-manifest`: Create multi-architecture manifests for all images. - `image-manifest-annotate`: Annotate multi-architecture manifests for all images. +- `image-manifest-push`: Push finalized image manifests for all images. #### Dockerfiles diff --git a/fleetconfig-controller/Makefile b/fleetconfig-controller/Makefile index e1cead16..c0307e39 100644 --- a/fleetconfig-controller/Makefile +++ b/fleetconfig-controller/Makefile @@ -21,7 +21,9 @@ IMAGE_FLAVOURS ?= \ # Generate build targets for each variant $(foreach flavour,$(IMAGE_FLAVOURS),\ $(eval VARIANT := $(word 1,$(subst :, ,$(flavour)))) \ - $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG),$(IMAGE_TAG)-$(VARIANT))) \ + $(eval ARCH_SUFFIX := $(if $(filter %-amd64,$(IMAGE_TAG)),-amd64,$(if $(filter %-arm64,$(IMAGE_TAG)),-arm64,))) \ + $(eval BASE_TAG := $(patsubst %$(ARCH_SUFFIX),%,$(IMAGE_TAG))) \ + $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG),$(BASE_TAG)-$(VARIANT)$(ARCH_SUFFIX))) \ $(eval DOCKERFILE := $(word 2,$(subst :, ,$(flavour)))) \ $(eval $(call build-image,$(IMAGE_REPO)-$(VARIANT),$(IMAGE_REGISTRY)/$(IMAGE_REPO):$(VARIANT_TAG),$(DOCKERFILE),.)) \ ) @@ -34,27 +36,41 @@ images: $(foreach flavour,$(IMAGE_FLAVOURS),image-$(IMAGE_REPO)-$(word 1,$(subst image-push: $(foreach flavour,$(IMAGE_FLAVOURS),\ $(eval VARIANT := $(word 1,$(subst :, ,$(flavour)))) \ - $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG),$(IMAGE_TAG)-$(VARIANT))) \ + $(eval ARCH_SUFFIX := $(if $(filter %-amd64,$(IMAGE_TAG)),-amd64,$(if $(filter %-arm64,$(IMAGE_TAG)),-arm64,))) \ + $(eval BASE_TAG := $(patsubst %$(ARCH_SUFFIX),%,$(IMAGE_TAG))) \ + $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG),$(BASE_TAG)-$(VARIANT)$(ARCH_SUFFIX))) \ docker push $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(VARIANT_TAG); \ ) .PHONY: image-manifest image-manifest: $(foreach flavour,$(IMAGE_FLAVOURS),\ + $(eval IMAGE_TAG_NO_ARCH := $(patsubst %-amd64,%,$(patsubst %-arm64,%,$(IMAGE_TAG)))) \ $(eval VARIANT := $(word 1,$(subst :, ,$(flavour)))) \ - $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG),$(IMAGE_TAG)-$(VARIANT))) \ + $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG_NO_ARCH),$(IMAGE_TAG_NO_ARCH)-$(VARIANT))) \ $(eval IMAGE := $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(VARIANT_TAG)) \ - docker manifest create $(IMAGE) $(IMAGE)-amd64 --amd64 $(IMAGE)-arm64 --arm64; \ + docker manifest create $(IMAGE) $(IMAGE)-amd64 $(IMAGE)-arm64; \ ) .PHONY: image-manifest-annotate image-manifest-annotate: $(foreach flavour,$(IMAGE_FLAVOURS),\ + $(eval IMAGE_TAG_NO_ARCH := $(patsubst %-amd64,%,$(patsubst %-arm64,%,$(IMAGE_TAG)))) \ $(eval VARIANT := $(word 1,$(subst :, ,$(flavour)))) \ - $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG),$(IMAGE_TAG)-$(VARIANT))) \ + $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG_NO_ARCH),$(IMAGE_TAG_NO_ARCH)-$(VARIANT))) \ $(eval IMAGE := $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(VARIANT_TAG)) \ - docker manifest annotate $(IMAGE) --arch amd64 $(IMAGE)-amd64; \ - docker manifest annotate $(IMAGE) --arch arm64 $(IMAGE)-arm64; \ + docker manifest annotate $(IMAGE) $(IMAGE)-amd64 --arch amd64; \ + docker manifest annotate $(IMAGE) $(IMAGE)-arm64 --arch arm64; \ + ) + +.PHONY: image-manifest-push +image-manifest-push: + $(foreach flavour,$(IMAGE_FLAVOURS),\ + $(eval IMAGE_TAG_NO_ARCH := $(patsubst %-amd64,%,$(patsubst %-arm64,%,$(IMAGE_TAG)))) \ + $(eval VARIANT := $(word 1,$(subst :, ,$(flavour)))) \ + $(eval VARIANT_TAG := $(if $(filter base,$(VARIANT)),$(IMAGE_TAG_NO_ARCH),$(IMAGE_TAG_NO_ARCH)-$(VARIANT))) \ + $(eval IMAGE := $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(VARIANT_TAG)) \ + docker manifest push $(IMAGE); \ ) ##@ Generation Targets diff --git a/hack/changelog.py b/hack/changelog.py index 3c396ef1..d01fb8dd 100644 --- a/hack/changelog.py +++ b/hack/changelog.py @@ -77,11 +77,15 @@ def section_if_present(changes: [], pr_title): # get related PR from the last release tag last_release_pr = 0 - for tag in tags: - if tag.name == last_release_tag: - tag_pulls = tag.commit.get_pulls() - last_release_pr = tag_pulls[0].number - break + release_word = "in" + + if tags.totalCount > 1: + release_word = "since" + for tag in tags: + if tag.name == last_release_tag: + tag_pulls = tag.commit.get_pulls() + last_release_pr = tag_pulls[0].number + break # collect all PRs from the last release tag features = [] @@ -112,8 +116,8 @@ def section_if_present(changes: [], pr_title): # Print print("# %s %s" % (repo_name, release_tag)) - print("\n**changes since [%s](https://github.com/open-cluster-management-io/releases/%s)**\n" - % (last_release_tag, last_release_tag)) + print("\n**changes %s [%s](https://github.com/open-cluster-management-io/releases/%s)**\n" + % (release_word, last_release_tag, last_release_tag)) section_if_present(breakings, ":warning: Breaking Changes") section_if_present(features, ":sparkles: New Features") section_if_present(bugs, ":bug: Bug Fixes")