Skip to content

Commit d896acc

Browse files
committed
Fix github actions
1 parent 2a2fd08 commit d896acc

File tree

6 files changed

+48
-74
lines changed

6 files changed

+48
-74
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ on:
66
pull_request:
77
branches: [ main ]
88

9-
env:
10-
# renovate: datasource=go depName=mvdan.cc/gofumpt
11-
GOFUMPT_VERSION: v0.3.1
12-
# renovate: datasource=go depName=github.com/golangci/golangci-lint
13-
GOLANGCI_LINT_VERSION: v1.53.3
14-
159
jobs:
1610
skip-check:
1711
name: Skip check
@@ -24,7 +18,7 @@ jobs:
2418
contents: read
2519
steps:
2620
- id: skip-check
27-
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
21+
uses: fkirc/skip-duplicate-actions@v5
2822
with:
2923
do_not_skip: '["schedule", "workflow_dispatch"]'
3024
paths: |-
@@ -44,10 +38,10 @@ jobs:
4438
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
4539
steps:
4640
- name: Check out the code
47-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
41+
uses: actions/checkout@v4
4842

4943
- name: Set up Go
50-
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
44+
uses: actions/setup-go@v5
5145
with:
5246
go-version-file: 'go.mod'
5347
check-latest: true
@@ -69,6 +63,4 @@ jobs:
6963
run: make vet
7064

7165
- name: Lint
72-
uses: golangci/golangci-lint-action@0ad9a0988b3973e851ab0a07adf248ec2e100376 # tag=v3.3.1
73-
with:
74-
version: ${{ env.GOLANGCI_LINT_VERSION }}
66+
uses: golangci/golangci-lint-action@v6

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ jobs:
3939

4040
steps:
4141
- name: Check out the code
42-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
42+
uses: actions/checkout@v4
4343

4444
- name: Set up Go
45-
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
45+
uses: actions/setup-go@v5
4646
with:
4747
go-version-file: 'go.mod'
4848
cache: true
4949

5050
# Initializes the CodeQL tools for scanning.
5151
- name: Initialize CodeQL
52-
uses: github/codeql-action/init@0c670bbf0414f39666df6ce8e718ec5662c21e03 # tag=v2.1.17
52+
uses: github/codeql-action/init@v3
5353
with:
5454
languages: ${{ matrix.language }}
5555
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -68,4 +68,4 @@ jobs:
6868
- run: make build
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@0c670bbf0414f39666df6ce8e718ec5662c21e03 # tag=v2.1.17
71+
uses: github/codeql-action/analyze@v3

.github/workflows/container.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ on:
66
pull_request:
77
branches: [ main ]
88

9-
env:
10-
# renovate: datasource=go depName=github.com/goreleaser/goreleaser
11-
GORELEASER_VERSION: v1.10.2
12-
139
jobs:
1410
skip-check:
1511
name: Skip check
@@ -22,7 +18,7 @@ jobs:
2218
contents: read
2319
steps:
2420
- id: skip-check
25-
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
21+
uses: fkirc/skip-duplicate-actions@v5
2622
with:
2723
do_not_skip: '["schedule", "workflow_dispatch"]'
2824
paths: |-
@@ -44,17 +40,17 @@ jobs:
4440
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
4541
runs-on: ubuntu-latest
4642
container:
47-
image: docker.io/goreleaser/goreleaser-cross:v1.18.3
43+
image: docker.io/goreleaser/goreleaser-cross:v1.22.4
4844
options: --privileged
4945
env:
5046
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5147
GORELEASER_CURRENT_TAG: "${{ env.goreleaser_current_tag }}"
5248
steps:
5349
- name: Check out the code
54-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
50+
uses: actions/checkout@v4
5551

5652
- name: Set up Go
57-
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
53+
uses: actions/setup-go@v5
5854
with:
5955
go-version-file: 'go.mod'
6056
cache: true
@@ -63,7 +59,7 @@ jobs:
6359
run: goreleaser release --rm-dist --skip-validate --skip-publish --snapshot --debug
6460

6561
- name: Archive generated artifacts
66-
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
62+
uses: actions/upload-artifact@v4
6763
with:
6864
name: parca-debuginfo-dist-container
6965
if-no-files-found: error
@@ -94,15 +90,15 @@ jobs:
9490
run: dnf install --assumeyes --repo fedora git make jq
9591

9692
- name: Check out code into the Go module directory
97-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
93+
uses: actions/checkout@v4
9894

9995
- name: Set up Go
100-
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
96+
uses: actions/setup-go@v5
10197
with:
10298
go-version-file: 'go.mod'
10399
check-latest: true
104100

