Skip to content

Commit

Permalink
[buildkite] FTSR / limit concurrency and total jobs (elastic#115857) (e…
Browse files Browse the repository at this point in the history
…lastic#115876)

Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
  • Loading branch information
kibanamachine and brianseeders authored Oct 21, 2021
1 parent b7d93e1 commit 6180ad4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
8 changes: 1 addition & 7 deletions .buildkite/pipelines/flaky_tests/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ const inputs = [
default: 0,
required: true,
},
{
key: 'ftsr-concurrency',
text: 'Max concurrency per step',
default: 20,
required: true,
},
];

for (let i = 1; i <= OSS_CI_GROUPS; i++) {
Expand All @@ -36,7 +30,7 @@ for (let i = 1; i <= XPACK_CI_GROUPS; i++) {
const pipeline = {
steps: [
{
input: 'Number of Runs',
input: 'Number of Runs - Click Me',
fields: inputs,
},
{
Expand Down
25 changes: 21 additions & 4 deletions .buildkite/pipelines/flaky_tests/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ const overrideCount = parseInt(
execSync(`buildkite-agent meta-data get 'ftsr-override-count'`).toString().trim()
);

const concurrency =
parseInt(execSync(`buildkite-agent meta-data get 'ftsr-concurrency'`).toString().trim()) || 20;
const concurrency = 25;
const initialJobs = 3;

let totalJobs = initialJobs;

const testSuites = [];
for (const key of keys) {
Expand All @@ -21,12 +23,25 @@ for (const key of keys) {
const value =
overrideCount || execSync(`buildkite-agent meta-data get '${key}'`).toString().trim();

const count = value === '' ? defaultCount : parseInt(value);
totalJobs += count;

testSuites.push({
key: key.replace('ftsr-suite/', ''),
count: value === '' ? defaultCount : parseInt(value),
count: count,
});
}

if (totalJobs > 500) {
console.error('+++ Too many tests');
console.error(
`Buildkite builds can only contain 500 steps in total. Found ${totalJobs} in total. Make sure your test runs are less than ${
500 - initialJobs
}`
);
process.exit(1);
}

const steps = [];
const pipeline = {
env: {
Expand All @@ -46,7 +61,7 @@ steps.push({
for (const testSuite of testSuites) {
const TEST_SUITE = testSuite.key;
const RUN_COUNT = testSuite.count;
const UUID = TEST_SUITE + process.env.UUID;
const UUID = process.env.UUID;

const JOB_PARTS = TEST_SUITE.split('/');
const IS_XPACK = JOB_PARTS[0] === 'xpack';
Expand All @@ -65,6 +80,7 @@ for (const testSuite of testSuites) {
parallelism: RUN_COUNT,
concurrency: concurrency,
concurrency_group: UUID,
concurrency_method: 'eager',
});
} else {
steps.push({
Expand All @@ -75,6 +91,7 @@ for (const testSuite of testSuites) {
parallelism: RUN_COUNT,
concurrency: concurrency,
concurrency_group: UUID,
concurrency_method: 'eager',
});
}
}
Expand Down

0 comments on commit 6180ad4

Please sign in to comment.