Skip to content

Commit a40a0a7

Browse files
[main] Upgrade to latest dependencies (#8413)
upgrade to latest dependencies bumping knative.dev/hack/schema f8be0cc...c142b48: > c142b48 Refactor release script to gh CLI (# 408) bumping knative.dev/hack f8be0cc...c142b48: > c142b48 Refactor release script to gh CLI (# 408) Signed-off-by: Knative Automation <[email protected]>
1 parent 90edfe6 commit a40a0a7

File tree

4 files changed

+30
-32
lines changed

4 files changed

+30
-32
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ require (
4343
k8s.io/apiserver v0.31.4
4444
k8s.io/client-go v0.31.4
4545
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
46-
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36
47-
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36
46+
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5
47+
knative.dev/hack/schema v0.0.0-20250116150306-c142b4835bc5
4848
knative.dev/pkg v0.0.0-20250113161000-0c2a238a16ed
4949
knative.dev/reconciler-test v0.0.0-20250109131538-359287e93238
5050
sigs.k8s.io/yaml v1.4.0

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,10 @@ k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 h1:1Wof1cGQgA5pqgo8MxKPtf
851851
k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8/go.mod h1:Os6V6dZwLNii3vxFpxcNaTmH8LJJBkOTg1N0tOA0fvA=
852852
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
853853
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
854-
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36 h1:iZ6CwYLo+y82MXlK7PoG/cnFEB0tRdw8elBXj6c6ezE=
855-
knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
856-
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36 h1:j7/31r2d68tu3zVVxSSrEbuLqjGrgWzfzwY5+wXyISw=
857-
knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36/go.mod h1:jRH/sx6mwwuMVhvJgnzSaoYA1N4qaIkJa+zxEGtVA5I=
854+
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5 h1:CwLVoSblWmfaIkgRFX2LcEA0uYZo+nOhdPatsz+QL9w=
855+
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
856+
knative.dev/hack/schema v0.0.0-20250116150306-c142b4835bc5 h1:KsX1VKxKe3ViMc+4OsEHJE+Eih1EQOLl1fk7+hSCfqk=
857+
knative.dev/hack/schema v0.0.0-20250116150306-c142b4835bc5/go.mod h1:jRH/sx6mwwuMVhvJgnzSaoYA1N4qaIkJa+zxEGtVA5I=
858858
knative.dev/pkg v0.0.0-20250113161000-0c2a238a16ed h1:PUMNZc1CBUg5G4JYio3wjpCJuCJG2ZeCuLvlBTpDiZI=
859859
knative.dev/pkg v0.0.0-20250113161000-0c2a238a16ed/go.mod h1:p7c7yCCf1YVX04FQ8YDyJaHciknu726qVWOXRX5tIBM=
860860
knative.dev/reconciler-test v0.0.0-20250109131538-359287e93238 h1:qGRLFIcJ9quJb9MglIyMk3SUMCey7esVl2idt1G7cNk=

vendor/knative.dev/hack/release.sh

+22-24
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@ export GOFLAGS="-ldflags=-s -ldflags=-w"
9090
export GITHUB_TOKEN=""
9191
readonly IMAGES_REFS_FILE="${IMAGES_REFS_FILE:-$(mktemp -d)/images_refs.txt}"
9292

93-
# Convenience function to run the hub tool.
94-
# Parameters: $1..$n - arguments to hub.
95-
function hub_tool() {
96-
# Pinned to SHA because of https://github.com/github/hub/issues/2517
97-
go_run github.com/github/hub/v2@363513a "$@"
93+
# Convenience function to run the GitHub CLI tool `gh`.
94+
# Parameters: $1..$n - arguments to gh.
95+
function gh_tool() {
96+
go_run github.com/cli/cli/v2/cmd/[email protected] "$@"
9897
}
9998

10099
# Shortcut to "git push" that handles authentication.
@@ -193,7 +192,7 @@ function prepare_dot_release() {
193192
# Support tags in two formats
194193
# - knative-v1.0.0
195194
# - v1.0.0
196-
releases="$(hub_tool release | cut -d '-' -f2)"
195+
releases="$(gh_tool release list --json tagName --jq '.[].tagName' | cut -d '-' -f2)"
197196
echo "Current releases are: ${releases}"
198197
[[ $? -eq 0 ]] || abort "cannot list releases"
199198
# If --release-branch passed, restrict to that release
@@ -218,7 +217,7 @@ function prepare_dot_release() {
218217
# Ensure there are new commits in the branch, otherwise we don't create a new release
219218
setup_branch
220219
# Use the original tag (ie. potentially with a knative- prefix) when determining the last version commit sha
221-
local github_tag="$(hub_tool release | grep "${last_version}")"
220+
local github_tag="$(gh_tool release list --json tagName --jq '.[].tagName' | grep "${last_version}")"
222221
local last_release_commit="$(git rev-list -n 1 "${github_tag}")"
223222
local last_release_commit_filtered="$(git rev-list --invert-grep --grep "\[skip-dot-release\]" -n 1 "${github_tag}")"
224223
local release_branch_commit="$(git rev-list -n 1 upstream/"${RELEASE_BRANCH}")"
@@ -239,7 +238,7 @@ function prepare_dot_release() {
239238
# If --release-notes not used, copy from the latest release
240239
if [[ -z "${RELEASE_NOTES}" ]]; then
241240
RELEASE_NOTES="$(mktemp)"
242-
hub_tool release show -f "%b" "${github_tag}" > "${RELEASE_NOTES}"
241+
gh_tool release view "${github_tag}" --json "body" --jq '.body' > "${RELEASE_NOTES}"
243242
echo "Release notes from ${last_version} copied to ${RELEASE_NOTES}"
244243
fi
245244
}
@@ -640,18 +639,12 @@ function set_latest_to_highest_semver() {
640639

641640
local last_version release_id # don't combine with assignment else $? will be 0
642641

643-
last_version="$(hub_tool -p release | cut -d'-' -f2 | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$'| sort -r -V | head -1)"
642+
last_version="$(gh_tool release list --json tagName --jq '.[].tagName' | cut -d'-' -f2 | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$'| sort -r -V | head -1)"
644643
if ! [[ $? -eq 0 ]]; then
645644
abort "cannot list releases"
646645
fi
647-
648-
release_id="$(hub_tool api "/repos/${ORG_NAME}/${REPO_NAME}/releases/tags/knative-${last_version}" | jq .id)"
649-
if [[ $? -ne 0 ]]; then
650-
abort "cannot get relase id from github"
651-
fi
652-
653-
hub_tool api --method PATCH "/repos/${ORG_NAME}/${REPO_NAME}/releases/$release_id" \
654-
-F make_latest=true > /dev/null || abort "error setting $last_version to 'latest'"
646+
647+
gh_tool release edit "knative-${last_version}" --latest > /dev/null || abort "error setting $last_version to 'latest'"
655648
echo "Github release ${last_version} set as 'latest'"
656649
}
657650

@@ -742,12 +735,14 @@ function publish_to_github() {
742735
local description="$(mktemp)"
743736
local attachments_dir="$(mktemp -d)"
744737
local commitish=""
738+
local target_branch=""
745739
local github_tag="knative-${TAG}"
746740

747741
# Copy files to a separate dir
742+
# shellcheck disable=SC2068
748743
for artifact in $@; do
749744
cp ${artifact} "${attachments_dir}"/
750-
attachments+=("--attach=${artifact}#$(basename ${artifact})")
745+
attachments+=("${artifact}#$(basename ${artifact})")
751746
done
752747
echo -e "${title}\n" > "${description}"
753748
if [[ -n "${RELEASE_NOTES}" ]]; then
@@ -774,13 +769,16 @@ function publish_to_github() {
774769
git tag -a "${github_tag}" -m "${title}"
775770
git_push tag "${github_tag}"
776771

777-
[[ -n "${RELEASE_BRANCH}" ]] && commitish="--commitish=${RELEASE_BRANCH}"
772+
[[ -n "${RELEASE_BRANCH}" ]] && target_branch="--target=${RELEASE_BRANCH}"
778773
for i in {2..0}; do
779-
hub_tool release create \
780-
${attachments[@]} \
781-
--file="${description}" \
782-
"${commitish}" \
783-
"${github_tag}" && return 0
774+
# shellcheck disable=SC2068
775+
gh_tool release create \
776+
"${github_tag}" \
777+
--title "${title}" \
778+
--notes-file "${description}" \
779+
"${target_branch}" \
780+
${attachments[@]} && return 0
781+
784782
if [[ "${i}" -gt 0 ]]; then
785783
echo "Error publishing the release, retrying in 15s..."
786784
sleep 15

vendor/modules.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1110,10 +1110,10 @@ k8s.io/utils/pointer
11101110
k8s.io/utils/ptr
11111111
k8s.io/utils/strings/slices
11121112
k8s.io/utils/trace
1113-
# knative.dev/hack v0.0.0-20250109131303-f8be0ccdff36
1113+
# knative.dev/hack v0.0.0-20250116150306-c142b4835bc5
11141114
## explicit; go 1.21
11151115
knative.dev/hack
1116-
# knative.dev/hack/schema v0.0.0-20250109131303-f8be0ccdff36
1116+
# knative.dev/hack/schema v0.0.0-20250116150306-c142b4835bc5
11171117
## explicit; go 1.21
11181118
knative.dev/hack/schema/commands
11191119
knative.dev/hack/schema/docs

0 commit comments

Comments
 (0)