Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fix bug to ensure error messages have complete stack trace in message logs. [#2425](https://github.com/github/vscode-codeql/pull/2425)
- Fix bug where the `CodeQL: Compare Query` command did not work for comparing quick-eval queries. [#2422](https://github.com/github/vscode-codeql/pull/2422)
- Update text of copy and export buttons in variant analysis results view to clarify that they only copy/export the selected/filtered results. [#2427](https://github.com/github/vscode-codeql/pull/2427)
- Add warning when using unsupported CodeQL CLI version. [#2428](https://github.com/github/vscode-codeql/pull/2428)

## 1.8.4 - 3 May 2023

Expand Down
4 changes: 4 additions & 0 deletions extensions/ql-vscode/src/codeql-cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,10 @@ export function shouldDebugCliServer() {
}

export class CliVersionConstraint {
// The oldest version of the CLI that we support. This is used to determine
// whether to show a warning about the CLI being too old on startup.
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.7.6");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to get this value automatically from https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/supported_cli_versions.json, instead of having to manually update it? (No problem if that isn't feasible!)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is outside of the src directory, so we can't actually get it from TypeScript without moving it or changing the packaging configuration to include it. Calculating the oldest version from this file would also be a little more complicated than updating this version, and I think you'd be updating this version only when you're changing the other constraints in this class as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need some docs/process somewhere to make sure this is updated when the oldest supported version is updated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're working on finalizing our deprecation strategy and it's probably going to be the case that we only need to support 1 year's worth of old CLIs. Given that we do a minor version bump every 3 months (coinciding with GHES releases), we only need to be supporting v2.10.x and later.

That being said, I don't think this is something that should be addressed in this PR. It's more of an FYI.

Once this is finalized, then I agree that we should have some processes around deprecations.


/**
* CLI version where building QLX packs for remote queries is supported.
* (The options were _accepted_ by a few earlier versions, but only from
Expand Down
24 changes: 23 additions & 1 deletion extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
activate as archiveFilesystemProvider_activate,
zipArchiveScheme,
} from "./common/vscode/archive-filesystem-provider";
import { CodeQLCliServer } from "./codeql-cli/cli";
import { CliVersionConstraint, CodeQLCliServer } from "./codeql-cli/cli";
import {
CliConfigListener,
DistributionConfigListener,
Expand Down Expand Up @@ -408,6 +408,28 @@ export async function activate(
codeQlExtension.cliServer.addVersionChangedListener((ver) => {
telemetryListener.cliVersion = ver;
});

let unsupportedWarningShown = false;
codeQlExtension.cliServer.addVersionChangedListener((ver) => {
if (!ver) {
return;
}

if (unsupportedWarningShown) {
return;
}

if (CliVersionConstraint.OLDEST_SUPPORTED_CLI_VERSION.compare(ver) < 0) {
return;
}

void showAndLogWarningMessage(
`You are using an unsupported version of the CodeQL CLI (${ver}). ` +
`The minimum supported version is ${CliVersionConstraint.OLDEST_SUPPORTED_CLI_VERSION}. ` +
`Please upgrade to a newer version of the CodeQL CLI.`,
);
unsupportedWarningShown = true;
});
}

return codeQlExtension;
Expand Down