Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Check both qlpack.yml and codeql-pack.yml
  • Loading branch information
cklin committed Aug 8, 2025
commit baac9295dcfb83317aff5edbf823a061d27350c0
21 changes: 20 additions & 1 deletion src/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type PackInfo = {
language: KnownLanguage;
packinfoContents: string | undefined;
sourceOnlyPack?: boolean;
qlpackFileName?: string;
};

const testCheckPacksForOverlayCompatibility = test.macro({
Expand Down Expand Up @@ -174,8 +175,9 @@ const testCheckPacksForOverlayCompatibility = test.macro({
packInfo.packinfoContents,
);
}
const qlpackFileName = packInfo.qlpackFileName || "qlpack.yml";
fs.writeFileSync(
path.join(packPath, "qlpack.yml"),
path.join(packPath, qlpackFileName),
packInfo.sourceOnlyPack
? `name: ${packName}\nversion: 1.0.0\n`
: `name: ${packName}\nversion: 1.0.0\nbuildMetadata:\n sha: 123abc\n`,
Expand Down Expand Up @@ -423,3 +425,20 @@ test(
expectedResult: false,
},
);

test(
testCheckPacksForOverlayCompatibility,
"returns true when query pack uses codeql-pack.yml filename",
{
cliOverlayVersion: 2,
languages: [KnownLanguage.java],
packs: {
"codeql/java-queries": {
language: KnownLanguage.java,
packinfoContents: '{"overlayVersion":2}',
qlpackFileName: "codeql-pack.yml",
},
},
expectedResult: true,
},
);
5 changes: 4 additions & 1 deletion src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ function checkPackForOverlayCompatibility(
logger: Logger,
): boolean {
try {
const qlpackPath = path.join(packDir, "qlpack.yml");
let qlpackPath = path.join(packDir, "qlpack.yml");
if (!fs.existsSync(qlpackPath)) {
qlpackPath = path.join(packDir, "codeql-pack.yml");
}
const qlpackContents = yaml.load(
fs.readFileSync(qlpackPath, "utf8"),
) as QlPack;
Expand Down