Skip to content

Commit

Permalink
Merge pull request #65 from GoogleCloudPlatform/add-subs-to-bq
Browse files Browse the repository at this point in the history
add substitutions to bq row
  • Loading branch information
jessieliu1 authored Aug 10, 2020
2 parents 5de20a2 + 8bcb0a7 commit 58ba8ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bigquery/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type bqRow struct {
Tags []string
Env []string
LogURL string
Substitutions [][]string
}

type buildImage struct {
Expand Down Expand Up @@ -249,6 +250,10 @@ func (n *bqNotifier) SendNotification(ctx context.Context, build *cbpb.Build) er
if err != nil {
return fmt.Errorf("Error generating UTM params: %v", err)
}
substitutions := [][]string{}
for key, value := range build.Substitutions {
substitutions = append(substitutions, []string{key, value})
}
newRow := &bqRow{
ProjectID: build.ProjectId,
ID: build.Id,
Expand All @@ -262,6 +267,7 @@ func (n *bqNotifier) SendNotification(ctx context.Context, build *cbpb.Build) er
Tags: build.Tags,
Env: build.Options.Env,
LogURL: logURL,
Substitutions: substitutions,
}
return n.client.WriteRow(ctx, newRow)
}
Expand Down

0 comments on commit 58ba8ac

Please sign in to comment.