105-
- uses: actions/download-artifact@v3
101+
- uses: actions/download-artifact@v4
106102
with:
107103
name: parca-debuginfo-dist-container
108104
path: goreleaser/dist
@@ -115,7 +111,7 @@ jobs:
115111

116112
- name: Install cosign
117113
if: ${{ github.event_name != 'pull_request' }}
118-
uses: sigstore/cosign-installer@09a077b27eb1310dcfb21981bee195b30ce09de0 # tag=v2.5.0
114+
uses: sigstore/cosign-installer@v3
119115

120116
- name: Login to registry
121117
if: ${{ github.event_name != 'pull_request' }}
@@ -124,7 +120,7 @@ jobs:
124120
125121
- name: Install crane
126122
if: ${{ github.event_name != 'pull_request' }}
127-
uses: imjasonh/setup-crane@e82f1b9a8007d399333baba4d75915558e9fb6a4 # tag=v0.2
123+
uses: imjasonh/setup-crane@v0.4
128124

129125
- name: Push and sign container
130126
if: ${{ github.event_name != 'pull_request' }}

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
contents: read
2020
steps:
2121
- id: skip-check
22-
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
22+
uses: fkirc/skip-duplicate-actions@v5
2323
with:
2424
do_not_skip: '["schedule", "workflow_dispatch"]'
2525
paths: |-
@@ -38,10 +38,10 @@ jobs:
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Check out the code
41-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
41+
uses: actions/checkout@v4
4242

4343
- name: Set up Go
44-
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
44+
uses: actions/setup-go@v5
4545
with:
4646
go-version-file: 'go.mod'
4747
cache: true

.github/workflows/release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ jobs:
1919
if: startsWith(github.ref, 'refs/tags/')
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525

2626
- name: Set up Go
27-
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
27+
uses: actions/setup-go@v5
2828
with:
2929
go-version-file: 'go.mod'
3030

3131
- name: Run GoReleaser
32-
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
32+
uses: goreleaser/goreleaser-action@v6
3333
with:
3434
distribution: goreleaser
3535
version: ${{ env.GORELEASER_VERSION }}
@@ -38,7 +38,7 @@ jobs:
3838
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3939

4040
- name: Archive generated artifacts
41-
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
41+
uses: actions/upload-artifact@v4
4242
with:
4343
name: parca-debuginfo-dist-release
4444
if-no-files-found: error
@@ -51,7 +51,7 @@ jobs:
5151
runs-on: ubuntu-latest
5252
needs: binaries
5353
steps:
54-
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
54+
- uses: actions/checkout@v4
5555

5656
- name: Publish Vercel
5757
run: |
@@ -80,13 +80,13 @@ jobs:
8080
run: dnf install --assumeyes --repo fedora git make jq
8181

8282
- name: Check out code into the Go module directory
83-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
83+
uses: actions/checkout@v4
8484

8585
- name: Get branch name
8686
shell: bash
8787
run: echo "GITHUB_BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
8888

89-
- uses: actions/download-artifact@v3
89+
- uses: actions/download-artifact@v4
9090
with:
9191
name: parca-debuginfo-dist-release
9292
path: goreleaser/dist
@@ -103,11 +103,11 @@ jobs:
103103
echo "${{ secrets.GITHUB_TOKEN }}" | podman login -u parca-dev --password-stdin ghcr.io
104104
105105
- name: Install cosign
106-
uses: sigstore/cosign-installer@09a077b27eb1310dcfb21981bee195b30ce09de0 # tag=v2.5.0
106+
uses: sigstore/cosign-installer@v3
107107

108108
- name: Install crane
109109
if: ${{ github.event_name != 'pull_request' }}
110-
uses: imjasonh/setup-crane@e82f1b9a8007d399333baba4d75915558e9fb6a4 # tag=v0.2
110+
uses: imjasonh/setup-crane@v0.4
111111

112112
- name: Push container
113113
if: ${{ github.event_name != 'pull_request' }}

