diff --git a/tools/mothership/db/entry.go b/tools/mothership/db/entry.go index 8e3b01fc..3d4810a4 100644 --- a/tools/mothership/db/entry.go +++ b/tools/mothership/db/entry.go @@ -27,13 +27,15 @@ type Entry struct { Name string `db:"name"` EntryID string `db:"entry_id"` - CreateTime time.Time `db:"create_time"` + CreateTime time.Time `db:"create_time" pika:"omitempty"` OSRelease string `db:"os_release"` Sha256Sum string `db:"sha256_sum"` RepositoryName string `db:"repository_name"` WorkerID sql.NullString `db:"worker_id"` BatchName sql.NullString `db:"batch_name"` UserEmail sql.NullString `db:"user_email"` + CommitURI string `db:"commit_uri"` + CommitHash string `db:"commit_hash"` } func (e *Entry) GetID() string { @@ -47,8 +49,11 @@ func (e *Entry) ToPB() *mothershippb.Entry { CreateTime: timestamppb.New(e.CreateTime), OsRelease: e.OSRelease, Sha256Sum: e.Sha256Sum, + Repository: e.RepositoryName, WorkerId: base.SqlNullString(e.WorkerID), Batch: base.SqlNullString(e.BatchName), UserEmail: base.SqlNullString(e.UserEmail), + CommitUri: e.CommitURI, + CommitHash: e.CommitHash, } } diff --git a/tools/mothership/migrations/000001_init.up.sql b/tools/mothership/migrations/000001_init.up.sql index 735ce76f..7f487435 100644 --- a/tools/mothership/migrations/000001_init.up.sql +++ b/tools/mothership/migrations/000001_init.up.sql @@ -31,7 +31,9 @@ CREATE TABLE entries repository_name VARCHAR(255) NOT NULL, worker_id VARCHAR(255) REFERENCES workers (worker_id), batch_name VARCHAR(255), - user_email TEXT + user_email TEXT, + commit_uri TEXT NOT NULL, + commit_hash TEXT NOT NULL ); CREATE TABLE batches diff --git a/tools/mothership/proto/v1/entry.proto b/tools/mothership/proto/v1/entry.proto index 92e49c3d..81d79e60 100644 --- a/tools/mothership/proto/v1/entry.proto +++ b/tools/mothership/proto/v1/entry.proto @@ -70,4 +70,10 @@ message Entry { // If this field is not set, the package was archived by a // worker instead of a user. google.protobuf.StringValue user_email = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // URI to view commit + string commit_uri = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Commit hash of the resulting import + string commit_hash = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; }