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

Fix Go tracing on Windows, and fix tests #1209

Merged
merged 7 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion .github/workflows/__go-custom-tracing-autobuild.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/__go-custom-tracing.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [UNRELEASED]

- Improve error messages when the code scanning configuration file includes an invalid `queries` block or an invalid `query-filters` block. [#1208](https://github.com/github/codeql-action/pull/1208)
- Fix a bug where Go build tracing could fail on Windows. [#1209](https://github.com/github/codeql-action/pull/1209)

## 2.1.20 - 22 Aug 2022

Expand Down
8 changes: 7 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/languages.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/languages.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pr-checks/checks/go-custom-tracing-autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "Go: Autobuild custom tracing"
description: "Checks that Go tracing works in conjunction with the autobuilder"
os: ["ubuntu-latest", "macos-latest"]
env:
CODEQL_EXTRACTOR_GO_BUILD_TRACING: "true"
CODEQL_EXTRACTOR_GO_BUILD_TRACING: "on"
steps:
- uses: actions/setup-go@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion pr-checks/checks/go-custom-tracing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Go: Custom tracing"
description: "Checks that Go tracing works"
env:
CODEQL_EXTRACTOR_GO_BUILD_TRACING: "true"
CODEQL_EXTRACTOR_GO_BUILD_TRACING: "on"
steps:
- uses: actions/setup-go@v3
with:
Expand Down
12 changes: 11 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,17 @@ async function getCodeQLForCmd(
if (
await util.codeQlVersionAbove(this, CODEQL_VERSION_LUA_TRACER_CONFIG)
) {
if (await featureFlags.getValue(FeatureFlag.LuaTracerConfigEnabled)) {
if (
(await featureFlags.getValue(FeatureFlag.LuaTracerConfigEnabled)) &&
// There's a bug in Lua tracing for Go on Windows in versions 2.10.3 and earlier,
// so don't use Lua tracing when tracing Go on Windows.
// Once we've released a fix, we should add a version gate based on the fixed version.
!(
config.languages.includes(Language.go) &&
isTracedLanguage(Language.go) &&
process.platform === "win32"
)
) {
extraArgs.push("--internal-use-lua-tracing");
} else {
extraArgs.push("--no-internal-use-lua-tracing");
Expand Down
7 changes: 7 additions & 0 deletions src/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export function parseLanguage(language: string): Language | undefined {
}

export function isTracedLanguage(language: Language): boolean {
if (process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] === "true") {
henrymercer marked this conversation as resolved.
Show resolved Hide resolved
throw new Error(
"The CODEQL_EXTRACTOR_GO_BUILD_TRACING environment variable is set to an invalid value. " +
"To enable Go build tracing, please set it to 'on'."
);
}
henrymercer marked this conversation as resolved.
Show resolved Hide resolved

return (
["cpp", "java", "csharp", "swift"].includes(language) ||
(process.env["CODEQL_EXTRACTOR_GO_BUILD_TRACING"] === "on" &&
Expand Down