From d9c31241f93bce33ea1f5aed2b84943bcdf4f4d6 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 6 Feb 2020 17:50:57 +0100 Subject: [PATCH] builds: add branch to build info --- backend/builds/service/service.go | 1 + backend/proto/builds/v1/builds.pb.go | 69 +++++++++++-------- .../src/apis/builds/BuildsClient.ts | 1 + .../github-actions/src/apis/builds/types.ts | 1 + .../BuildDetailsPage/BuildDetailsPage.tsx | 6 ++ .../BuildListPage/BuildListPage.tsx | 11 ++- .../src/generated/builds/v1/builds_pb.d.ts | 4 ++ .../src/generated/builds/v1/builds_pb.js | 37 ++++++++-- proto/builds/v1/builds.proto | 3 +- 9 files changed, 95 insertions(+), 38 deletions(-) diff --git a/backend/builds/service/service.go b/backend/builds/service/service.go index 1b10fda980..7f728f2302 100644 --- a/backend/builds/service/service.go +++ b/backend/builds/service/service.go @@ -96,6 +96,7 @@ func (s *service) transformBuild(owner, repo string, run *ghactions.WorkflowRunR Uri: fmt.Sprintf("entity:build:%s/%s/%d", owner, repo, run.ID), CommitId: run.HeadCommit.ID, Message: run.HeadCommit.Message, + Branch: run.HeadBranch, Status: stat, } } diff --git a/backend/proto/builds/v1/builds.pb.go b/backend/proto/builds/v1/builds.pb.go index 2d00732d8b..fded19f883 100644 --- a/backend/proto/builds/v1/builds.pb.go +++ b/backend/proto/builds/v1/builds.pb.go @@ -234,7 +234,8 @@ type Build struct { Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` CommitId string `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"` Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` - Status BuildStatus `protobuf:"varint,4,opt,name=status,proto3,enum=spotify.backstage.builds.v1.BuildStatus" json:"status,omitempty"` + Branch string `protobuf:"bytes,4,opt,name=branch,proto3" json:"branch,omitempty"` + Status BuildStatus `protobuf:"varint,5,opt,name=status,proto3,enum=spotify.backstage.builds.v1.BuildStatus" json:"status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -286,6 +287,13 @@ func (m *Build) GetMessage() string { return "" } +func (m *Build) GetBranch() string { + if m != nil { + return m.Branch + } + return "" +} + func (m *Build) GetStatus() BuildStatus { if m != nil { return m.Status @@ -361,35 +369,36 @@ func init() { func init() { proto.RegisterFile("builds/v1/builds.proto", fileDescriptor_05a627abb7f9adb4) } var fileDescriptor_05a627abb7f9adb4 = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6f, 0xd3, 0x30, - 0x18, 0x25, 0x6b, 0x97, 0xb6, 0x5f, 0x07, 0x0b, 0x3e, 0x8c, 0x68, 0x13, 0x52, 0xc9, 0xa9, 0x4c, - 0x28, 0x53, 0xcb, 0x05, 0x71, 0x82, 0x75, 0x65, 0xaa, 0xa8, 0x22, 0xe4, 0x2a, 0x17, 0x2e, 0x55, - 0xda, 0x98, 0x62, 0x70, 0x71, 0xb0, 0x9d, 0xa0, 0xfc, 0x09, 0x0e, 0xfc, 0x3c, 0x7e, 0x0d, 0xb2, - 0x9d, 0xa8, 0x11, 0x93, 0xda, 0xde, 0xfc, 0xbe, 0xf7, 0xbd, 0xbc, 0xf7, 0x49, 0x2f, 0x70, 0xb1, - 0xca, 0x29, 0x4b, 0xe5, 0x4d, 0x31, 0xba, 0xb1, 0xaf, 0x30, 0x13, 0x5c, 0x71, 0x74, 0x25, 0x33, - 0xae, 0xe8, 0x97, 0x32, 0x5c, 0x25, 0xeb, 0xef, 0x52, 0x25, 0x1b, 0x12, 0x56, 0x7c, 0x31, 0x0a, - 0xc6, 0xf0, 0x74, 0x4e, 0xa5, 0xba, 0x35, 0x03, 0x4c, 0x7e, 0xe6, 0x44, 0x2a, 0xf4, 0x1c, 0x80, - 0xfc, 0x50, 0x54, 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0x65, 0xec, 0xd7, 0xb3, 0x58, 0x30, - 0xf4, 0x0c, 0x3a, 0x8c, 0x6f, 0x0c, 0x6b, 0x63, 0xba, 0x8c, 0x6f, 0x62, 0xc1, 0xae, 0x3f, 0x42, - 0xbf, 0x61, 0x8d, 0xba, 0xd0, 0x8e, 0xe2, 0xf9, 0xdc, 0x7b, 0x84, 0xfa, 0xd0, 0x59, 0xc4, 0x93, - 0xc9, 0x74, 0xb1, 0xf0, 0x1c, 0x0d, 0x3e, 0xbc, 0x9f, 0xcd, 0x63, 0x3c, 0xf5, 0x4e, 0x34, 0xf8, - 0x34, 0x8d, 0xee, 0x66, 0xd1, 0xbd, 0xd7, 0xd2, 0x00, 0xc7, 0x51, 0xa4, 0x41, 0x7b, 0xfc, 0xd7, - 0x01, 0xd7, 0x36, 0x0e, 0x7d, 0x03, 0xd8, 0xf5, 0x0f, 0x85, 0x7b, 0x6f, 0x7f, 0x50, 0xee, 0xcb, - 0x57, 0x47, 0xef, 0xeb, 0xee, 0xa4, 0xd0, 0xad, 0xcb, 0x84, 0xf6, 0x2b, 0xff, 0x2b, 0xe9, 0xe5, - 0xf5, 0x91, 0xdb, 0x19, 0x2b, 0x6f, 0xe1, 0xb3, 0xed, 0xaf, 0x2c, 0x46, 0x2b, 0xd7, 0xfc, 0xb5, - 0xaf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x40, 0xf3, 0x96, 0x0b, 0xcf, 0x03, 0x00, 0x00, + // 459 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xd1, 0x6e, 0xd3, 0x30, + 0x14, 0x25, 0x6b, 0x9b, 0xb6, 0xb7, 0x83, 0x05, 0x3f, 0x8c, 0x68, 0x13, 0x52, 0xc9, 0x53, 0x99, + 0x50, 0xa6, 0x96, 0x17, 0xc4, 0x13, 0xac, 0x2b, 0x53, 0x45, 0x15, 0x21, 0x57, 0x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f, 0x2a, 0xfd, 0xc5, 0x9b, 0xa3, 0xf7, 0x75, + 0xa7, 0x32, 0xe8, 0x54, 0x25, 0x43, 0xfb, 0x95, 0xff, 0x95, 0xf7, 0xe2, 0xea, 0xc8, 0xed, 0x0d, + 0xdb, 0xde, 0xc0, 0x57, 0xdb, 0x6b, 0x59, 0x0c, 0x53, 0xd7, 0xfc, 0xcd, 0x6f, 0xff, 0x05, 0x00, + 0x00, 0xff, 0xff, 0xc2, 0xff, 0xd7, 0x62, 0xe7, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/frontend/packages/plugins/github-actions/src/apis/builds/BuildsClient.ts b/frontend/packages/plugins/github-actions/src/apis/builds/BuildsClient.ts index d435bffbad..721a9ac006 100644 --- a/frontend/packages/plugins/github-actions/src/apis/builds/BuildsClient.ts +++ b/frontend/packages/plugins/github-actions/src/apis/builds/BuildsClient.ts @@ -52,6 +52,7 @@ export default class BuildsClient { return { commitId: build.getCommitId(), message: build.getMessage(), + branch: build.getBranch(), status: statusTable[build.getStatus()] || BuildStatus.Null, uri: build.getUri(), }; diff --git a/frontend/packages/plugins/github-actions/src/apis/builds/types.ts b/frontend/packages/plugins/github-actions/src/apis/builds/types.ts index 3f4b205047..ee57f00b5a 100644 --- a/frontend/packages/plugins/github-actions/src/apis/builds/types.ts +++ b/frontend/packages/plugins/github-actions/src/apis/builds/types.ts @@ -9,6 +9,7 @@ export enum BuildStatus { export type Build = { commitId: string; message: string; + branch: string; status: BuildStatus; uri: string; }; diff --git a/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/BuildDetailsPage.tsx b/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/BuildDetailsPage.tsx index a9ba638302..ff0e4c132a 100644 --- a/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/BuildDetailsPage.tsx +++ b/frontend/packages/plugins/github-actions/src/components/BuildDetailsPage/BuildDetailsPage.tsx @@ -50,6 +50,12 @@ const BuildDetailsPage: FC = () => { + + + Branch + + {details?.build.branch} + Message diff --git a/frontend/packages/plugins/github-actions/src/components/BuildListPage/BuildListPage.tsx b/frontend/packages/plugins/github-actions/src/components/BuildListPage/BuildListPage.tsx index 009d1df4ef..471442ffa8 100644 --- a/frontend/packages/plugins/github-actions/src/components/BuildListPage/BuildListPage.tsx +++ b/frontend/packages/plugins/github-actions/src/components/BuildListPage/BuildListPage.tsx @@ -49,14 +49,22 @@ const BuildListPage: FC<{}> = () => {
+ Status + Branch Message Commit - Status {status.value!.map(build => ( + {/* TODO: make this an indicating blobby thing */} + {build.status} + + + + + = () => { - {build.status} ))} diff --git a/frontend/packages/proto/src/generated/builds/v1/builds_pb.d.ts b/frontend/packages/proto/src/generated/builds/v1/builds_pb.d.ts index ff0c1489cf..6120c5e705 100644 --- a/frontend/packages/proto/src/generated/builds/v1/builds_pb.d.ts +++ b/frontend/packages/proto/src/generated/builds/v1/builds_pb.d.ts @@ -96,6 +96,9 @@ export class Build extends jspb.Message { getMessage(): string; setMessage(value: string): void; + getBranch(): string; + setBranch(value: string): void; + getStatus(): BuildStatus; setStatus(value: BuildStatus): void; @@ -112,6 +115,7 @@ export namespace Build { uri: string, commitId: string, message: string, + branch: string, status: BuildStatus, } } diff --git a/frontend/packages/proto/src/generated/builds/v1/builds_pb.js b/frontend/packages/proto/src/generated/builds/v1/builds_pb.js index 1f00094a1d..6ec016cd99 100644 --- a/frontend/packages/proto/src/generated/builds/v1/builds_pb.js +++ b/frontend/packages/proto/src/generated/builds/v1/builds_pb.js @@ -810,7 +810,8 @@ proto.spotify.backstage.builds.v1.Build.toObject = function(includeInstance, msg uri: jspb.Message.getFieldWithDefault(msg, 1, ""), commitId: jspb.Message.getFieldWithDefault(msg, 2, ""), message: jspb.Message.getFieldWithDefault(msg, 3, ""), - status: jspb.Message.getFieldWithDefault(msg, 4, 0) + branch: jspb.Message.getFieldWithDefault(msg, 4, ""), + status: jspb.Message.getFieldWithDefault(msg, 5, 0) }; if (includeInstance) { @@ -860,6 +861,10 @@ proto.spotify.backstage.builds.v1.Build.deserializeBinaryFromReader = function(m msg.setMessage(value); break; case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setBranch(value); + break; + case 5: var value = /** @type {!proto.spotify.backstage.builds.v1.BuildStatus} */ (reader.readEnum()); msg.setStatus(value); break; @@ -913,10 +918,17 @@ proto.spotify.backstage.builds.v1.Build.serializeBinaryToWriter = function(messa f ); } + f = message.getBranch(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } f = message.getStatus(); if (f !== 0.0) { writer.writeEnum( - 4, + 5, f ); } @@ -969,17 +981,32 @@ proto.spotify.backstage.builds.v1.Build.prototype.setMessage = function(value) { /** - * optional BuildStatus status = 4; + * optional string branch = 4; + * @return {string} + */ +proto.spotify.backstage.builds.v1.Build.prototype.getBranch = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.builds.v1.Build.prototype.setBranch = function(value) { + jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional BuildStatus status = 5; * @return {!proto.spotify.backstage.builds.v1.BuildStatus} */ proto.spotify.backstage.builds.v1.Build.prototype.getStatus = function() { - return /** @type {!proto.spotify.backstage.builds.v1.BuildStatus} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); + return /** @type {!proto.spotify.backstage.builds.v1.BuildStatus} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {!proto.spotify.backstage.builds.v1.BuildStatus} value */ proto.spotify.backstage.builds.v1.Build.prototype.setStatus = function(value) { - jspb.Message.setProto3EnumField(this, 4, value); + jspb.Message.setProto3EnumField(this, 5, value); }; diff --git a/proto/builds/v1/builds.proto b/proto/builds/v1/builds.proto index 7d62de0af7..7da136de7a 100644 --- a/proto/builds/v1/builds.proto +++ b/proto/builds/v1/builds.proto @@ -31,7 +31,8 @@ message Build { string uri = 1; string commit_id = 2; string message = 3; - BuildStatus status = 4; + string branch = 4; + BuildStatus status = 5; } message BuildDetails {