renovate 44.68.1 → 44.68.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -77,8 +77,7 @@ var AwsMachineImageDatasource = class AwsMachineImageDatasource extends Datasour
|
|
|
77
77
|
if (newValueMatchingImages.length === 1 && newValueMatchingImages[0].Name) return newValueMatchingImages[0].Name;
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
|
-
return
|
|
81
|
-
/* v8 ignore next -- fallback when the AMI filter matches no image */ null;
|
|
80
|
+
return images.at(-1).Name ?? null;
|
|
82
81
|
}
|
|
83
82
|
getDigest(config, newValue) {
|
|
84
83
|
return withCache({
|
|
@@ -88,14 +87,14 @@ var AwsMachineImageDatasource = class AwsMachineImageDatasource extends Datasour
|
|
|
88
87
|
}, () => this._getDigest(config, newValue));
|
|
89
88
|
}
|
|
90
89
|
async _getReleases({ packageName: serializedAmiFilter }) {
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
-
return { releases:
|
|
94
|
-
version:
|
|
95
|
-
releaseTimestamp: asTimestamp(
|
|
96
|
-
isDeprecated: Date.parse(
|
|
97
|
-
newDigest:
|
|
98
|
-
}
|
|
90
|
+
const images = await this.getSortedAwsMachineImages(serializedAmiFilter);
|
|
91
|
+
if (!images.length || !images.at(-1).ImageId) return null;
|
|
92
|
+
return { releases: images.map((image) => ({
|
|
93
|
+
version: image.ImageId,
|
|
94
|
+
releaseTimestamp: asTimestamp(image.CreationDate),
|
|
95
|
+
isDeprecated: Date.parse(image.DeprecationTime ?? this.now.toString()) < this.now,
|
|
96
|
+
newDigest: image.Name
|
|
97
|
+
})) };
|
|
99
98
|
}
|
|
100
99
|
getReleases(config) {
|
|
101
100
|
return withCache({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["amazonMachineImageVersioning.id","hostRules.find"],"sources":["../../../../lib/modules/datasource/aws-machine-image/index.ts"],"sourcesContent":["import type { Filter, Image } from '@aws-sdk/client-ec2';\nimport { DescribeImagesCommand, EC2Client } from '@aws-sdk/client-ec2';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\nimport { coerceArray } from '../../../util/array.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport * as amazonMachineImageVersioning from '../../versioning/aws-machine-image/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\nimport type { AwsClientConfig, ParsedConfig } from './types.ts';\n\nexport class AwsMachineImageDatasource extends Datasource {\n static readonly id = 'aws-machine-image';\n\n override readonly defaultVersioning = amazonMachineImageVersioning.id;\n\n override readonly caching = true;\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the `CreationDate` field in the results.';\n\n override readonly defaultConfig = {\n // Because AMIs don't follow any versioning scheme, we override commitMessageExtra to remove the 'v'\n commitMessageExtra: 'to {{{newVersion}}}',\n prBodyColumns: ['Change', 'Image'],\n prBodyDefinitions: {\n Image: '```{{{newDigest}}}```',\n },\n digest: {\n // Because newDigestShort will allways be 'amazon-' we override to print the name of the AMI\n commitMessageExtra: 'to {{{newDigest}}}',\n prBodyColumns: ['Image'],\n prBodyDefinitions: {\n Image: '```{{{newDigest}}}```',\n },\n },\n };\n\n private readonly now: number;\n\n constructor() {\n super(AwsMachineImageDatasource.id);\n this.now = Date.now();\n }\n\n private isAmiFilter(config: Filter | AwsClientConfig): config is Filter {\n return 'Name' in config && 'Values' in config;\n }\n\n private getEC2Client(config: AwsClientConfig): EC2Client {\n const { profile, region } = config;\n const { password, token, username } = hostRules.find({\n hostType: AwsMachineImageDatasource.id,\n });\n return new EC2Client({\n region,\n credentials:\n username && password\n ? {\n accessKeyId: username,\n secretAccessKey: password,\n sessionToken: token,\n }\n : fromNodeProviderChain({ profile }),\n });\n }\n\n private getAmiFilterCommand(filter: Filter[]): DescribeImagesCommand {\n return new DescribeImagesCommand({\n Filters: filter,\n });\n }\n\n loadConfig(serializedAmiFilter: string): [Filter[], AwsClientConfig] {\n const parsedConfig: ParsedConfig = JSON.parse(serializedAmiFilter);\n const filters = [];\n let config = {};\n for (const elem of parsedConfig) {\n if (this.isAmiFilter(elem)) {\n // Separate actual AMI filters from aws client config\n filters.push(elem);\n } else {\n // merge config objects if there are multiple\n config = Object.assign(config, elem);\n }\n }\n return [filters, config];\n }\n\n private async _getSortedAwsMachineImages(\n serializedAmiFilter: string,\n ): Promise<Image[]> {\n const [amiFilter, clientConfig] = this.loadConfig(serializedAmiFilter);\n const amiFilterCmd = this.getAmiFilterCommand(amiFilter);\n const ec2Client = this.getEC2Client(clientConfig);\n const matchingImages = await ec2Client.send(amiFilterCmd);\n matchingImages.Images = coerceArray(matchingImages.Images);\n return matchingImages.Images.sort((image1, image2) => {\n const ts1 = image1.CreationDate\n ? Date.parse(image1.CreationDate)\n : /* v8 ignore next -- AWS SDK types CreationDate as optional, but EC2 always returns it for images */ 0; // TODO: add date coersion util\n\n const ts2 = image2.CreationDate\n ? Date.parse(image2.CreationDate)\n : /* v8 ignore next -- AWS SDK types CreationDate as optional, but EC2 always returns it for images */ 0; // TODO: add date coersion util\n return ts1 - ts2;\n });\n }\n\n getSortedAwsMachineImages(serializedAmiFilter: string): Promise<Image[]> {\n return withCache(\n {\n namespace: `datasource-${AwsMachineImageDatasource.id}`,\n key: `getSortedAwsMachineImages:${serializedAmiFilter}`,\n },\n () => this._getSortedAwsMachineImages(serializedAmiFilter),\n );\n }\n\n private async _getDigest(\n { packageName: serializedAmiFilter }: GetReleasesConfig,\n newValue?: string,\n ): Promise<string | null> {\n const images = await this.getSortedAwsMachineImages(serializedAmiFilter);\n if (images.length < 1) {\n return null;\n }\n\n if (newValue) {\n const newValueMatchingImages = images.filter(\n (image) => image.ImageId === newValue,\n );\n if (\n newValueMatchingImages.length === 1 &&\n newValueMatchingImages[0].Name\n ) {\n return newValueMatchingImages[0].Name;\n }\n return null;\n }\n\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["amazonMachineImageVersioning.id","hostRules.find"],"sources":["../../../../lib/modules/datasource/aws-machine-image/index.ts"],"sourcesContent":["import type { Filter, Image } from '@aws-sdk/client-ec2';\nimport { DescribeImagesCommand, EC2Client } from '@aws-sdk/client-ec2';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\nimport { coerceArray } from '../../../util/array.ts';\nimport { withCache } from '../../../util/cache/package/with-cache.ts';\nimport * as hostRules from '../../../util/host-rules.ts';\nimport { asTimestamp } from '../../../util/timestamp.ts';\nimport * as amazonMachineImageVersioning from '../../versioning/aws-machine-image/index.ts';\nimport { Datasource } from '../datasource.ts';\nimport type { GetReleasesConfig, ReleaseResult } from '../types.ts';\nimport type { AwsClientConfig, ParsedConfig } from './types.ts';\n\nexport class AwsMachineImageDatasource extends Datasource {\n static readonly id = 'aws-machine-image';\n\n override readonly defaultVersioning = amazonMachineImageVersioning.id;\n\n override readonly caching = true;\n\n override readonly releaseTimestampSupport = true;\n override readonly releaseTimestampNote =\n 'The release timestamp is determined from the `CreationDate` field in the results.';\n\n override readonly defaultConfig = {\n // Because AMIs don't follow any versioning scheme, we override commitMessageExtra to remove the 'v'\n commitMessageExtra: 'to {{{newVersion}}}',\n prBodyColumns: ['Change', 'Image'],\n prBodyDefinitions: {\n Image: '```{{{newDigest}}}```',\n },\n digest: {\n // Because newDigestShort will allways be 'amazon-' we override to print the name of the AMI\n commitMessageExtra: 'to {{{newDigest}}}',\n prBodyColumns: ['Image'],\n prBodyDefinitions: {\n Image: '```{{{newDigest}}}```',\n },\n },\n };\n\n private readonly now: number;\n\n constructor() {\n super(AwsMachineImageDatasource.id);\n this.now = Date.now();\n }\n\n private isAmiFilter(config: Filter | AwsClientConfig): config is Filter {\n return 'Name' in config && 'Values' in config;\n }\n\n private getEC2Client(config: AwsClientConfig): EC2Client {\n const { profile, region } = config;\n const { password, token, username } = hostRules.find({\n hostType: AwsMachineImageDatasource.id,\n });\n return new EC2Client({\n region,\n credentials:\n username && password\n ? {\n accessKeyId: username,\n secretAccessKey: password,\n sessionToken: token,\n }\n : fromNodeProviderChain({ profile }),\n });\n }\n\n private getAmiFilterCommand(filter: Filter[]): DescribeImagesCommand {\n return new DescribeImagesCommand({\n Filters: filter,\n });\n }\n\n loadConfig(serializedAmiFilter: string): [Filter[], AwsClientConfig] {\n const parsedConfig: ParsedConfig = JSON.parse(serializedAmiFilter);\n const filters = [];\n let config = {};\n for (const elem of parsedConfig) {\n if (this.isAmiFilter(elem)) {\n // Separate actual AMI filters from aws client config\n filters.push(elem);\n } else {\n // merge config objects if there are multiple\n config = Object.assign(config, elem);\n }\n }\n return [filters, config];\n }\n\n private async _getSortedAwsMachineImages(\n serializedAmiFilter: string,\n ): Promise<Image[]> {\n const [amiFilter, clientConfig] = this.loadConfig(serializedAmiFilter);\n const amiFilterCmd = this.getAmiFilterCommand(amiFilter);\n const ec2Client = this.getEC2Client(clientConfig);\n const matchingImages = await ec2Client.send(amiFilterCmd);\n matchingImages.Images = coerceArray(matchingImages.Images);\n return matchingImages.Images.sort((image1, image2) => {\n const ts1 = image1.CreationDate\n ? Date.parse(image1.CreationDate)\n : /* v8 ignore next -- AWS SDK types CreationDate as optional, but EC2 always returns it for images */ 0; // TODO: add date coersion util\n\n const ts2 = image2.CreationDate\n ? Date.parse(image2.CreationDate)\n : /* v8 ignore next -- AWS SDK types CreationDate as optional, but EC2 always returns it for images */ 0; // TODO: add date coersion util\n return ts1 - ts2;\n });\n }\n\n getSortedAwsMachineImages(serializedAmiFilter: string): Promise<Image[]> {\n return withCache(\n {\n namespace: `datasource-${AwsMachineImageDatasource.id}`,\n key: `getSortedAwsMachineImages:${serializedAmiFilter}`,\n },\n () => this._getSortedAwsMachineImages(serializedAmiFilter),\n );\n }\n\n private async _getDigest(\n { packageName: serializedAmiFilter }: GetReleasesConfig,\n newValue?: string,\n ): Promise<string | null> {\n const images = await this.getSortedAwsMachineImages(serializedAmiFilter);\n if (images.length < 1) {\n return null;\n }\n\n if (newValue) {\n const newValueMatchingImages = images.filter(\n (image) => image.ImageId === newValue,\n );\n if (\n newValueMatchingImages.length === 1 &&\n newValueMatchingImages[0].Name\n ) {\n return newValueMatchingImages[0].Name;\n }\n return null;\n }\n\n return images.at(-1)!.Name ?? null;\n }\n\n override getDigest(\n config: GetReleasesConfig,\n newValue?: string,\n ): Promise<string | null> {\n return withCache(\n {\n namespace: `datasource-${AwsMachineImageDatasource.id}`,\n key: `getDigest:${config.packageName}:${newValue ?? ''}`,\n fallback: true,\n },\n () => this._getDigest(config, newValue),\n );\n }\n\n private async _getReleases({\n packageName: serializedAmiFilter,\n }: GetReleasesConfig): Promise<ReleaseResult | null> {\n const images = await this.getSortedAwsMachineImages(serializedAmiFilter);\n if (!images.length || !images.at(-1)!.ImageId) {\n return null;\n }\n return {\n releases: images.map((image) => ({\n version: image.ImageId!,\n releaseTimestamp: asTimestamp(image.CreationDate),\n isDeprecated:\n Date.parse(image.DeprecationTime ?? this.now.toString()) < this.now,\n newDigest: image.Name,\n })),\n };\n }\n\n getReleases(config: GetReleasesConfig): Promise<ReleaseResult | null> {\n return withCache(\n {\n namespace: `datasource-${AwsMachineImageDatasource.id}`,\n key: `getReleases:${config.packageName}`,\n fallback: true,\n },\n () => this._getReleases(config),\n );\n }\n}\n"],"mappings":";;;;;;;;;AAYA,IAAa,4BAAb,MAAa,kCAAkC,WAAW;CACxD,OAAgB,KAAK;CAErB,oBAAsCA;CAEtC,UAA4B;CAE5B,0BAA4C;CAC5C,uBACE;CAEF,gBAAkC;EAEhC,oBAAoB;EACpB,eAAe,CAAC,UAAU,OAAO;EACjC,mBAAmB,EACjB,OAAO,wBACT;EACA,QAAQ;GAEN,oBAAoB;GACpB,eAAe,CAAC,OAAO;GACvB,mBAAmB,EACjB,OAAO,wBACT;EACF;CACF;CAEA;CAEA,cAAc;EACZ,MAAM,0BAA0B,EAAE;EAClC,KAAK,MAAM,K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uBACf,UACwB;EACxB,MAAM,SAAS,MAAM,KAAK,0BAA0B,mBAAmB;EACvE,IAAI,OAAO,SAAS,GAClB,OAAO;EAGT,IAAI,UAAU;GACZ,MAAM,yBAAyB,OAAO,QACnC,UAAU,MAAM,YAAY,QAC/B;GACA,IACE,uBAAuB,WAAW,KAClC,uBAAuB,EAAE,CAAC,MAE1B,OAAO,uBAAuB,EAAE,CAAC;GAEnC,OAAO;EACT;EAEA,OAAO,OAAO,GAAG,EAAE,CAAC,CAAE,QAAQ;CAChC;CAEA,UACE,QACA,UACwB;EACxB,OAAO,UACL;GACE,WAAW,cAAc,0BAA0B;GACnD,KAAK,aAAa,OAAO,YAAY,GAAG,YAAY;GACpD,UAAU;EACZ,SACM,KAAK,WAAW,QAAQ,QAAQ,CACxC;CACF;CAEA,MAAc,aAAa,EACzB,aAAa,uBACsC;EACnD,MAAM,SAAS,MAAM,KAAK,0BAA0B,mBAAmB;EACvE,IAAI,CAAC,OAAO,UAAU,CAAC,OAAO,GAAG,EAAE,CAAC,CAAE,SACpC,OAAO;EAET,OAAO,EACL,UAAU,OAAO,KAAK,WAAW;GAC/B,SAAS,MAAM;GACf,kBAAkB,YAAY,MAAM,YAAY;GAChD,cACE,KAAK,MAAM,MAAM,mBAAmB,KAAK,IAAI,SAAS,CAAC,IAAI,KAAK;GAClE,WAAW,MAAM;EACnB,EAAE,EACJ;CACF;CAEA,YAAY,QAA0D;EACpE,OAAO,UACL;GACE,WAAW,cAAc,0BAA0B;GACnD,KAAK,eAAe,OAAO;GAC3B,UAAU;EACZ,SACM,KAAK,aAAa,MAAM,CAChC;CACF;AACF"}
|
package/package.json
CHANGED
package/renovate-schema.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$id": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"title": "JSON schema for Renovate 44.68.
|
|
3
|
+
"title": "JSON schema for Renovate 44.68.2 config files (https://renovatebot.com/)",
|
|
4
4
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
-
"x-renovate-version": "44.68.
|
|
5
|
+
"x-renovate-version": "44.68.2",
|
|
6
6
|
"allowComments": true,
|
|
7
7
|
"type": "object",
|
|
8
8
|
"definitions": {
|