Skip to content

Commit b05ad3d

Browse files
authored
Merge pull request #18095 from hakman/replace-shipbot
feat: Replace shipbot with gh-based script for promoting binaries
2 parents 5ec5244 + 936b3f7 commit b05ad3d

4 files changed

Lines changed: 97 additions & 54 deletions

File tree

.shipbot.yaml

Lines changed: 0 additions & 47 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ release-tag:
417417

418418
.PHONY: release-github
419419
release-github:
420-
shipbot -tag v${KOPS_RELEASE_VERSION} -config .shipbot.yaml -src .build/dist/
420+
hack/promote-to-github.sh ${KOPS_RELEASE_VERSION}
421421

422422
# --------------------------------------------------
423423
# API / embedding examples

docs/contributing/release-process.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,10 @@ to artifacts.k8s.io via postsubmit. The process is described in detail
165165

166166
### Promote to GitHub (all releases)
167167

168-
The `shipbot` tool is from [kopeio/shipbot](https://github.com/kopeio/shipbot).
169-
170-
Binaries to github (all releases):
168+
This downloads the promoted binaries from artifacts.k8s.io and uploads them to the GitHub release:
171169

172170
```
173-
cd ${GOPATH}/src/k8s.io/kops/
174-
git checkout v$VERSION
175-
shipbot -tag v${VERSION} -config .shipbot.yaml -src ${GOPATH}/src/k8s.io/k8s.io/k8s-staging-kops/kops/releases/${VERSION}/
171+
hack/promote-to-github.sh ${VERSION}
176172
```
177173

178174
### Smoke test the release

hack/promote-to-github.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Downloads release binaries from artifacts.k8s.io and uploads them
18+
# to the corresponding GitHub release, replacing the shipbot tool.
19+
#
20+
# Usage: promote-to-github.sh <version>
21+
# e.g. promote-to-github.sh 1.30.0
22+
23+
set -o errexit
24+
set -o nounset
25+
set -o pipefail
26+
27+
REPO="kubernetes/kops"
28+
BASE_URL="https://artifacts.k8s.io/binaries/kops"
29+
30+
# Binaries to upload: source-path -> github-name
31+
declare -A BINARIES=(
32+
["darwin/amd64/kops"]="kops-darwin-amd64"
33+
["darwin/amd64/kops.sha256"]="kops-darwin-amd64.sha256"
34+
["darwin/arm64/kops"]="kops-darwin-arm64"
35+
["darwin/arm64/kops.sha256"]="kops-darwin-arm64.sha256"
36+
["linux/amd64/kops"]="kops-linux-amd64"
37+
["linux/amd64/kops.sha256"]="kops-linux-amd64.sha256"
38+
["linux/arm64/kops"]="kops-linux-arm64"
39+
["linux/arm64/kops.sha256"]="kops-linux-arm64.sha256"
40+
["windows/amd64/kops.exe"]="kops-windows-amd64"
41+
["windows/amd64/kops.exe.sha256"]="kops-windows-amd64.sha256"
42+
["linux/amd64/nodeup"]="nodeup-linux-amd64"
43+
["linux/amd64/nodeup.sha256"]="nodeup-linux-amd64.sha256"
44+
["linux/arm64/nodeup"]="nodeup-linux-arm64"
45+
["linux/arm64/nodeup.sha256"]="nodeup-linux-arm64.sha256"
46+
["linux/amd64/protokube"]="protokube-linux-amd64"
47+
["linux/amd64/protokube.sha256"]="protokube-linux-amd64.sha256"
48+
["linux/arm64/protokube"]="protokube-linux-arm64"
49+
["linux/arm64/protokube.sha256"]="protokube-linux-arm64.sha256"
50+
["linux/amd64/channels"]="channels-linux-amd64"
51+
["linux/amd64/channels.sha256"]="channels-linux-amd64.sha256"
52+
["linux/arm64/channels"]="channels-linux-arm64"
53+
["linux/arm64/channels.sha256"]="channels-linux-arm64.sha256"
54+
)
55+
56+
if [[ $# -ne 1 ]]; then
57+
echo "Usage: $0 <version>" >&2
58+
echo " e.g. $0 1.30.0" >&2
59+
exit 1
60+
fi
61+
62+
VERSION="$1"
63+
# Strip leading 'v' if provided
64+
VERSION="${VERSION#v}"
65+
TAG="v${VERSION}"
66+
67+
if ! command -v gh &>/dev/null; then
68+
echo "Error: gh (GitHub CLI) is required but not found in PATH" >&2
69+
exit 1
70+
fi
71+
72+
WORKDIR=$(mktemp -d)
73+
trap 'rm -rf "${WORKDIR}"' EXIT
74+
75+
echo "Downloading binaries from ${BASE_URL}/${VERSION}/ ..."
76+
77+
for source in "${!BINARIES[@]}"; do
78+
github_name="${BINARIES[$source]}"
79+
dest="${WORKDIR}/${github_name}"
80+
url="${BASE_URL}/${VERSION}/${source}"
81+
82+
echo " ${source} -> ${github_name}"
83+
if ! curl -fsSL --retry 3 -o "${dest}" "${url}"; then
84+
echo "Error: failed to download ${url}" >&2
85+
exit 1
86+
fi
87+
done
88+
89+
echo "Uploading binaries to GitHub release ${TAG} ..."
90+
91+
if ! gh release upload "${TAG}" --repo "${REPO}" "${WORKDIR}"/*; then
92+
echo "Error: failed to upload binaries to GitHub release ${TAG}" >&2
93+
exit 1
94+
fi

0 commit comments

Comments
 (0)