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

Install wrapper script for Go on Linux to support tracing for Go 1.21 and above #1909

Merged
merged 29 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d718153
Use Go 1.21 for Go tracing checks
mbg Sep 28, 2023
c08086a
Add new environment variable for Go binary path
mbg Sep 28, 2023
3c15d23
Add utility function to run `file` command
mbg Sep 28, 2023
2bd75f5
Install Go wrapper script if necessary
mbg Sep 28, 2023
4611ff9
Cross-check Go binary in `analyze` Action
mbg Sep 28, 2023
df098ab
Set `DID_AUTOBUILD_GOLANG` in `runAutobuild`
mbg Sep 28, 2023
4cee553
Output stdout upon error in getFileType
mbg Oct 4, 2023
6044480
Add which go output in warning
mbg Oct 4, 2023
abb71f1
Add CLI feature flag to disable Go workaround
mbg Oct 4, 2023
7b0b42a
Remove `FeaturesInVersionResult`
mbg Oct 4, 2023
f6d9b6b
Improve/add log messages
mbg Oct 4, 2023
8ac1877
Allow other patch versions of Go in workflows
mbg Oct 4, 2023
9a5a628
Improve `getFileType`
mbg Oct 4, 2023
41a13ec
Fix comment in analyse Action
mbg Oct 4, 2023
bb70bab
Add comment explaining workaround
mbg Oct 4, 2023
68d0b65
Add another level to `tempBinPath`
mbg Oct 4, 2023
7380306
Trim `file` output
mbg Oct 5, 2023
db9f2c5
Add test for `isSupportedToolsFeature`
mbg Oct 5, 2023
c8dd2bc
Add integration test for workaround
mbg Oct 5, 2023
36777d2
Add utilities to produce diagnostics
mbg Oct 5, 2023
eb71a60
Emit diagnostic when Go was changed after `init`
mbg Oct 5, 2023
2b193c5
Store diagnostics in a `codeql-action` directory
mbg Oct 5, 2023
faf7528
Add integration test for Go workaround diagnostic
mbg Oct 5, 2023
7f4a948
Fix: create codeql-action diagnostics directory
mbg Oct 5, 2023
4154eb7
Fix: workflow name and description
mbg Oct 5, 2023
a144bf5
Store diagnostics in language-specific database
mbg Oct 5, 2023
3b2fee4
Include `mkdirSync` in `try`/`catch`
mbg Oct 5, 2023
94f3e9b
Apply suggestions from code review
mbg Oct 5, 2023
235bdca
Use `markdownMessage`
mbg Oct 5, 2023
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
Add integration test for Go workaround diagnostic
  • Loading branch information
mbg committed Oct 5, 2023
commit faf7528b446873c0dc993d6535ba3fecd3684dd8

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

49 changes: 49 additions & 0 deletions pr-checks/checks/go-indirect-tracing-workaround-diagnostic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Go: workaround for indirect tracing"
description: "Checks that our workaround for indirect tracing for Go 1.21+ on Linux works"
# only Linux is affected
operatingSystems: ["ubuntu"]
# pinned to a version which does not support statically linked binaries for indirect tracing
versions: ["stable-v2.14.6"]
steps:
- uses: actions/setup-go@v4
with:
# We need a Go version that ships with statically linked binaries on Linux
go-version: ">=1.21.0"
- uses: ./../action/init
with:
languages: go
tools: ${{ steps.prepare-test.outputs.tools-url }}
# Deliberately change Go after the `init` step
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Build code
shell: bash
run: go build main.go
- uses: ./../action/analyze
with:
output: "${{ runner.temp }}/results"
upload-database: false
- name: Check diagnostic appears in SARIF
uses: actions/github-script@v6
env:
SARIF_PATH: "${{ runner.temp }}/results/go.sarif"
with:
script: |
const fs = require('fs');

const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];

const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const statusPageNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage
);
if (statusPageNotifications.length !== 1) {
core.setFailed(
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
Loading