[ci] Allow CI to be triggered by old elasticmachine-style comment (#105154)

This commit is contained in:
Brian Seeders 2024-02-05 15:38:19 -05:00 committed by GitHub
parent b250f06b09
commit 37b57a411b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 130 additions and 4 deletions

View file

@ -13,11 +13,11 @@ describe("generatePipelines", () => {
});
// Helper for testing pipeline generations that should be the same when using the overall ci trigger comment "buildkite test this"
const testWithTriggerCheck = (directory: string, changedFiles?: string[]) => {
const testWithTriggerCheck = (directory: string, changedFiles?: string[], comment = "buildkite test this") => {
const pipelines = generatePipelines(directory, changedFiles);
expect(pipelines).toMatchSnapshot();
process.env["GITHUB_PR_TRIGGER_COMMENT"] = "buildkite test this";
process.env["GITHUB_PR_TRIGGER_COMMENT"] = comment;
const pipelinesWithTriggerComment = generatePipelines(directory, changedFiles);
expect(pipelinesWithTriggerComment).toEqual(pipelines);
};
@ -42,4 +42,20 @@ describe("generatePipelines", () => {
const pipelines = generatePipelines(`${import.meta.dir}/mocks/pipelines`, ["build.gradle"]);
expect(pipelines).toMatchSnapshot();
});
test("should generate correct pipelines with a non-docs change and @elasticmachine", () => {
testWithTriggerCheck(
`${import.meta.dir}/mocks/pipelines`,
["build.gradle", "docs/README.asciidoc"],
"@elasticmachine test this please"
);
});
test("should generate correct pipelines with a non-docs change and @elasticsearchmachine", () => {
testWithTriggerCheck(
`${import.meta.dir}/mocks/pipelines`,
["build.gradle", "docs/README.asciidoc"],
"@elasticsearchmachine test this please"
);
});
});