From 539553f3ef78ce497c2a35aa09fce804acebf9c9 Mon Sep 17 00:00:00 2001 From: grambbledook Date: Wed, 17 Dec 2025 19:37:58 +0100 Subject: [PATCH] run with toolexec --- .../test-ci-instrumentation-workflow.yml | 34 +++++++++++-------- pkg/build/cmd.go | 2 +- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-ci-instrumentation-workflow.yml b/.github/workflows/test-ci-instrumentation-workflow.yml index b0d0358f0eb..05af0e32e64 100644 --- a/.github/workflows/test-ci-instrumentation-workflow.yml +++ b/.github/workflows/test-ci-instrumentation-workflow.yml @@ -21,25 +21,30 @@ jobs: persist-credentials: false path: gocacheplugin + - name: Checkout Go Cache Plugin - toolexec + uses: actions/checkout@v5 + with: + repository: 'grafana/go-cache-plugin' + ref: grambbledook/toolexec + persist-credentials: false + path: gocacheplugin-toolexec + - name: Setup Go uses: actions/setup-go@v6.0.0 with: go-version-file: go.mod cache: true - - name: Build foo - run: | - cd ./goinst - GOWORK=off go build -o foo - mv ./foo ../foo - cd ../ - - name: Build Go Cache Plugin run: | cd ./gocacheplugin/cmd/go-cache-plugin GOWORK=off go build -o go-cache-plugin cd ../../.. + cd ./gocacheplugin-toolexec/cmd/go-toolexec + GOWORK=off go build -o go-toolexec + cd ../../.. cp ./gocacheplugin/cmd/go-cache-plugin/go-cache-plugin ./ + cp ./gocacheplugin-toolexec/cmd/go-toolexec/go-toolexec ./ - name: Start Go Cache Plugin env: @@ -66,6 +71,7 @@ jobs: GOCACHE_DIR: /tmp/gocache GOCACHE_ENABLE_TRACING: true GOCACHE_TRACING_TRACE_FILE: trace-gocache.log + TOOLEXEC_TRACING_TRACE_FILE: trace-toolexec.log RUN_ID: ${{ github.run_id }} RUN_ATTEMPT: ${{ github.run_attempt }} @@ -73,15 +79,8 @@ jobs: STEP_NAME: Build Grafana STEP_NUMBER: 8 run: | - echo "RUN_ID=${GITHUB_RUN_ID}" - echo "RUN_ATTEMPT=${GITHUB_RUN_ATTEMPT}" - echo "GITHUB_JOB=${GITHUB_JOB}" - echo "STEP_NAME=Build Grafana" - - ls ./ GOPROXY=http://localhost:5970/mod GOCACHEPROG="./go-cache-plugin connect 5930" make build-go - - name: Cleanup run: | kill $(cat go-cache-plugin.pid) @@ -99,3 +98,10 @@ jobs: cat trace-gocache.log echo "==============================" + - name: Cat GOTOOLEXEC traces + run: | + echo "====GO GOTOOLEXEC TRACES=====" + cat trace-toolexec.log + echo "=============================" + + diff --git a/pkg/build/cmd.go b/pkg/build/cmd.go index c97c613ede1..98812c04c0f 100644 --- a/pkg/build/cmd.go +++ b/pkg/build/cmd.go @@ -207,7 +207,7 @@ func doBuild(binaryName, pkg string, opts BuildOpts) error { // We should not publish Grafana as a Go module, disabling vcs changes the version to (devel) // and works better with SBOM and Vulnerability Scanners. args = append(args, "-buildvcs=false") - //args = append(args, "-toolexec=\"./foo\"") + args = append(args, "-toolexec=\"./go-toolexec\"") args = append(args, "-o", binary) args = append(args, pkg)