Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Refactor envtest release process to update envtest index locally #1113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/tools-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,3 @@ jobs:
out/envtest-*.tar.gz
out/envtest-*.tar.gz.sha512
fail_on_unmatched_files: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # tag=v7.0.5
with:
commit-message: Promote envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}
title: ":seedling: Promotion of envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}"
body: |
This PR promotes the envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}.
branch: promote-envtest-${{ env.KUBERNETES_VERSION }}
add-paths: |
envtest-releases.yaml
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ release-envtest: clean-release ## Build the envtest binaries by operating system
OS=darwin ARCH=amd64 $(MAKE) release-envtest-docker-build
OS=darwin ARCH=arm64 $(MAKE) release-envtest-docker-build
OS=windows ARCH=amd64 $(MAKE) release-envtest-docker-build
./hack/envtest/update-releases.sh

.PHONY: release-envtest-docker-build
release-envtest-docker-build: $(RELEASE_DIR) ## Build the envtest binaries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ fi
# 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

for file in "${ROOT}"/out/*.tar.gz; do
file_name=$(basename "${file}")
file_hash=$(awk '{ print $1 }' < "${file}.sha512")
self_link=https://github.com/kubernetes-sigs/controller-tools/releases/download/envtest-${KUBERNETES_VERSION}/${file_name}
sha_files=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/kubernetes-sigs/controller-tools/releases/tags/envtest-${KUBERNETES_VERSION} |
jq '.assets[] | select(.name | contains("sha512")) | .name' -r)

for sha_file in ${sha_files}; do
file_name=${sha_file%".sha512"}
file_hash=$(curl -L https://github.com/kubernetes-sigs/controller-tools/releases/download/envtest-${KUBERNETES_VERSION}/${sha_file} | awk '{ print $1 }')
self_link=https://github.com/kubernetes-sigs/controller-tools/releases/download/envtest-${KUBERNETES_VERSION}/${file_name}
yq eval \
".releases[\"${KUBERNETES_VERSION}\"] += {\"${file_name}\": {\"hash\": \"${file_hash}\", \"selfLink\": \"${self_link}\"}}" \
-i "${ROOT}"/envtest-releases.yaml
Expand Down
Loading