Skip to content

Commit

Permalink
[CI] Prevent skippable changes pr break (#188740)
Browse files Browse the repository at this point in the history
## Summary
Closes: elastic/kibana-operations#159
(cherry picked from commit 03148d2)
  • Loading branch information
delanni committed Jul 22, 2024
1 parent 019d1ba commit 35ce814
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions .buildkite/scripts/pipelines/pull_request/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* Side Public License, v 1.
*/

import { execSync } from 'child_process';
import fs from 'fs';
import prConfigs from '../../../pull_requests.json';
import { areChangesSkippable, doAnyChangesMatch, getAgentImageConfig } from '#pipeline-utils';

const prConfig = prConfigs.jobs.find((job) => job.pipelineSlug === 'kibana-pull-request');
const emptyStep = `steps: []`;

if (!prConfig) {
console.error(`'kibana-pull-request' pipeline not found in .buildkite/pull_requests.json`);
Expand All @@ -28,21 +28,16 @@ const getPipeline = (filename: string, removeSteps = true) => {
};

(async () => {
const pipeline: string[] = [];

try {
const skippable = await areChangesSkippable(SKIPPABLE_PR_MATCHERS, REQUIRED_PATHS);

if (skippable) {
console.log('All changes in PR are skippable. Skipping CI.');

// Since we skip everything, including post-build, we need to at least make sure the commit status gets set
execSync('BUILD_SUCCESSFUL=true .buildkite/scripts/lifecycle/commit_status_complete.sh', {
stdio: 'inherit',
});
process.exit(0);
console.log(emptyStep);
return;
}

const pipeline = [];

pipeline.push(getAgentImageConfig({ returnYaml: true }));
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/base.yml', false));

Expand Down

0 comments on commit 35ce814

Please sign in to comment.