Skip to content

Commit

Permalink
fix: upstream vertex handling of missing project (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbystedt authored Jan 17, 2025
1 parent e08050d commit 8787bc1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/collection/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,12 @@ export class AccountService {
await this.graphRepository.getUpstreamVertex<ProjectDto>(
service.collection.vertex.toString(),
CollectionNameEnum.project,
null,
['component'],
);
if (projectDtoArr.length !== 1) {
// Could not uniquely identify the project -- skip
continue;
}
const projectName = projectDtoArr[0].collection.name;
try {
await this.addTokenToServiceTools(projectName, serviceName, {
Expand Down Expand Up @@ -362,6 +366,16 @@ export class AccountService {
CollectionNameEnum.project,
['component'],
);
if (projectDtoArr.length !== 1) {
this.auditService.recordToolsSync(
'info',
'unknown',
`Skip sync: ${service.collection.scmUrl}`,
'Unknown',
serviceName,
);
continue;
}
const projectName = projectDtoArr[0].collection.name;

// Determine if this is a valid service to sync for
Expand Down
2 changes: 1 addition & 1 deletion src/collection/collection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export class CollectionService {
const vertices = await this.graphRepository.getUpstreamVertex<ProjectDto>(
service.vertex.toString(),
CollectionIndex.Project,
null,
['component'],
);
if (vertices.length !== 1) {
throw new NotFoundException({
Expand Down

0 comments on commit 8787bc1

Please sign in to comment.