Adjusting with latest changes

This commit is contained in:
Areg Vrtanesyan 2025-09-17 16:03:24 +01:00
parent 0de8a73541
commit 098a12eb9b
1 changed files with 39 additions and 11 deletions

View File

@ -24,7 +24,13 @@ else
DEB_PACKAGE_NAME := $(BINARY_NAME) DEB_PACKAGE_NAME := $(BINARY_NAME)
endif endif
DATE := $(shell date -u -r RELEASE_NOTES '+%Y-%m-%d-%H%M UTC') # Use git in windows since we don't have access to the `date` tool
ifeq ($(TARGET_OS), windows)
DATE := $(shell git log -1 --format="%ad" --date=format-local:'%Y-%m-%dT%H:%M UTC' -- RELEASE_NOTES)
else
DATE := $(shell date -u -r RELEASE_NOTES '+%Y-%m-%d-%H:%M UTC')
endif
VERSION_FLAGS := -X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)" VERSION_FLAGS := -X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"
ifdef PACKAGE_MANAGER ifdef PACKAGE_MANAGER
VERSION_FLAGS := $(VERSION_FLAGS) -X "github.com/cloudflare/cloudflared/cmd/cloudflared/updater.BuiltForPackageManager=$(PACKAGE_MANAGER)" VERSION_FLAGS := $(VERSION_FLAGS) -X "github.com/cloudflare/cloudflared/cmd/cloudflared/updater.BuiltForPackageManager=$(PACKAGE_MANAGER)"
@ -67,6 +73,8 @@ else ifeq ($(LOCAL_ARCH),x86_64)
TARGET_ARCH ?= amd64 TARGET_ARCH ?= amd64
else ifeq ($(LOCAL_ARCH),amd64) else ifeq ($(LOCAL_ARCH),amd64)
TARGET_ARCH ?= amd64 TARGET_ARCH ?= amd64
else ifeq ($(LOCAL_ARCH),386)
TARGET_ARCH ?= 386
else ifeq ($(LOCAL_ARCH),i686) else ifeq ($(LOCAL_ARCH),i686)
TARGET_ARCH ?= amd64 TARGET_ARCH ?= amd64
else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv8) else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv8)
@ -123,6 +131,8 @@ endif
#for FIPS compliance, FPM defaults to MD5. #for FIPS compliance, FPM defaults to MD5.
RPM_DIGEST := --rpm-digest sha256 RPM_DIGEST := --rpm-digest sha256
GO_TEST_LOG_OUTPUT = /tmp/gotest.log
.PHONY: all .PHONY: all
all: cloudflared test all: cloudflared test
@ -132,7 +142,7 @@ clean:
.PHONY: vulncheck .PHONY: vulncheck
vulncheck: vulncheck:
@govulncheck ./... @go run -mod=readonly golang.org/x/vuln/cmd/govulncheck@latest ./...
.PHONY: cloudflared .PHONY: cloudflared
cloudflared: cloudflared:
@ -155,11 +165,9 @@ generate-docker-version:
.PHONY: test .PHONY: test
test: vet test: vet
ifndef CI $Q go test -json -v -mod=vendor -race $(LDFLAGS) ./... 2>&1 | tee $(GO_TEST_LOG_OUTPUT)
go test -v -mod=vendor -race $(LDFLAGS) ./... ifneq ($(FIPS), true)
else @go run -mod=readonly github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest -input $(GO_TEST_LOG_OUTPUT)
@mkdir -p .cover
go test -v -mod=vendor -race $(LDFLAGS) -coverprofile=".cover/c.out" ./...
endif endif
.PHONY: cover .PHONY: cover
@ -233,8 +241,8 @@ github-release:
python3 github_release.py --path $(PWD)/built_artifacts --release-version $(VERSION) python3 github_release.py --path $(PWD)/built_artifacts --release-version $(VERSION)
python3 github_message.py --release-version $(VERSION) python3 github_message.py --release-version $(VERSION)
.PHONY: macos-release .PHONY: gitlab-release
macos-release: gitlab-release:
python3 github_release.py --path $(PWD)/artifacts/ --release-version $(VERSION) python3 github_release.py --path $(PWD)/artifacts/ --release-version $(VERSION)
.PHONY: r2-linux-release .PHONY: r2-linux-release
@ -249,7 +257,7 @@ capnp:
.PHONY: vet .PHONY: vet
vet: vet:
go vet -mod=vendor github.com/cloudflare/cloudflared/... $Q go vet -mod=vendor github.com/cloudflare/cloudflared/...
.PHONY: fmt .PHONY: fmt
fmt: fmt:
@ -258,7 +266,7 @@ fmt:
.PHONY: fmt-check .PHONY: fmt-check
fmt-check: fmt-check:
@./fmt-check.sh @./.ci/scripts/fmt-check.sh
.PHONY: lint .PHONY: lint
lint: lint:
@ -267,3 +275,23 @@ lint:
.PHONY: mocks .PHONY: mocks
mocks: mocks:
go generate mocks/mockgen.go go generate mocks/mockgen.go
.PHONY: ci-build
ci-build:
@GOOS=linux GOARCH=amd64 $(MAKE) cloudflared
@mkdir -p artifacts
@mv cloudflared artifacts/cloudflared
.PHONY: ci-fips-build
ci-fips-build:
@FIPS=true GOOS=linux GOARCH=amd64 $(MAKE) cloudflared
@mkdir -p artifacts
@mv cloudflared artifacts/cloudflared
.PHONY: ci-test
ci-test: fmt-check lint test
@go run -mod=readonly github.com/jstemmer/go-junit-report/v2@latest -in $(GO_TEST_LOG_OUTPUT) -parser gojson -out report.xml -set-exit-code
.PHONY: ci-fips-test
ci-fips-test:
@FIPS=true $(MAKE) ci-test