Skip to content

Commit 3472f03

Browse files
committed
Address review issues
Signed-off-by: Kemal Akkoyun <[email protected]>
1 parent cf011c0 commit 3472f03

7 files changed

+35
-163
lines changed

.github/workflows/build.yml

+6-9
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,15 @@ jobs:
9999
- name: Test
100100
run: make test ENABLE_RACE=yes
101101

102-
- name: Install gofumpt
103-
run: go install mvdan.cc/gofumpt@${{ env.GOFUMPT_VERSION }}
104-
105102
- name: Format
106103
run: |
107104
make format
108105
git diff --exit-code
109106
110-
- name: Install golangci-lint
111-
run: |
112-
curl -sSfL 'https://raw.githubusercontent.com/golangci/golangci-lint/${{ env.GOLANGCI_LINT_VERSION }}/install.sh' \
113-
| sh -s -- -b "$(go env GOPATH)/bin" '${{ env.GOLANGCI_LINT_VERSION }}'
114-
115107
- name: Vet
116-
run: make vet lint
108+
run: make vet
109+
110+
- name: Lint
111+
uses: golangci/golangci-lint-action@537aa1903e5d359d0b27dbc19ddd22c5087f3fbc # tag=v3.2.0
112+
with:
113+
version: ${{ env.GOLANGCI_LINT_VERSION }}

.github/workflows/container.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,19 @@ jobs:
9595
path: pkg/profiler/cpu-profiler.bpf.o
9696
if-no-files-found: error
9797

98+
- name: Validate
99+
uses: goreleaser/goreleaser-action@68acf3b1adf004ac9c2f0a4259e85c5f66e99bef # tag=v3.0.0
100+
with:
101+
distribution: goreleaser
102+
version: ${{ env.GORELEASER_VERSION }}
103+
args: check
104+
98105
build-binaries:
99106
name: Build binaries using goreleaser
100107
runs-on: ubuntu-latest
101108
needs: build-dependencies
102109
container:
103-
image: goreleaser/goreleaser-cross:v1.18.3 # ${{ env.GORELEASER_CROSS_VERSION }}
110+
image: docker.io/goreleaser/goreleaser-cross:v1.18.3
104111
options: --privileged
105112
env:
106113
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -127,7 +134,7 @@ jobs:
127134
path: pkg/profiler/cpu-profiler.bpf.o
128135

129136
- name: Run Goreleaser
130-
run: goreleaser build --rm-dist --skip-validate --snapshot
137+
run: goreleaser release --rm-dist --skip-validate --skip-publish --snapshot --debug
131138

132139
- name: Archive generated artifacts
133140
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
@@ -145,7 +152,7 @@ jobs:
145152
runs-on: ubuntu-latest
146153
container:
147154
# https://github.com/containers/podman/tree/main/contrib/podmanimage
148-
image: quay.io/containers/podman:v4.1.1@sha256:0e3ae4bd8ab6967eeeec2e3dfc51106112f34068027ab4087c21313135641634
155+
image: quay.io/containers/podman:v4.1.1@sha256:421ac576cebff98e90c531e7b9ce4482370ecc7cee59abc2341714031bfb5f43
149156
options: >-
150157
--device /dev/fuse:rw
151158
--privileged

.github/workflows/release-dry-run.yml

-137
This file was deleted.

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
needs: dependencies
6464
if: startsWith(github.ref, 'refs/tags/')
6565
container:
66-
image: goreleaser/goreleaser-cross:v1.18.3 # ${{ env.GORELEASER_CROSS_VERSION }}
66+
image: docker.io/goreleaser/goreleaser-cross:v1.18.3
6767
options: --privileged
6868
env:
6969
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -154,7 +154,7 @@ jobs:
154154
needs: binaries
155155
container:
156156
# https://github.com/containers/podman/tree/main/contrib/podmanimage
157-
image: quay.io/containers/podman:v4.1.1@sha256:0e3ae4bd8ab6967eeeec2e3dfc51106112f34068027ab4087c21313135641634
157+
image: quay.io/containers/podman:v4.1.1@sha256:421ac576cebff98e90c531e7b9ce4482370ecc7cee59abc2341714031bfb5f43
158158
options: >-
159159
--device /dev/fuse:rw
160160
--privileged

Dockerfile

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
FROM --platform="${BUILDPLATFORM:-linux/amd64}" docker.io/golang:1.18.3-bullseye@sha256:d146bc2ee9b0691f4f787bd9a8bf12e3c01a4618ea982d11fe9401b86211e2a7 AS builder
2-
RUN mkdir /.cache && chown nobody:nogroup /.cache && touch -t 202101010000.00 /.cache
1+
FROM --platform="${BUILDPLATFORM:-linux/amd64}" docker.io/library/busybox:1.35.0 as builder
2+
RUN mkdir /.cache && touch -t 202101010000.00 /.cache
3+
4+
ARG TARGETOS=linux
5+
ARG TARGETARCH=amd64
6+
ARG TARGETVARIANT
37

