Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
bumping knative.dev/client-pkg 8478498...afd7c8d:
  > afd7c8d Update community files (# 201)
bumping knative.dev/hack e92a16a...c142b48:
  > c142b48 Refactor release script to gh CLI (# 408)
  > f8be0cc Update community files (# 407)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation committed Jan 17, 2025
1 parent bffeb7a commit 24ae34e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/docker/go-connections v0.5.0
github.com/spf13/cobra v1.7.0
gotest.tools/v3 v3.3.0
knative.dev/client-pkg v0.0.0-20241223132438-847849858508
knative.dev/hack v0.0.0-20241227080210-e92a16ae0893
knative.dev/client-pkg v0.0.0-20250109131824-afd7c8d9de7b
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5

)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/client-pkg v0.0.0-20241223132438-847849858508 h1:/Ht6zpdIDciiwFr48iRDmY2Ifwo7xmJQnTX2DI6ER+k=
knative.dev/client-pkg v0.0.0-20241223132438-847849858508/go.mod h1:1Wp8+rz7JT3c17r0+2IdxWjkNvEZ/4/AHywaV12nq3I=
knative.dev/hack v0.0.0-20241227080210-e92a16ae0893 h1:zy7LwNJ2S7obPMHVAtxQgZPXxBTZzoxHbtb6uhxOl7Q=
knative.dev/hack v0.0.0-20241227080210-e92a16ae0893/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
knative.dev/client-pkg v0.0.0-20250109131824-afd7c8d9de7b h1:LqysBUe0hLjZhVNFRlSaOjQ8SRJs2K+eMt6YlTvIJJw=
knative.dev/client-pkg v0.0.0-20250109131824-afd7c8d9de7b/go.mod h1:1Wp8+rz7JT3c17r0+2IdxWjkNvEZ/4/AHywaV12nq3I=
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5 h1:CwLVoSblWmfaIkgRFX2LcEA0uYZo+nOhdPatsz+QL9w=
knative.dev/hack v0.0.0-20250116150306-c142b4835bc5/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
knative.dev/pkg v0.0.0-20241021183759-9b9d535af5ad h1:Nrjtr2H168rJeamH4QdyLMV1lEKHejNhaj1ymgQMfLk=
knative.dev/pkg v0.0.0-20241021183759-9b9d535af5ad/go.mod h1:StJI72GWcm/iErmk4RqFJiOo8RLbVqPbHxUqeVwAzeo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
Expand Down
46 changes: 22 additions & 24 deletions vendor/knative.dev/hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ export GOFLAGS="-ldflags=-s -ldflags=-w"
export GITHUB_TOKEN=""
readonly IMAGES_REFS_FILE="${IMAGES_REFS_FILE:-$(mktemp -d)/images_refs.txt}"

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

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

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

last_version="$(hub_tool -p release | cut -d'-' -f2 | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$'| sort -r -V | head -1)"
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)"
if ! [[ $? -eq 0 ]]; then
abort "cannot list releases"
fi

release_id="$(hub_tool api "/repos/${ORG_NAME}/${REPO_NAME}/releases/tags/knative-${last_version}" | jq .id)"
if [[ $? -ne 0 ]]; then
abort "cannot get relase id from github"
fi

hub_tool api --method PATCH "/repos/${ORG_NAME}/${REPO_NAME}/releases/$release_id" \
-F make_latest=true > /dev/null || abort "error setting $last_version to 'latest'"

gh_tool release edit "knative-${last_version}" --latest > /dev/null || abort "error setting $last_version to 'latest'"
echo "Github release ${last_version} set as 'latest'"
}

Expand Down Expand Up @@ -742,12 +735,14 @@ function publish_to_github() {
local description="$(mktemp)"
local attachments_dir="$(mktemp -d)"
local commitish=""
local target_branch=""
local github_tag="knative-${TAG}"

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

[[ -n "${RELEASE_BRANCH}" ]] && commitish="--commitish=${RELEASE_BRANCH}"
[[ -n "${RELEASE_BRANCH}" ]] && target_branch="--target=${RELEASE_BRANCH}"
for i in {2..0}; do
hub_tool release create \
${attachments[@]} \
--file="${description}" \
"${commitish}" \
"${github_tag}" && return 0
# shellcheck disable=SC2068
gh_tool release create \
"${github_tag}" \
--title "${title}" \
--notes-file "${description}" \
"${target_branch}" \
${attachments[@]} && return 0

if [[ "${i}" -gt 0 ]]; then
echo "Error publishing the release, retrying in 15s..."
sleep 15
Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ gotest.tools/v3/internal/assert
gotest.tools/v3/internal/difflib
gotest.tools/v3/internal/format
gotest.tools/v3/internal/source
# knative.dev/client-pkg v0.0.0-20241223132438-847849858508
# knative.dev/client-pkg v0.0.0-20250109131824-afd7c8d9de7b
## explicit; go 1.22.0
knative.dev/client-pkg/pkg/plugin
# knative.dev/hack v0.0.0-20241227080210-e92a16ae0893
# knative.dev/hack v0.0.0-20250116150306-c142b4835bc5
## explicit; go 1.21
knative.dev/hack

0 comments on commit 24ae34e

Please sign in to comment.