Skip to content

Commit

Permalink
Merge pull request #2231 from newrelic/alec/release-fixes
Browse files Browse the repository at this point in the history
Some fixes to the release script
  • Loading branch information
aswanson-nr authored Jan 11, 2024
2 parents e7827e1 + 8b4f662 commit 6ba28e2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
13 changes: 7 additions & 6 deletions utils/create_validate_pr_quickstarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
filterOutTestFiles,
isNotRemoved,
} from './lib/github-api-helpers';
import { translateMutationErrors, chunk } from './lib/nr-graphql-helpers';
import { translateMutationErrors } from './lib/nr-graphql-helpers';

import Quickstart, { QuickstartMutationResponse } from './lib/Quickstart';
import { CUSTOM_EVENT, recordNerdGraphResponse } from './newrelic/customEvent';
Expand All @@ -21,6 +21,8 @@ import {
} from './types/nerdgraph';
import logger from './logger';

const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

type ResponseWithErrors =
NerdGraphResponseWithLocalErrors<QuickstartMutationResponse> & {
name: string;
Expand Down Expand Up @@ -125,13 +127,12 @@ export const createValidateQuickstarts = async (
const quickstartErrors: string[] = [];

logger.info(`Submitting ${quickstarts.length} quickstarts...`);
for (const c of chunk(quickstarts, 5)) {
for (const c of quickstarts) {
try {
const res = await Promise.all(
c.map((quickstart) => quickstart.submitMutation(isDryRun))
);
const res = await c.submitMutation(isDryRun);
await sleep(10);

results = [...results, ...res];
results = [...results, res];
} catch (err) {
const error = err as Error;

Expand Down
5 changes: 1 addition & 4 deletions utils/lib/Alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ import { CUSTOM_EVENT, recordNerdGraphResponse } from '../newrelic/customEvent';
// within a nrql query. This portion is to help validate against
// very specific edge cases to ensure we don't have anything break
// during an install once it hits our UIs.
const TIMESERIES = 'TIMESERIES';
const INVALID_QUERY_KEYWORDS = [TIMESERIES] as const;

// RegExp matches the _first_ instance of any invalid keywords
const INVALID_REGEX = new RegExp(INVALID_QUERY_KEYWORDS.join('|'), 'mi');
const INVALID_REGEX = /\sTIMESERIES[\s]?/mi

interface RequiredDataSources {
id: string;
Expand Down
3 changes: 2 additions & 1 deletion utils/set-alert-policy-required-datasources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
fetchPaginatedGHResults,
filterQuickstartConfigFiles,
isNotRemoved,
filterOutTestFiles,
} from './lib/github-api-helpers';
import Quickstart from './lib/Quickstart';
import Alert, { SubmitSetRequiredDataSourcesMutationResult } from './lib/Alert';
Expand Down Expand Up @@ -33,7 +34,7 @@ const getQuickstartNameAndDataSources = async (
const files = await fetchPaginatedGHResults(ghUrl, ghToken);
logger.info(`Found ${files.length} files`);

const quickstartNames = filterQuickstartConfigFiles(files)
const quickstartNames = filterQuickstartConfigFiles(filterOutTestFiles(files))
.filter(isNotRemoved)
.reduce<{ name: string; dataSourceIds: string[] }[]>(
(acc, { filename }) => {
Expand Down
3 changes: 2 additions & 1 deletion utils/set-dashboards-required-datasources.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
fetchPaginatedGHResults,
filterOutTestFiles,
filterQuickstartConfigFiles,
isNotRemoved,
} from './lib/github-api-helpers';
Expand Down Expand Up @@ -35,7 +36,7 @@ const getQuickstartIds = async (
const files = await fetchPaginatedGHResults(ghUrl, ghToken);
logger.info(`Found ${files.length} files`);

const filteredQuickstarts = filterQuickstartConfigFiles(files)
const filteredQuickstarts = filterQuickstartConfigFiles(filterOutTestFiles(files))
.filter(isNotRemoved)
.reduce<Quickstart[]>((acc, { filename }) => {
const quickstart = new Quickstart(filename);
Expand Down

0 comments on commit 6ba28e2

Please sign in to comment.