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

Using remote builds with buildbarn #3317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
19 changes: 16 additions & 3 deletions src/remote/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,19 @@ func (c *Client) verifyActionResult(target *core.BuildTarget, command *pb.Comman
}

for ep, out := range target.EntryPoints {
if _, ok := flatOuts[out]; !ok {
ok := false
// Single output file
if _, ok = flatOuts[out]; ok {
continue
}
// Multiple output files or directories
for _, outputPath := range command.OutputPaths {
entryPointFullPath := fmt.Sprintf("%s/%s", outputPath, out)
if _, ok = flatOuts[entryPointFullPath]; ok {
break
}
}
if !ok {
return fmt.Errorf("failed to produce output %v for entry point %v", out, ep)
}
}
Expand Down Expand Up @@ -508,11 +520,12 @@ func (c *Client) verifyActionResult(target *core.BuildTarget, command *pb.Comman
// At this point it's verified all the directories, but not the files themselves.
digests := make([]digest.Digest, 0, len(outputs))
for _, output := range outputs {
// FlattenTree doesn't populate the digest in for empty dirs... we don't need to check them anyway
if !output.IsEmptyDirectory {
// FlattenTree doesn't populate the digest in for empty dirs neither symlinks... we don't need to check them anyway
if !output.IsEmptyDirectory && output.SymlinkTarget == "" {
digests = append(digests, output.Digest)
}
}

if missing, err := c.client.MissingBlobs(context.Background(), digests); err != nil {
return fmt.Errorf("Failed to verify action result outputs: %s", err)
} else if len(missing) != 0 {
Expand Down
7 changes: 3 additions & 4 deletions src/remote/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,10 @@ func removeOutputs(target *core.BuildTarget) error {

// subresourceIntegrity returns a string corresponding to a target's hashes in the Subresource Integrity format.
func subresourceIntegrity(target *core.BuildTarget) string {
ret := make([]string, len(target.Hashes))
for i, h := range target.Hashes {
ret[i] = reencodeSRI(target, h)
if len(target.Hashes) == 1 {
return reencodeSRI(target, target.Hashes[0])
}
return strings.Join(ret, " ")
return ""
}

// reencodeSRI re-encodes a hash from the hex format we use to base64-encoded.
Expand Down