Skip to content

Commit

Permalink
Merge pull request #3753 from saschagrunert/link
Browse files Browse the repository at this point in the history
Fix publish marker link replacement for production bucket
  • Loading branch information
k8s-ci-robot authored Sep 11, 2024
2 parents c868eaf + 3998f76 commit 681d6bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
24 changes: 12 additions & 12 deletions hack/get-krel
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ KREL_OUTPUT_PATH=${KREL_OUTPUT_PATH:-bin/krel}
echo "Using output path: $KREL_OUTPUT_PATH"
mkdir -p "$(dirname "$KREL_OUTPUT_PATH")"

if [[ "$TOOL_ORG" == "$DEFAULT_TOOL_ORG" && "$TOOL_REPO" == "$DEFAULT_TOOL_REPO" && "$TOOL_REF" == "$DEFAULT_TOOL_REF" ]]; then
LATEST_RELEASE=$(curl_retry https://api.github.com/repos/kubernetes/release/releases/latest | jq -r .tag_name)
echo "Using krel release: $LATEST_RELEASE"

echo "Downloading krel from GCB bucket…"
GCB_URL="https://storage.googleapis.com/k8s-artifacts-sig-release/kubernetes/release/$LATEST_RELEASE/krel-amd64-linux"
curl_retry "$GCB_URL" -o "$KREL_OUTPUT_PATH"
chmod +x "$KREL_OUTPUT_PATH"
else
echo "Building krel from sources"
go build -o "$KREL_OUTPUT_PATH" ./cmd/krel
fi
#if [[ "$TOOL_ORG" == "$DEFAULT_TOOL_ORG" && "$TOOL_REPO" == "$DEFAULT_TOOL_REPO" && "$TOOL_REF" == "$DEFAULT_TOOL_REF" ]]; then
# LATEST_RELEASE=$(curl_retry https://api.github.com/repos/kubernetes/release/releases/latest | jq -r .tag_name)
# echo "Using krel release: $LATEST_RELEASE"
#
# echo "Downloading krel from GCB bucket…"
# GCB_URL="https://storage.googleapis.com/k8s-artifacts-sig-release/kubernetes/release/$LATEST_RELEASE/krel-amd64-linux"
# curl_retry "$GCB_URL" -o "$KREL_OUTPUT_PATH"
# chmod +x "$KREL_OUTPUT_PATH"
#else
echo "Building krel from sources"
go build -o "$KREL_OUTPUT_PATH" ./cmd/krel
#fi

echo "Done, output of 'krel version':"
"$KREL_OUTPUT_PATH" version
6 changes: 4 additions & 2 deletions pkg/release/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,12 @@ func (p *Publisher) PublishToGcs(
return fmt.Errorf("get marker file destination: %w", publishFileDstErr)
}

logrus.Infof("Using marker path: %s", markerPath)
publicLink := fmt.Sprintf("%s/%s", URLPrefixForBucket(markerPath), publishFile)
if strings.HasPrefix(markerPath, ProductionBucket) {
publicLink = fmt.Sprintf("%s/%s", ProductionBucketURL, publishFile)
if strings.HasSuffix(markerPath, ProductionBucket+"/release") {
publicLink = fmt.Sprintf("%s/release/%s", ProductionBucketURL, publishFile)
}
logrus.Infof("Using public link: %s", publicLink)

uploadDir := filepath.Join(releaseStage, "upload")
if err := os.MkdirAll(uploadDir, os.FileMode(0o755)); err != nil {
Expand Down

0 comments on commit 681d6bc

Please sign in to comment.