renovate/lib/manager/ansible/extract.ts
renovate[bot] ccf286240e
chore(deps): update linters (major) (#6769)
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>
2020-08-10 16:18:08 +02:00

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 };
}