mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
area/grafana/toolkit: ci-package needs to use synchronous writes (#28148)
* ci needs to use synchronous writes or the file ends up with zero length
This commit is contained in:
parent
1a0690c837
commit
a9ef0f84b8
@ -90,11 +90,7 @@ const buildPluginDocsRunner: TaskRunner<PluginCIOptions> = async () => {
|
|||||||
const exe = await execa('cp', ['-rv', docsSrc + '/.', docsDest]);
|
const exe = await execa('cp', ['-rv', docsSrc + '/.', docsDest]);
|
||||||
console.log(exe.stdout);
|
console.log(exe.stdout);
|
||||||
|
|
||||||
fs.writeFile(path.resolve(docsDest, 'index.html'), `TODO... actually build docs`, err => {
|
fs.writeFileSync(path.resolve(docsDest, 'index.html'), `TODO... actually build docs`, { encoding: 'utf-8' });
|
||||||
if (err) {
|
|
||||||
throw new Error('Unable to docs');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
writeJobStats(start, workDir);
|
writeJobStats(start, workDir);
|
||||||
};
|
};
|
||||||
@ -158,11 +154,7 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async ({ signatureType,
|
|||||||
const pluginJsonFile = path.resolve(distContentDir, 'plugin.json');
|
const pluginJsonFile = path.resolve(distContentDir, 'plugin.json');
|
||||||
const pluginInfo = getPluginJson(pluginJsonFile);
|
const pluginInfo = getPluginJson(pluginJsonFile);
|
||||||
pluginInfo.info.build = await getPluginBuildInfo();
|
pluginInfo.info.build = await getPluginBuildInfo();
|
||||||
fs.writeFile(pluginJsonFile, JSON.stringify(pluginInfo, null, 2), err => {
|
fs.writeFileSync(pluginJsonFile, JSON.stringify(pluginInfo, null, 2), { encoding: 'utf-8' });
|
||||||
if (err) {
|
|
||||||
throw new Error('Error writing: ' + pluginJsonFile);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Write a MANIFEST.txt file in the dist folder
|
// Write a MANIFEST.txt file in the dist folder
|
||||||
try {
|
try {
|
||||||
@ -212,11 +204,7 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async ({ signatureType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p = path.resolve(packagesDir, 'info.json');
|
p = path.resolve(packagesDir, 'info.json');
|
||||||
fs.writeFile(p, JSON.stringify(info, null, 2), err => {
|
fs.writeFileSync(p, JSON.stringify(info, null, 2), { encoding: 'utf-8' });
|
||||||
if (err) {
|
|
||||||
throw new Error('Error writing package info: ' + p);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Write the custom settings
|
// Write the custom settings
|
||||||
p = path.resolve(grafanaEnvDir, 'custom.ini');
|
p = path.resolve(grafanaEnvDir, 'custom.ini');
|
||||||
@ -225,11 +213,7 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async ({ signatureType,
|
|||||||
`[paths] \n` +
|
`[paths] \n` +
|
||||||
`plugins = ${path.resolve(grafanaEnvDir, 'plugins')}\n` +
|
`plugins = ${path.resolve(grafanaEnvDir, 'plugins')}\n` +
|
||||||
`\n`; // empty line
|
`\n`; // empty line
|
||||||
fs.writeFile(p, customIniBody, err => {
|
fs.writeFileSync(p, customIniBody, { encoding: 'utf-8' });
|
||||||
if (err) {
|
|
||||||
throw new Error('Unable to write: ' + p);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
writeJobStats(start, getJobFolder());
|
writeJobStats(start, getJobFolder());
|
||||||
};
|
};
|
||||||
@ -267,11 +251,7 @@ const pluginReportRunner: TaskRunner<PluginCIOptions> = async ({ upload }) => {
|
|||||||
|
|
||||||
// Save the report to disk
|
// Save the report to disk
|
||||||
const file = path.resolve(ciDir, 'report.json');
|
const file = path.resolve(ciDir, 'report.json');
|
||||||
fs.writeFile(file, JSON.stringify(report, null, 2), err => {
|
fs.writeFileSync(file, JSON.stringify(report, null, 2), { encoding: 'utf-8' });
|
||||||
if (err) {
|
|
||||||
throw new Error('Unable to write: ' + file);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const GRAFANA_API_KEY = process.env.GRAFANA_API_KEY;
|
const GRAFANA_API_KEY = process.env.GRAFANA_API_KEY;
|
||||||
if (!GRAFANA_API_KEY) {
|
if (!GRAFANA_API_KEY) {
|
||||||
|
Loading…
Reference in New Issue
Block a user