mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Toolkit: write PR report to a folder with the circle build number (#18560)
This commit is contained in:
@@ -352,10 +352,10 @@ const pluginReportRunner: TaskRunner<PluginCIOptions> = async ({ upload }) => {
|
||||
const branch = build.branch || 'unknown';
|
||||
const buildNumber = getBuildNumber();
|
||||
const root = `dev/${pluginMeta.id}`;
|
||||
const dirKey = pr ? `${root}/pr/${pr}` : `${root}/branch/${branch}/${buildNumber}`;
|
||||
const dirKey = pr ? `${root}/pr/${pr}/${buildNumber}` : `${root}/branch/${branch}/${buildNumber}`;
|
||||
|
||||
const jobKey = `${dirKey}/index.json`;
|
||||
if (await s3.exits(jobKey)) {
|
||||
if (await s3.exists(jobKey)) {
|
||||
throw new Error('Job already registered: ' + jobKey);
|
||||
}
|
||||
|
||||
@@ -378,11 +378,13 @@ const pluginReportRunner: TaskRunner<PluginCIOptions> = async ({ upload }) => {
|
||||
version,
|
||||
};
|
||||
|
||||
let base = `${root}/branch/${branch}/`;
|
||||
latest.build.number = buildNumber;
|
||||
if (pr) {
|
||||
latest.build.pr = pr;
|
||||
} else {
|
||||
latest.build.number = buildNumber;
|
||||
const base = `${root}/branch/${branch}/`;
|
||||
base = `${root}/pr/${pr}/`;
|
||||
}
|
||||
|
||||
const historyKey = base + `history.json`;
|
||||
console.log('Read', historyKey);
|
||||
const history: PluginHistory = await s3.readJSON(historyKey, defaultPluginHistory);
|
||||
@@ -390,7 +392,6 @@ const pluginReportRunner: TaskRunner<PluginCIOptions> = async ({ upload }) => {
|
||||
|
||||
await s3.writeJSON(historyKey, history);
|
||||
console.log('wrote history');
|
||||
}
|
||||
|
||||
// Private things may want to upload
|
||||
if (upload) {
|
||||
|
||||
@@ -94,7 +94,7 @@ export class S3Client {
|
||||
});
|
||||
}
|
||||
|
||||
async exits(key: string): Promise<boolean> {
|
||||
async exists(key: string): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.s3.getObject(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user