cmd/parca-debuginfo/main.go

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ type flags struct {
7070
Extract struct {
7171
OutputDir string `kong:"help='Output directory path to use for extracted debug information files.',default='out'"`
7272

73-
Paths []string `kong:"required,arg,name='path',help='Paths to extract debug information.',type:'path'"`
74-
CompressDWARFSections bool `kong:"default=false,help:'Compress debuginfo files DWARF sections before uploading.'"`
73+
Paths []string `kong:"required,arg,name='path',help='Paths to extract debug information.',type:'path'"`
7574
} `cmd:"" help:"Extract debug information."`
7675

7776
Buildid struct {
@@ -93,19 +92,7 @@ func main() {
9392
}
9493
}
9594

96-
type uploadInfo struct {
97-
buildID string
98-
path string
99-
reader io.ReadSeeker
100-
size int64
101-
}
102-
10395
func run(kongCtx *kong.Context, flags flags) error {
104-
opts := []elfwriter.Option{}
105-
if flags.Extract.CompressDWARFSections {
106-
opts = append(opts, elfwriter.WithCompressDWARFSections())
107-
}
108-
10996
var g grun.Group
11097
ctx, cancel := context.WithCancel(context.Background())
11198
switch kongCtx.Command() {
@@ -198,12 +185,12 @@ func run(kongCtx *kong.Context, flags flags) error {
198185
return fmt.Errorf("check if upload should be initiated for %q with Build ID %q: %w", flags.Upload.Path, buildID, err)
199186
}
200187
if !shouldInitiate.ShouldInitiateUpload {
201-
fmt.Fprintf(os.Stdout, "Skipping upload of %q with Build ID %q as the store instructed not to: %s\n", flags.Upload.Path, buildID, shouldInitiate.Reason)
188+
fmt.Fprintf(os.Stdout, "Skipping upload of %q with Build ID %q as the store instructed not to: %s\n", flags.Upload.Path, buildID, shouldInitiate.GetReason())
202189
return nil
203190
}
204191

205192
if flags.Upload.NoInitiate {
206-
fmt.Fprintf(os.Stdout, "Not initiating upload of %q with Build ID %q as requested, but would have requested that next, because: %s\n", flags.Upload.Path, buildID, shouldInitiate.Reason)
193+
fmt.Fprintf(os.Stdout, "Not initiating upload of %q with Build ID %q as requested, but would have requested that next, because: %s\n", flags.Upload.Path, buildID, shouldInitiate.GetReason())
207194
return nil
208195
}
209196

@@ -228,32 +215,32 @@ func run(kongCtx *kong.Context, flags flags) error {
228215
}
229216

230217
if flags.LogLevel == LogLevelDebug {
231-
fmt.Fprintf(os.Stdout, "Upload instructions\nBuildID: %s\nUploadID: %s\nUploadStrategy: %s\nSignedURL: %s\nType: %s\n", initiationResp.UploadInstructions.BuildId, initiationResp.UploadInstructions.UploadId, initiationResp.UploadInstructions.UploadStrategy.String(), initiationResp.UploadInstructions.SignedUrl, initiationResp.UploadInstructions.Type)
218+
fmt.Fprintf(os.Stdout, "Upload instructions\nBuildID: %s\nUploadID: %s\nUploadStrategy: %s\nSignedURL: %s\nType: %s\n", initiationResp.GetUploadInstructions().GetBuildId(), initiationResp.GetUploadInstructions().GetUploadId(), initiationResp.GetUploadInstructions().GetUploadStrategy().String(), initiationResp.GetUploadInstructions().GetSignedUrl(), initiationResp.GetUploadInstructions().GetType())
232219
}
233220

234221
switch initiationResp.UploadInstructions.UploadStrategy {
235222
case debuginfopb.UploadInstructions_UPLOAD_STRATEGY_GRPC:
236223
if flags.LogLevel == LogLevelDebug {
237224
fmt.Fprintf(os.Stdout, "Performing a gRPC upload for %q with Build ID %q.", flags.Upload.Path, buildID)
238225
}
239-
_, err = grpcUploadClient.Upload(ctx, initiationResp.UploadInstructions, reader)
226+
_, err = grpcUploadClient.Upload(ctx, initiationResp.GetUploadInstructions(), reader)
240227
case debuginfopb.UploadInstructions_UPLOAD_STRATEGY_SIGNED_URL:
241228
if flags.LogLevel == LogLevelDebug {
242229
fmt.Fprintf(os.Stdout, "Performing a signed URL upload for %q with Build ID %q.", flags.Upload.Path, buildID)
243230
}
244-
err = uploadViaSignedURL(ctx, initiationResp.UploadInstructions.SignedUrl, reader)
231+
err = uploadViaSignedURL(ctx, initiationResp.GetUploadInstructions().GetSignedUrl(), reader)
245232
case debuginfopb.UploadInstructions_UPLOAD_STRATEGY_UNSPECIFIED:
246233
err = errors.New("no upload strategy specified")
247234
default:
248-
err = fmt.Errorf("unknown upload strategy: %v", initiationResp.UploadInstructions.UploadStrategy)
235+
err = fmt.Errorf("unknown upload strategy: %v", initiationResp.GetUploadInstructions().GetUploadStrategy())
249236
}
250237
if err != nil {
251238
return fmt.Errorf("upload %q with Build ID %q: %w", flags.Upload.Path, buildID, err)
252239
}
253240

254241
_, err = debuginfoClient.MarkUploadFinished(ctx, &debuginfopb.MarkUploadFinishedRequest{
255242
BuildId: buildID,
256-
UploadId: initiationResp.UploadInstructions.UploadId,
243+
UploadId: initiationResp.GetUploadInstructions().GetUploadId(),
257244
Type: debuginfoTypeStringToPb(flags.Upload.Type),
258245
})
259246
if err != nil {
@@ -475,7 +462,7 @@ func grpcConn(reg prometheus.Registerer, flags flags) (*grpc.ClientConn, error)
475462
}))
476463
}
477464

