Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
fix: go builds
Browse files Browse the repository at this point in the history
Signed-off-by: András Jáky <[email protected]>

ci: fix?

Signed-off-by: András Jáky <[email protected]>
  • Loading branch information
akijakya committed Feb 26, 2024
1 parent a73446b commit f52a184
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
VERSION: ${{ inputs.image_tag }}
BUILD_TIMESTAMP: ${{ inputs.timestamp }}
COMMIT_HASH: ${{ github.sha }}
BUILD_OPTS: -tags=exclude_graphdriver_btrfs,exclude_graphdriver_devicemapper

- name: Export digest
if: inputs.push
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ VMCLARITY_TOOLS_BASE ?=
GO_VERSION ?= $(shell cat $(ROOT_DIR)/.go-version)
GO_BUILD_TAGS ?=

# Ignore unused C drivers for CIS Docker Benchmark libraries
GO_BUILD_TAGS += exclude_graphdriver_btrfs exclude_graphdriver_devicemapper

####
## Runtime variables
####
Expand Down Expand Up @@ -59,9 +62,7 @@ build: ui build-all-go ## Build all components
build-all-go: bin/vmclarity-apiserver bin/vmclarity-cli bin/vmclarity-orchestrator bin/vmclarity-ui-backend bin/vmclarity-cr-discovery-server ## Build all go components

BUILD_OPTS = -race
ifneq ($(GO_BUILD_TAGS),)
BUILD_OPTS += -tags $(GO_BUILD_TAGS)
endif
BUILD_OPTS += -tags="$(GO_BUILD_TAGS)"

LDFLAGS = -s -w
LDFLAGS += -X 'github.com/openclarity/vmclarity/core/version.Version=$(VERSION)'
Expand Down Expand Up @@ -135,7 +136,7 @@ FIXGOMODULES = $(addprefix fix-, $(GOMODULES))

.PHONY: $(LINTGOMODULES)
$(LINTGOMODULES):
cd $(@:lint-%=%) && "$(GOLANGCI_BIN)" run -c "$(GOLANGCI_CONFIG)"
cd $(@:lint-%=%) && "$(GOLANGCI_BIN)" run --build-tags "$(GO_BUILD_TAGS)" -c "$(GOLANGCI_CONFIG)"

.PHONY: $(FIXGOMODULES)
$(FIXGOMODULES):
Expand Down Expand Up @@ -207,6 +208,7 @@ lint-helm: ## Lint Helm charts
docker run --rm --workdir /workdir --volume "$(ROOT_DIR):/workdir" quay.io/helmpack/chart-testing:v3.8.0 ct lint --all

GOTEST_OPTS := -failfast -timeout 30m -short
GOTEST_OPTS += -tags="$(GO_BUILD_TAGS)"
ifeq ($(CI),true)
GOTEST_OPTS += -v
endif
Expand All @@ -219,10 +221,11 @@ $(TESTGOMODULES):
.PHONY: test
test: $(TESTGOMODULES) ## Run Go unit tests

GOVET_OPTS := -tags="$(GO_BUILD_TAGS)"
VETGOMODULES = $(addprefix vet-, $(GOMODULES))

$(VETGOMODULES):
go -C $(@:vet-%=%) vet ./...
go -C $(@:vet-%=%) vet $(GOVET_OPTS) ./...

.PHONY: vet
vet: $(VETGOMODULES) ## Run go vet for modules
Expand Down

0 comments on commit f52a184

Please sign in to comment.