48
WORKDIR /app
9+
COPY dist dist
510

6-
COPY ./dist /app/dist
7-
RUN if [ "amd64" = "$(go env GOARCH)" ]; then \
8-
cp "dist/parca-agent-amd64_$(go env GOOS)_$(go env GOARCH)_$(go env GOAMD64)/parca-agent" parca-agent; \
11+
# NOTICE: See goreleaser.yml for the build paths.
12+
RUN if [ "${TARGETARCH}" == 'amd64' ]; then \
13+
cp "dist/parca-agent-${TARGETARCH}_${TARGETOS}_${TARGETARCH}_${TARGETVARIANT:-v1}/parca-agent" . ; \
14+
elif [ "${TARGETARCH}" == 'arm' ]; then \
15+
cp "dist/parca-agent-${TARGETARCH}_${TARGETOS}_${TARGETARCH}_${TARGETVARIANT##v}/parca-agent" . ; \
916
else \
10-
cp "dist/parca-agent-arm64_$(go env GOOS)_$(go env GOARCH)/parca-agent" parca-agent; \
17+
cp "dist/parca-agent-${TARGETARCH}_${TARGETOS}_${TARGETARCH}/parca-agent" . ; \
1118
fi
1219

1320
FROM --platform="${TARGETPLATFORM:-linux/amd64}" gcr.io/distroless/static@sha256:2ad95019a0cbf07e0f917134f97dd859aaccc09258eb94edcb91674b3c1f448f

Dockerfile.cross-builder

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG GOLANG_CROSS_VERSION
2-
FROM --platform="${BUILDPLATFORM:-linux/amd64}" goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION}
2+
FROM --platform="${BUILDPLATFORM:-linux/amd64}" docker.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION}
33

44
RUN apt-get update -y && \
55
apt-get install -yq libelf-dev zlib1g-dev \

Makefile

+3-5
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ else
3636
endif
3737
VERSION ?= $(if $(RELEASE_TAG),$(RELEASE_TAG),$(shell $(CMD_GIT) describe --tags 2>/dev/null || echo '$(BRANCH)$(COMMIT)'))
3838

39-
# renovate: datasource=go depName=github.com/goreleaser/goreleaser-cross
39+
# renovate: datasource=docker depName=docker.io/goreleaser/goreleaser-cross
4040
GOLANG_CROSS_VERSION := v1.18.3
4141

4242
# inputs and outputs:
@@ -45,7 +45,6 @@ GO_SRC := $(shell find . -type f -name '*.go')
4545
OUT_BIN := $(OUT_DIR)/parca-agent
4646
OUT_BIN_DEBUG_INFO := $(OUT_DIR)/debug-info
4747
OUT_DOCKER ?= ghcr.io/parca-dev/parca-agent
48-
# TODO(kakkoyun): Consider creating parca-dev/cross-builder repo.
4948
DOCKER_BUILDER ?= parca-dev/cross-builder
5049

5150
LIBBPF_SRC := 3rdparty/libbpf/src
@@ -203,7 +202,6 @@ bpf/fmt:
203202

204203
.PHONY: go/fmt
205204
go/fmt:
206-
gofumpt -l -w $(shell $(GO) list ./... | grep -E -v "internal/pprof|internal/go" | sed 's#^github.com/parca-dev/parca-agent/##')
207205
$(GO) fmt $(shell $(GO) list ./... | grep -E -v "internal/pprof|internal/go")
208206

209207
.PHONY: vet
@@ -316,7 +314,7 @@ release-dry-run: $(DOCKER_BUILDER) bpf
316314
--rm \
317315
--privileged \
318316
-v /var/run/docker.sock:/var/run/docker.sock \
319-
-v `pwd`:/__w/parca-agent/parca-agent \
317+
-v "$(PWD):/__w/parca-agent/parca-agent" \
320318
-w /__w/parca-agent/parca-agent \
321319
$(DOCKER_BUILDER):$(GOLANG_CROSS_VERSION) \
322320
release --rm-dist --auto-snapshot --skip-validate --skip-publish --debug
@@ -327,7 +325,7 @@ release-build: $(DOCKER_BUILDER) bpf
327325
--rm \
328326
--privileged \
329327
-v /var/run/docker.sock:/var/run/docker.sock \
330-
-v `pwd`:/__w/parca-agent/parca-agent \
328+
-v "$(PWD):/__w/parca-agent/parca-agent" \
331329
-w /__w/parca-agent/parca-agent \
332330
$(DOCKER_BUILDER):$(GOLANG_CROSS_VERSION) \
333331
build --rm-dist --skip-validate --snapshot --debug

0 commit comments

Comments
 (0)