mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 17:16:25 +00:00
ccf286240e
Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Jamie Magee <jamie.magee@gmail.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: Jamie Magee <JamieMagee@users.noreply.github.com>
34 lines
1,014 B
TypeScript
34 lines
1,014 B
TypeScript
import { logger } from '../../logger';
|
|
import * as dockerVersioning from '../../versioning/docker';
|
|
import { PackageDependency, PackageFile } from '../common';
|
|
import { getDep } from '../dockerfile/extract';
|
|
|
|
export default function extractPackageFile(
|
|
content: string
|
|
): PackageFile | null {
|
|
logger.trace('ansible.extractPackageFile()');
|
|
let deps: PackageDependency[] = [];
|
|
const re = /^\s*image:\s*'?"?([^\s'"]+)'?"?\s*$/;
|
|
for (const line of content.split('\n')) {
|
|
const match = re.exec(line);
|
|
if (match) {
|
|
const currentFrom = match[1];
|
|
const dep = getDep(currentFrom);
|
|
logger.debug(
|
|
{
|
|
depName: dep.depName,
|
|
currentValue: dep.currentValue,
|
|
currentDigest: dep.currentDigest,
|
|
},
|
|
'Docker image inside ansible'
|
|
);
|
|
dep.versioning = dockerVersioning.id;
|
|
deps.push(dep);
|
|
}
|
|
}
|
|
deps = deps.filter((dep) => !dep.currentValue?.includes('${'));
|
|
if (!deps.length) {
|
|
return null;
|
|
}
|
|
return { deps };
|
|
}
|