use a static build using musl on alpine to avoid dynamic loading issues that happen with NSS libraries on glibc
Some checks failed
Lint / golangci-lint (push) Failing after 10m23s
Declarative Tests / test (push) Failing after 12s
Declarative Tests / build-fedora (push) Failing after 1m58s
Declarative Tests / build-ubuntu-focal (push) Failing after 2m51s

This commit is contained in:
Matthew Rich 2024-09-27 02:17:07 +00:00
parent 27ab3711a6
commit 88fe584fe1

View File

@ -1,6 +1,9 @@
export PATH := $(PATH):$(HOME)/go/bin
IMAGE?=fedora:latest
#LDFLAGS?=--ldflags '-extldflags "-static -ldl -lc -lm"' --ldflags="-X 'main.commit=$(shell git rev-parse HEAD)' -X 'main.version=$(shell git describe --tags)' -X 'main.date=$(shell date '+%Y-%m-%d %T.%s%z')'"
export CC?=muscl-gcc
LDFLAGS?=--ldflags '-extldflags "-static"' --ldflags="-X 'main.commit=$(shell git rev-parse HEAD)' -X 'main.version=$(shell git describe --tags)' -X 'main.date=$(shell date '+%Y-%m-%d %T.%s%z')'"
export CGO_ENABLED=0
export CGO_ENABLED=1
VERSION?=$(shell git describe --tags | sed -e 's/^v//' -e 's/-/_/g')
.PHONY=jx-cli
@ -13,7 +16,7 @@ test: jx-cli
go test -coverprofile=artifacts/coverage.profile ./...
go tool cover -html=artifacts/coverage.profile -o artifacts/code-coverage.html
fedora-deps:
dnf install -y nodejs git dnf-plugins-core rpm-build rpmdevtools
./jx apply build/rpm.jx.yaml
spectool -g -R build/jx.spec
curl -L -o - https://go.dev/dl/go1.22.3.linux-amd64.tar.gz | tar -zxvf -
rpm: fedora-deps
@ -26,10 +29,15 @@ ubuntu-deps:
deb: ubuntu-deps
:
run:
docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v $(HOME)/.gitconfig:/root/.gitconfig -v $(shell pwd):/src $(IMAGE) sh
docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -v $(shell pwd):/src $(IMAGE) sh
run-alpine:
docker run -it -v $(HOME)/.git-credentials:/root/.git-credentials -v $(HOME)/.gitconfig:/root/.gitconfig -v /var/run/docker.sock:/var/run/docker.sock -v $(shell pwd):/src golang:1.22.6-alpine sh
clean:
go clean -modcache
rm jx
go-deps:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
lint:
golangci-lint run --verbose ./...
vulncheck: