Skip to content

Commit

Permalink
closes #15
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbradley committed Feb 22, 2017
1 parent 047e67b commit 9de7a80
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/controller/TestJobController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export interface TestJob {
user: string;
team: string;
commit: string;
hook: Url.Url
hook: Url.Url;
ref: string;
test: TestJobDeliverable;
}

Expand Down
1 change: 1 addition & 0 deletions src/controller/github/PushController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default class PushController {
team: record.team,
commit: record.commit.short,
hook: record.commentHook,
ref: record.ref,
test: {
name: repo.name,
image: 'autotest/' + key + '-' + repo.name + ':' + (repo.commit ? repo.commit : 'latest'),
Expand Down
6 changes: 6 additions & 0 deletions src/model/requests/PushRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class PushRecord implements DatabaseRecord {
private _user: string;
private _commit: Commit;
private _commentHook: Url.Url;
private _ref: string;
private timestamp: number;

constructor(payload: any) {
Expand All @@ -18,6 +19,7 @@ export default class PushRecord implements DatabaseRecord {
this._user = payload.pusher.name;
this._commit = new Commit(payload.after);
this._commentHook = Url.parse(payload.repository.commits_url.replace('{/sha}', '/' + this._commit) + '/comments');
this._ref = payload.ref;
this.timestamp = +new Date();
} catch(err) {
throw 'Failed to create new PushRecord. ' + err;
Expand All @@ -38,6 +40,10 @@ export default class PushRecord implements DatabaseRecord {
get commentHook(): Url.Url {
return this._commentHook;
}
get ref(): string {
return this._ref;
}

public async create(db: CouchDatabase): Promise<InsertResponse> {
return this.insert(db);
}
Expand Down
5 changes: 4 additions & 1 deletion src/model/results/TestRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ export default class TestRecord implements DatabaseRecord {
private suiteVersion: string;
private failedCoverage: string;
private stdioSize: number;
private ref: string;

constructor(githubToken: string, testJob: TestJob) {
this.githubToken = githubToken;
this.team = testJob.team;
this.deliverable = testJob.test;
this.commit = testJob.commit;
this.committer = testJob.user;
this.ref = testJob.ref;
this.timestamp = +new Date();
this._id = this.timestamp + '_' + this.team + ':' + this.deliverable.deliverable + '-';
}
Expand Down Expand Up @@ -394,7 +396,8 @@ export default class TestRecord implements DatabaseRecord {
'commit': this.commit,
'committer': this.committer,
'timestamp': this.timestamp,
'container': container
'container': container,
'ref': this.ref

}

Expand Down

0 comments on commit 9de7a80

Please sign in to comment.