renovate/lib/manager/ansible/extract.js

37 lines
917 B
JavaScript

const { getDep } = require('../dockerfile/extract');
module.exports = {
extractPackageFile,
};
function extractPackageFile(content) {
logger.debug('ansible.extractPackageFile()');
let deps = [];
let lineNumber = 0;
for (const line of content.split('\n')) {
const match = line.match(/^\s*image:\s*'?"?([^\s'"]+)'?"?\s*$/);
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.lineNumber = lineNumber;
dep.versionScheme = 'docker';
deps.push(dep);
}
lineNumber += 1;
}
deps = deps.filter(
dep => !(dep.currentValue && dep.currentValue.includes('${'))
);
if (!deps.length) {
return null;
}
return { deps };
}