Commit c5f21bda by Stephanie Closson Committed by GitHub

Toolkit: Provide update plugin to allow plugins configuration to normalize (#23540)

* Toolkit: Update plugin added
- To normalize an bring a plugins "managed" config up to date

* Added changes for filter only release

* changed name

* updated test for checking files in manifest
parent 32390c1c
......@@ -2,7 +2,7 @@
const fs = require('fs');
entrypoint = () => {
const entrypoint = () => {
const defaultEntryPoint = '../src/cli/index.js';
const toolkitDirectory = `${process.env['PWD']}/node_modules/@grafana/toolkit`;
......@@ -25,4 +25,4 @@ entrypoint = () => {
return defaultEntryPoint;
};
require(entrypoint()).run();
require(entrypoint());
#!/usr/bin/env node
var path = require('path') ;
var path = require('path');
// This bin is used for cli executed internally
var tsProjectPath = path.resolve(__dirname, '../tsconfig.json');
require('ts-node').register({
project: tsProjectPath,
transpileOnly: true
transpileOnly: true,
});
require('../src/cli/index.ts').run(true);
......@@ -5,6 +5,9 @@ aliases:
- &filter-only-master
branches:
only: master
- &filter-only-release
branches:
only: /^v[1-9]*[0-9]+\.[1-9]*[0-9]+\.x$/
workflows:
version: 2
......@@ -24,11 +27,11 @@ workflows:
type: approval
requires:
- test_integration
filters: *filter-only-master
filters: *filter-only-release
- publish_github_release:
requires:
- approve_release
filters: *filter-only-master
filters: *filter-only-release
executors:
default_exec: # declares a reusable executor
......
......@@ -15,6 +15,7 @@ import { searchTestDataSetupTask } from './tasks/searchTestDataSetup';
import { closeMilestoneTask } from './tasks/closeMilestone';
import { pluginDevTask } from './tasks/plugin.dev';
import { githubPublishTask } from './tasks/plugin.utils';
import { pluginUpdateTask } from './tasks/plugin.update';
import { ciBuildPluginTask, ciBuildPluginDocsTask, ciPackagePluginTask, ciPluginReportTask } from './tasks/plugin.ci';
import { buildPackageTask } from './tasks/package.build';
import { pluginCreateTask } from './tasks/plugin.create';
......@@ -228,6 +229,13 @@ export const run = (includeInternalScripts = false) => {
});
});
program
.command('plugin:update-circleci')
.description('Update plugin')
.action(async cmd => {
await execTask(pluginUpdateTask)({});
});
// Test the manifest creation
program
.command('manifest')
......
......@@ -23,6 +23,7 @@ describe('Manifest', () => {
"plugin.create.ts",
"plugin.dev.ts",
"plugin.tests.ts",
"plugin.update.ts",
"plugin.utils.ts",
"precommit.ts",
"searchTestDataSetup.ts",
......
import { Task, TaskRunner } from './task';
import { useSpinner } from '../utils/useSpinner';
import fs = require('fs');
import path = require('path');
interface UpdatePluginTask {}
const updateCiConfig = useSpinner<any>('Updating CircleCI config', async () => {
const ciConfigPath = path.join(process.cwd(), '.circleci');
if (!fs.existsSync(ciConfigPath)) {
fs.mkdirSync(ciConfigPath);
}
const sourceFile = path.join('node_modules/@grafana/toolkit/config/circleci', 'config.yml');
const destFile = path.join(ciConfigPath, 'config.yml');
fs.copyFileSync(sourceFile, destFile);
});
const pluginUpdateRunner: TaskRunner<UpdatePluginTask> = async () => {
await updateCiConfig({});
};
export const pluginUpdateTask = new Task<UpdatePluginTask>('Update Plugin', pluginUpdateRunner);
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