Skip to content

Commit

Permalink
Fix marker publish verification when bucket is private
Browse files Browse the repository at this point in the history
We need to use the private link for verification otherwise it will
simply not work. This patch also adds more verbosity around the update
process to enhance debugging.

Related to kubernetes/kubernetes#127350

Signed-off-by: Sascha Grunert <[email protected]>
  • Loading branch information
saschagrunert committed Sep 16, 2024
1 parent 2fe57c3 commit bf797dd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/release/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ func (p *Publisher) PublishToGcs(
return fmt.Errorf("write latest version file: %w", err)
}

logrus.Infof("Running `gsutil cp` from %s to: %s", latestFile, publishFileDst)
if err := p.client.GSUtil(
"-m",
"-h", "Content-Type:text/plain",
Expand All @@ -374,20 +375,22 @@ func (p *Publisher) PublishToGcs(
var content string
if !privateBucket {
// If public, validate public link
logrus.Infof("Validating uploaded version file using HTTP at %s", publicLink)
response, err := p.client.GetURLResponse(publicLink)
if err != nil {
return fmt.Errorf("get content of %s: %w", publicLink, err)
}
content = response
} else {
response, err := p.client.GSUtilOutput("cat", publicLink)
// Use the private location
logrus.Infof("Validating uploaded version file using `gsutil cat` at %s", publishFileDst)
response, err := p.client.GSUtilOutput("cat", publishFileDst)
if err != nil {
return fmt.Errorf("get content of %s: %w", publicLink, err)
return fmt.Errorf("get content of %s: %w", publishFileDst, err)
}
content = response
}

logrus.Infof("Validating uploaded version file at %s", publicLink)
if version != content {
return fmt.Errorf(
"version %s it not equal response %s",
Expand Down

0 comments on commit bf797dd

Please sign in to comment.