aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/gcs
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-09-20 18:26:15 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-09-20 18:29:38 +0200
commit9a6f6af6455424cf17d1dc3db8b6c1b2a0c1f058 (patch)
tree6cfd41c3e6747de6ab8edfd3d50d9b5867ebae0d /pkg/gcs
parent0e88373b1cb65233d8e15d1b98d758b982ba707e (diff)
syz-ci: upload coverage reports to GCS
Upload coverage reports from all managers to GCS after 6 hours of runtime (to make it more apples-to-apples).
Diffstat (limited to 'pkg/gcs')
-rw-r--r--pkg/gcs/gcs.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/gcs/gcs.go b/pkg/gcs/gcs.go
index 7e832de41..7da24d6e2 100644
--- a/pkg/gcs/gcs.go
+++ b/pkg/gcs/gcs.go
@@ -107,6 +107,19 @@ func (client *Client) FileWriter(gcsFile string) (io.WriteCloser, error) {
return w, nil
}
+// Publish lets any user read gcsFile.
+func (client *Client) Publish(gcsFile string) error {
+ bucket, filename, err := split(gcsFile)
+ if err != nil {
+ return err
+ }
+ obj := client.client.Bucket(bucket).Object(filename)
+ return obj.ACL().Set(client.ctx, storage.AllUsers, storage.RoleReader)
+}
+
+// Where things get published.
+const PublicPrefix = "https://storage.googleapis.com/"
+
func split(file string) (bucket, filename string, err error) {
pos := strings.IndexByte(file, '/')
if pos == -1 {