Commit 6b1a8067 by Levente Balogh Committed by GitHub

Grafana Toolkit: add an option for signing plugins as admin (#26817)

* feat(grafana-toolkit): add a flag to the plugin:ci-package command

* docs(grafana-toolkit): add a short comment above the flag

* fix(grafana-toolkit): fix option for signing a plugin with the admin endpoint
parent 9c81c7aa
......@@ -194,9 +194,12 @@ export const run = (includeInternalScripts = false) => {
program
.command('plugin:ci-package')
.option('--signing-admin', 'Use the admin API endpoint for signing the manifest.', false)
.description('Create a zip packages for the plugin')
.action(async cmd => {
await execTask(ciPackagePluginTask)({});
await execTask(ciPackagePluginTask)({
signingAdmin: cmd.signingAdmin,
});
});
program
......
......@@ -26,6 +26,7 @@ const rimraf = promisify(rimrafCallback);
export interface PluginCIOptions {
finish?: boolean;
upload?: boolean;
signingAdmin?: boolean;
}
/**
......@@ -106,7 +107,7 @@ export const ciBuildPluginDocsTask = new Task<PluginCIOptions>('Build Plugin Doc
* 2. zip it into packages in `~/ci/packages`
* 3. prepare grafana environment in: `~/ci/grafana-test-env`
*/
const packagePluginRunner: TaskRunner<PluginCIOptions> = async () => {
const packagePluginRunner: TaskRunner<PluginCIOptions> = async ({ signingAdmin }) => {
const start = Date.now();
const ciDir = getCiFolder();
const packagesDir = path.resolve(ciDir, 'packages');
......@@ -161,9 +162,12 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async () => {
}
});
// Write a manifest.txt file in the dist folder
// Write a MANIFEST.txt file in the dist folder
// By using the --signing-admin flag the plugin doesn't need to be in the plugins database to be signed,
// however it requires an Admin API key.
try {
await execa('grabpl', ['build-plugin-manifest', distContentDir]);
const grabplCommandFlags = signingAdmin ? ['build-plugin-manifest', '--signing-admin'] : ['build-plugin-manifest'];
await execa('grabpl', [...grabplCommandFlags, distContentDir]);
} catch (err) {
console.warn(`Error signing manifest: ${distContentDir}`, err);
}
......
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