Skip to content

Commit

Permalink
Jira source updates on startup (#176)
Browse files Browse the repository at this point in the history
* Jira source updates on startup
* Linting on init
  • Loading branch information
thomas-gerber committed May 27, 2022
1 parent 3c383e0 commit acb97cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 11 additions & 6 deletions init/src/airbyte/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ export class AirbyteInit {
);
}
throw new VError(
'Unable to determine latest image version of Faros Destination'
'Unable to determine latest image version of %s',
repository
);
}
return version;
Expand Down Expand Up @@ -231,11 +232,15 @@ export class AirbyteInit {
}
}

async updateFarosSourceVersions(concurrency?: number): Promise<void> {
async updateSelectSourceVersions(concurrency?: number): Promise<void> {
const listResponse = await this.api.post('/source_definitions/list');
const farosSourceDefs = (
listResponse.data.sourceDefinitions as SourceDefinition[]
).filter((sd) => sd.dockerRepository.startsWith('farosai/'));
).filter(
(sd) =>
sd.dockerRepository.startsWith('farosai/') ||
sd.dockerRepository === 'airbyte/source-jira'
);

const promises: Promise<void>[] = [];
const limit = pLimit(concurrency || Number.POSITIVE_INFINITY);
Expand All @@ -246,8 +251,8 @@ export class AirbyteInit {
);
if (sourceDef.dockerImageTag !== version) {
logger.info(
'Updating Faros %s source from %s to %s',
sourceDef.name,
'Updating %s source from %s to %s',
sourceDef.dockerRepository,
sourceDef.dockerImageTag,
version
);
Expand Down Expand Up @@ -302,7 +307,7 @@ async function main(): Promise<void> {
options.forceSetup
);
await airbyte.setupFarosDestinationDefinition();
await airbyte.updateFarosSourceVersions(options.airbyteApiCallsConcurrency);
await airbyte.updateSelectSourceVersions(options.airbyteApiCallsConcurrency);
logger.info('Airbyte setup is complete');
}

Expand Down
4 changes: 1 addition & 3 deletions init/test/integration-tests/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ describe('integration tests', () => {
await hasuraClient.getCicdArtifactCommitAssociationCount(origin)
).toBe(1);
expect(await hasuraClient.getCicdRepositoryCount(origin)).toBe(1);
expect(
await hasuraClient.getVcsPullRequestCommitCount(origin)
).toBe(1);
expect(await hasuraClient.getVcsPullRequestCommitCount(origin)).toBe(1);
},
60 * 1000
);
Expand Down

0 comments on commit acb97cf

Please sign in to comment.