More fixes from test

This commit is contained in:
Jonas Bovin 2022-11-22 12:01:04 +01:00
parent d75cec7ae6
commit 31d5a27e0d

View file

@ -10,34 +10,34 @@ export function createMetaJson(root: string): string[] {
const xmllint = execSync('sudo apt install libxml2-utils', { shell: '/bin/bash' });
console.log(xmllint.toString());
let command = `#!/bin/bash
const command = `#!/bin/bash
cd ` + root + `
find . -name 'pom.xml' -type f > ` + root + `poms.txt
`;
const output = execSync(command, { shell: '/bin/bash' });
console.log(output.toString());
let poms = fs.readFileSync(root + 'poms.txt', 'utf8').toString();
let ownersFile = fs.readFileSync(root + '.github/CODEOWNERS', 'utf8').toString();
const poms = fs.readFileSync(root + 'poms.txt', 'utf8').toString();
const ownersFile = fs.readFileSync(root + '.github/CODEOWNERS', 'utf8').toString();
for (const pomRaw of poms.split('\n')) {
let pom = pomRaw.replace("./", "/");
let name = pom.split("/")[2];
const pom = pomRaw.replace("./", "/");
const name = pom.split("/")[2];
if (pom.startsWith("/components") && pom.indexOf(name + "-deployment/") > -1) {
let owners = [];
let reviewers = [];
const owners = [];
const reviewers = [];
for (const ownerRaw of ownersFile.split('\n')) {
let path = ownerRaw.split(' ')[0];
const path = ownerRaw.split(' ')[0];
if (path.length > 3 && ownerRaw.indexOf(' @') > -1 && pom.startsWith(path)) {
owners.push(ownerRaw.split(' ')[1])
reviewers.push(ownerRaw.split(' ')[1])
}
}
let gid = `#!/bin/bash
const gid = `#!/bin/bash
cd ` + root + `
xmllint --xpath "/*[local-name()='project']/*[local-name()='groupId']/text()" ` + pom + `
`
let aid = `#!/bin/bash
const aid = `#!/bin/bash
cd ` + root + `
xmllint --xpath "/*[local-name()='project']/*[local-name()='artifactId']/text()" ` + pom + `
`
@ -45,7 +45,7 @@ export function createMetaJson(root: string): string[] {
console.log(groupId);
const artifactId = execSync(aid, { shell: '/bin/bash' }).toString();
console.log(artifactId);
let meta = {};
const meta = {};
meta['manifestSource'] = pom.replace("/pom.xml", "").substring(1);
meta['manifestTarget'] = "helm-chart/components/charts/" + name + "/" + name + "-deployment/templates/";
meta['owners'] = owners;