mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
fix(datasource/maven): Remove S3 Blob handling (#17401)
This commit is contained in:
parent
2a6b86c3d6
commit
4f9eedbe45
2 changed files with 22 additions and 13 deletions
|
@ -8,7 +8,7 @@ import { mockClient } from 'aws-sdk-client-mock';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { ReleaseResult, getPkgReleases } from '..';
|
import { ReleaseResult, getPkgReleases } from '..';
|
||||||
import { Fixtures } from '../../../../test/fixtures';
|
import { Fixtures } from '../../../../test/fixtures';
|
||||||
import { logger } from '../../../../test/util';
|
import { logger } from '../../../logger';
|
||||||
import * as hostRules from '../../../util/host-rules';
|
import * as hostRules from '../../../util/host-rules';
|
||||||
import { id as versioning } from '../../versioning/maven';
|
import { id as versioning } from '../../versioning/maven';
|
||||||
import { MavenDatasource } from '.';
|
import { MavenDatasource } from '.';
|
||||||
|
@ -113,7 +113,7 @@ describe('modules/datasource/maven/s3', () => {
|
||||||
const res = await get('org.example:package', baseUrlS3);
|
const res = await get('org.example:package', baseUrlS3);
|
||||||
|
|
||||||
expect(res).toBeNull();
|
expect(res).toBeNull();
|
||||||
expect(logger.logger.debug).toHaveBeenCalledWith(
|
expect(logger.debug).toHaveBeenCalledWith(
|
||||||
{
|
{
|
||||||
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
||||||
},
|
},
|
||||||
|
@ -132,7 +132,7 @@ describe('modules/datasource/maven/s3', () => {
|
||||||
const res = await get('org.example:package', baseUrlS3);
|
const res = await get('org.example:package', baseUrlS3);
|
||||||
|
|
||||||
expect(res).toBeNull();
|
expect(res).toBeNull();
|
||||||
expect(logger.logger.debug).toHaveBeenCalledWith(
|
expect(logger.debug).toHaveBeenCalledWith(
|
||||||
{
|
{
|
||||||
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
||||||
},
|
},
|
||||||
|
@ -151,7 +151,7 @@ describe('modules/datasource/maven/s3', () => {
|
||||||
const res = await get('org.example:package', baseUrlS3);
|
const res = await get('org.example:package', baseUrlS3);
|
||||||
|
|
||||||
expect(res).toBeNull();
|
expect(res).toBeNull();
|
||||||
expect(logger.logger.trace).toHaveBeenCalledWith(
|
expect(logger.trace).toHaveBeenCalledWith(
|
||||||
{
|
{
|
||||||
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
||||||
},
|
},
|
||||||
|
@ -170,7 +170,7 @@ describe('modules/datasource/maven/s3', () => {
|
||||||
const res = await get('org.example:package', baseUrlS3);
|
const res = await get('org.example:package', baseUrlS3);
|
||||||
|
|
||||||
expect(res).toBeNull();
|
expect(res).toBeNull();
|
||||||
expect(logger.logger.trace).toHaveBeenCalledWith(
|
expect(logger.trace).toHaveBeenCalledWith(
|
||||||
{
|
{
|
||||||
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
||||||
},
|
},
|
||||||
|
@ -189,7 +189,7 @@ describe('modules/datasource/maven/s3', () => {
|
||||||
const res = await get('org.example:package', baseUrlS3);
|
const res = await get('org.example:package', baseUrlS3);
|
||||||
|
|
||||||
expect(res).toBeNull();
|
expect(res).toBeNull();
|
||||||
expect(logger.logger.debug).toHaveBeenCalledWith(
|
expect(logger.debug).toHaveBeenCalledWith(
|
||||||
{
|
{
|
||||||
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
failedUrl: 's3://repobucket/org/example/package/maven-metadata.xml',
|
||||||
message: 'Unknown error',
|
message: 'Unknown error',
|
||||||
|
@ -197,6 +197,19 @@ describe('modules/datasource/maven/s3', () => {
|
||||||
'Unknown S3 download error'
|
'Unknown S3 download error'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns null for unexpected response type', async () => {
|
||||||
|
s3mock
|
||||||
|
.on(GetObjectCommand, {
|
||||||
|
Bucket: 'repobucket',
|
||||||
|
Key: 'org/example/package/maven-metadata.xml',
|
||||||
|
})
|
||||||
|
.resolvesOnce({});
|
||||||
|
expect(await get('org.example:package', baseUrlS3)).toBeNull();
|
||||||
|
expect(logger.debug).toHaveBeenCalledWith(
|
||||||
|
"Expecting Readable response type got 'undefined' type instead"
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { Blob } from 'buffer';
|
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { XmlDocument } from 'xmldoc';
|
import { XmlDocument } from 'xmldoc';
|
||||||
|
@ -114,15 +113,12 @@ export async function downloadS3Protocol(pkgUrl: URL): Promise<string | null> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const { Body: res } = await getS3Client().getObject(s3Url);
|
const { Body: res } = await getS3Client().getObject(s3Url);
|
||||||
|
|
||||||
// istanbul ignore if
|
|
||||||
if (res instanceof Blob) {
|
|
||||||
return res.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res instanceof Readable) {
|
if (res instanceof Readable) {
|
||||||
return streamToString(res);
|
return streamToString(res);
|
||||||
}
|
}
|
||||||
|
logger.debug(
|
||||||
|
`Expecting Readable response type got '${typeof res}' type instead`
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const failedUrl = pkgUrl.toString();
|
const failedUrl = pkgUrl.toString();
|
||||||
if (err.name === 'CredentialsProviderError') {
|
if (err.name === 'CredentialsProviderError') {
|
||||||
|
|
Loading…
Reference in a new issue