Skip to content

Commit

Permalink
test pr
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <[email protected]>
  • Loading branch information
vincepri committed Apr 17, 2024
1 parent ad78a04 commit 057185b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/tools-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

permissions:
contents: write
pull-requests: write

jobs:
build-and-push:
Expand Down Expand Up @@ -53,6 +54,16 @@ jobs:
name: envtest-${{ env.KUBERNETES_VERSION }}
draft: true
make_latest: false
files: out/envtest-*.tar.gz
files: |
out/envtest-*.tar.gz
out/envtest-*.tar.gz.sha512
fail_on_unmatched_files: true
body_path: out/release-notes.md
- name: Create Pull Request
uses: peter-evans/create-pull-request@9153d834b60caba6d51c9b9510b087acf9f33f83 # tag=v6.0.4
with:
commit-message: Promote envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}
title: ":seedling: Promotion of envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}"
branch: promote-envtest-${{ env.KUBERNETES_VERSION }}
add-paths: |
envtest-releases.yaml
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export GOPROXY
export GO111MODULE=on

# Tools.
ENVTEST_DIR := hack/envtest
ENVTEST_MATRIX_DIR := $(ENVTEST_DIR)/_matrix
TOOLS_DIR := hack/tools
TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin)
GOLANGCI_LINT := $(abspath $(TOOLS_BIN_DIR)/golangci-lint)
Expand Down Expand Up @@ -120,17 +122,14 @@ release-envtest: clean-release ## Build the envtest binaries by operating system

.PHONY: release-envtest-docker-build
release-envtest-docker-build: $(RELEASE_DIR) ## Build the envtest binaries.
@: $(if $(GO_VERSION),,$(error GO_VERSION is not set))
@: $(if $(KUBERNETES_VERSION),,$(error KUBERNETES_VERSION is not set))
@: $(if $(ETCD_VERSION),,$(error ETCD_VERSION is not set))
@: $(if $(OS),,$(error OS is not set))
@: $(if $(ARCH),,$(error ARCH is not set))

docker buildx build \
--file ./hack/envtest/$(OS)/Dockerfile \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg KUBERNETES_VERSION=$(KUBERNETES_VERSION) \
--build-arg ETCD_VERSION=$(ETCD_VERSION) \
--build-arg GO_VERSION=$(shell yq eval '.go' $(ENVTEST_MATRIX_DIR)/$(KUBERNETES_VERSION).yaml) \
--build-arg ETCD_VERSION=$(shell yq eval '.etcd' $(ENVTEST_MATRIX_DIR)/$(KUBERNETES_VERSION).yaml) \
--build-arg OS=$(OS) \
--build-arg ARCH=$(ARCH) \
--tag sigs.k8s.io/controller-tools/envtest:$(KUBERNETES_VERSION)-$(OS)-$(ARCH) \
Expand Down
1 change: 1 addition & 0 deletions envtest-releases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
releases:
1 change: 1 addition & 0 deletions hack/envtest/_matrix/v1.28.0.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
go: 1.21
etcd: v3.5.9

20 changes: 13 additions & 7 deletions hack/envtest/release-notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,31 @@ if [ -z "${KUBERNETES_VERSION}" ]; then
exit 1
fi

# For each file in out/*.tar.gz, build a out/release-notes.md files containing a table
# with every file and their respective hash
# Create the releases.yaml file in hack/envtest if it does not exist
if [ ! -f "${ROOT}"/envtest-releases.yaml ]; then
echo "releases:" > "${ROOT}"/envtest-releases.yaml
fi

# Create the release notes file
echo -e "# Envtest Kubernetes ${KUBERNETES_VERSION} Binaries\n" > out/release-notes.md

# Add the newly built Kubernetes version to the releases.yaml file with yq as an object key under releases
yq eval ".releases += {\"${KUBERNETES_VERSION}\": {}}" -i "${ROOT}"/envtest-releases.yaml

# Create the table header
echo "filename | sha512 hash" >> out/release-notes.md
echo "-------- | -----------" >> out/release-notes.md

for file in "${ROOT}"/out/*.tar.gz; do
# Get the file name
file_name=$(basename "${file}")

# Get the hash of the file
file_hash=$(awk '{ print $1 }' < "${file}.sha512")
self_link=https://github.com/kubernetes-sigs/controller-tools/releases/download/envtest-${KUBERNETES_VERSION}/${file_name}

# Add the file and hash to the release notes
echo "| [${file_name}](https://github.com/kubernetes-sigs/controller-tools/releases/download/envtest-${KUBERNETES_VERSION}/${file_name}) | ${file_hash} |" >> out/release-notes.md
# Add the file and hash to the release notes and yaml
echo "| [${file_name}](${self_link}) | ${file_hash} |" >> out/release-notes.md
yq eval \
".releases[\"${KUBERNETES_VERSION}\"] += {\"${file_name}\": {\"hash\": \"${file_hash}\", \"self_link\": \"${self_link}\"}}" \
-i "${ROOT}"/envtest-releases.yaml
done

# Close the table
Expand Down

0 comments on commit 057185b

Please sign in to comment.