Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Prevent skippable changes pr break #188740

Merged
merged 7 commits into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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', {
delanni marked this conversation as resolved.
Show resolved Hide resolved
stdio: 'inherit',
});
process.exit(0);
console.log(emptyStep);
delanni marked this conversation as resolved.
Show resolved Hide resolved
return;
}

const pipeline = [];

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

Expand Down