Commit 2d7d171e by Dominik Prokop Committed by Ryan McKinley

grafana/toolkit: save artifacts in a zip id in the folder (#20123)

parent c032399e
...@@ -3,6 +3,7 @@ import { pluginBuildRunner } from './plugin.build'; ...@@ -3,6 +3,7 @@ import { pluginBuildRunner } from './plugin.build';
import { restoreCwd } from '../utils/cwd'; import { restoreCwd } from '../utils/cwd';
import { S3Client } from '../../plugins/aws'; import { S3Client } from '../../plugins/aws';
import { getPluginJson } from '../../config/utils/pluginValidation'; import { getPluginJson } from '../../config/utils/pluginValidation';
import { getPluginId } from '../../config/utils/getPluginId';
import { PluginMeta } from '@grafana/data'; import { PluginMeta } from '@grafana/data';
// @ts-ignore // @ts-ignore
...@@ -129,12 +130,16 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async () => { ...@@ -129,12 +130,16 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async () => {
const start = Date.now(); const start = Date.now();
const ciDir = getCiFolder(); const ciDir = getCiFolder();
const packagesDir = path.resolve(ciDir, 'packages'); const packagesDir = path.resolve(ciDir, 'packages');
const distDir = path.resolve(ciDir, 'dist'); let distDir = path.resolve(ciDir, 'dist');
const docsDir = path.resolve(ciDir, 'docs'); const docsDir = path.resolve(ciDir, 'docs');
const grafanaEnvDir = path.resolve(ciDir, 'grafana-test-env'); const grafanaEnvDir = path.resolve(ciDir, 'grafana-test-env');
await execa('rimraf', [packagesDir, distDir, grafanaEnvDir]); await execa('rimraf', [packagesDir, distDir, grafanaEnvDir]);
fs.mkdirSync(packagesDir); fs.mkdirSync(packagesDir);
fs.mkdirSync(distDir); fs.mkdirSync(distDir);
// Updating the dist dir to have a pluginId named directory in it
// The zip needs to contain the plugin code wrapped in directory with a pluginId name
distDir = path.resolve(ciDir, `dist/${getPluginId()}`);
fs.mkdirSync(grafanaEnvDir); fs.mkdirSync(grafanaEnvDir);
console.log('Build Dist Folder'); console.log('Build Dist Folder');
...@@ -184,7 +189,7 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async () => { ...@@ -184,7 +189,7 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async () => {
plugin: await getPackageDetails(zipFile, distDir), plugin: await getPackageDetails(zipFile, distDir),
}; };
console.log('Setup Grafan Environment'); console.log('Setup Grafana Environment');
let p = path.resolve(grafanaEnvDir, 'plugins', pluginInfo.id); let p = path.resolve(grafanaEnvDir, 'plugins', pluginInfo.id);
fs.mkdirSync(p, { recursive: true }); fs.mkdirSync(p, { recursive: true });
await execa('unzip', [zipFile, '-d', p]); await execa('unzip', [zipFile, '-d', p]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment