Skip to content

Commit

Permalink
Merge pull request #3763 from saschagrunert/logging
Browse files Browse the repository at this point in the history
Fix marker publish verification when bucket is private
  • Loading branch information
k8s-ci-robot authored Sep 16, 2024
2 parents 2fe57c3 + bf797dd commit 27310fb
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 27310fb

Please sign in to comment.