478-
return grpc.Dial(flags.Upload.StoreAddress, opts...)
465+
return grpc.NewClient(flags.Upload.StoreAddress, opts...)
479466
}
480467

481468
type perRequestBearerToken struct {
@@ -547,17 +534,17 @@ func getSectionData(elfFile *elf.File, sectionName string) ([]byte, error) {
547534
}
548535
data, err := section.Data()
549536
if err != nil {
550-
return nil, fmt.Errorf("failed to read data from section %s: %v", sectionName, err)
537+
return nil, fmt.Errorf("failed to read data from section %s: %w", sectionName, err)
551538
}
552539
return data, nil
553540
}
554541

555542
// getBuildIDFromNotes returns the build ID from an ELF notes section data.
556543
func getBuildIDFromNotes(notes []byte) (string, error) {
557544
// 0x3 is the "Build ID" type. Not sure where this is standardized.
558-
buildID, found, err := getNoteHexString(notes, "GNU", 0x3)
545+
buildID, found, err := getNoteHexString(notes, "GNU", 0x3) //nolint:mnd
559546
if err != nil {
560-
return "", fmt.Errorf("could not determine BuildID: %v", err)
547+
return "", fmt.Errorf("could not determine BuildID: %w", err)
561548
}
562549
if !found {
563550
return "", ErrNoBuildID
@@ -567,8 +554,7 @@ func getBuildIDFromNotes(notes []byte) (string, error) {
567554

568555
// getNoteHexString returns the hex string contents of an ELF note from a note section, as described
569556
// in the ELF standard in Figure 2-3.
570-
func getNoteHexString(sectionBytes []byte, name string, noteType uint32) (
571-
noteHexString string, found bool, err error) {
557+
func getNoteHexString(sectionBytes []byte, name string, noteType uint32) (string, bool, error) {
572558
// The data stored inside ELF notes is made of one or multiple structs, containing the
573559
// following fields:
574560
// - namesz // 32-bit, size of "name"
@@ -579,23 +565,23 @@ func getNoteHexString(sectionBytes []byte, name string, noteType uint32) (
579565
// Because of this structure, the information of the build id starts at the 17th byte.
580566

581567
// Null terminated string
582-
nameBytes := append([]byte(name), 0x0)
583-
noteTypeBytes := make([]byte, 4)
568+
nameBytes := append([]byte(name), 0x0) //nolint:mnd
569+
noteTypeBytes := make([]byte, 4) //nolint:mnd
584570

585571
binary.LittleEndian.PutUint32(noteTypeBytes, noteType)
586-
noteHeader := append(noteTypeBytes, nameBytes...) //nolint:gocritic
572+
noteHeader := append(noteTypeBytes, nameBytes...) //nolint:gocritic,makezero
587573

588574
// Try to find the note in the section
589575
idx := bytes.Index(sectionBytes, noteHeader)
590576
if idx == -1 {
591577
return "", false, nil
592578
}
593-
if idx < 4 { // there needs to be room for descsz
579+
if idx < 4 { //nolint:mnd there needs to be room for descsz
594580
return "", false, errors.New("could not read note data size")
595581
}
596582

597583
idxDataStart := idx + len(noteHeader)
598-
idxDataStart += (4 - (idxDataStart & 3)) & 3 // data is 32bit-aligned, round up
584+
idxDataStart += (4 - (idxDataStart & 3)) & 3 //nolint:mnd data is 32bit-aligned, round up
599585

600586
// read descsz and compute the last index of the note data
601587
dataSize := binary.LittleEndian.Uint32(sectionBytes[idx-4 : idx])

0 commit comments

Comments
 (0)