Skip to content

Commit

Permalink
Merge pull request #24 from parca-dev/common-buildid
Browse files Browse the repository at this point in the history
Use same build ID retrieval mechanism as the agent
  • Loading branch information
brancz authored Jan 21, 2025
2 parents 2aed700 + ab30c8c commit 3481845
Show file tree
Hide file tree
Showing 11 changed files with 451 additions and 687 deletions.
16 changes: 4 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ on:
pull_request:
branches: [ main ]

env:
# renovate: datasource=go depName=mvdan.cc/gofumpt
GOFUMPT_VERSION: v0.3.1
# renovate: datasource=go depName=github.com/golangci/golangci-lint
GOLANGCI_LINT_VERSION: v1.53.3

jobs:
skip-check:
name: Skip check
Expand All @@ -24,7 +18,7 @@ jobs:
contents: read
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
uses: fkirc/skip-duplicate-actions@v5
with:
do_not_skip: '["schedule", "workflow_dispatch"]'
paths: |-
Expand All @@ -44,10 +38,10 @@ jobs:
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- name: Check out the code
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
Expand All @@ -69,6 +63,4 @@ jobs:
run: make vet

- name: Lint
uses: golangci/golangci-lint-action@0ad9a0988b3973e851ab0a07adf248ec2e100376 # tag=v3.3.1
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
uses: golangci/golangci-lint-action@v6
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ jobs:

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

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

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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0c670bbf0414f39666df6ce8e718ec5662c21e03 # tag=v2.1.17
uses: github/codeql-action/analyze@v3
135 changes: 0 additions & 135 deletions .github/workflows/container.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
contents: read
steps:
- id: skip-check
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
uses: fkirc/skip-duplicate-actions@v5
with:
do_not_skip: '["schedule", "workflow_dispatch"]'
paths: |-
Expand All @@ -38,10 +38,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
Expand Down
83 changes: 7 additions & 76 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,114 +8,45 @@ on:
permissions:
contents: write

env:
# renovate: datasource=go depName=github.com/goreleaser/goreleaser
GORELEASER_VERSION: v1.18.2

jobs:
binaries:
name: Goreleaser release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: ${{ env.GORELEASER_VERSION }}
args: release --clean --timeout=60m
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Archive generated artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
uses: actions/upload-artifact@v4
with:
name: parca-debuginfo-dist-release
if-no-files-found: error
path: |
goreleaser/dist
!goreleaser/dist/*.txt
dist/
docs:
name: Publish Docs
runs-on: ubuntu-latest
needs: binaries
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
- uses: actions/checkout@v4

- name: Publish Vercel
run: |
curl -X POST "https://api.vercel.com/v1/integrations/deploy/${{ secrets.VERCEL_WEBHOOK }}"
container:
name: Build and release container images
runs-on: ubuntu-latest
needs: binaries
container:
# https://github.com/containers/podman/tree/main/contrib/podmanimage
# Specifying SHA repeatedly fails:
# @sha256:421ac576cebff98e90c531e7b9ce4482370ecc7cee59abc2341714031bfb5f43
image: quay.io/containers/podman:v4.1.1
options: >-
--device /dev/fuse:rw
--privileged
--security-opt label=disable
--security-opt seccomp=unconfined
permissions:
id-token: write
packages: write
contents: read
steps:
- name: Install dependencies
run: dnf install --assumeyes --repo fedora git make jq

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

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

- uses: actions/download-artifact@v3
with:
name: parca-debuginfo-dist-release
path: goreleaser/dist

- name: Build container
run: make container

- name: Check images are created
run: podman images | grep 'ghcr.io/parca-dev/parca-debuginfo'

- name: Login to registry
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | podman login -u parca-dev --password-stdin ghcr.io
- name: Install cosign
uses: sigstore/cosign-installer@09a077b27eb1310dcfb21981bee195b30ce09de0 # tag=v2.5.0

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

- name: Push container
if: ${{ github.event_name != 'pull_request' }}
run: |
make push-container
- name: Sign container
env:
COSIGN_EXPERIMENTAL: true
run: |
make sign-container
11 changes: 2 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,21 @@ linters:
- style
- unused
disable:
- exhaustivestruct
- exhaustruct
- funlen
- gci
- gochecknoglobals
- godox
- goerr113
- golint
- gomnd
- gomoddirectives
- interfacer
- ireturn
- lll
- maligned
- nlreturn
- paralleltest
- scopelint
- testpackage
- varnamelen
- wrapcheck
- wsl
- nosnakecase
- err113

issues:
exclude-rules:
Expand All @@ -56,7 +49,7 @@ linters-settings:
- pkg: github.com/pkg/errors
desc: Use fmt.Errorf instead
errcheck:
exclude: ./.errcheck_excludes.txt
exclude-functions: ./.errcheck_excludes.txt
goimports:
local-prefixes: github.com/parca-dev/parca-debuginfo
gofumpt:
Expand Down
Loading

0 comments on commit 3481845

Please sign in to comment.