Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix marker publish verification when bucket is private #3763

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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