Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ env:
- GO111MODULE=on
- GOPROXY=https://proxy.golang.org|direct
- REPO=github.com/operator-framework/operator-sdk
- GO_BUILD_TAGS=containers_image_openpgp

# Hooks to run before any build is run.
before:
Expand All @@ -18,6 +19,9 @@ builds:
main: ./cmd/operator-sdk
binary: operator-sdk
mod_timestamp: "{{ .CommitTimestamp }}"
# containers_image_openpgp for containers/image
flags: &build-flags
- -tags=containers_image_openpgp
asmflags: &build-asmflags
- all=-trimpath={{ .Env.PWD }}
gcflags: &build-gcflags
Expand All @@ -41,6 +45,7 @@ builds:
main: ./cmd/helm-operator
binary: helm-operator
mod_timestamp: "{{ .CommitTimestamp }}"
flags: *build-flags
asmflags: *build-asmflags
gcflags: *build-gcflags
ldflags: *build-ldflags
Expand Down
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ GO_BUILD_ARGS = \
-X '$(REPO)/internal/version.KubernetesVersion=v$(K8S_VERSION)' \
-X '$(REPO)/internal/version.ImageVersion=$(IMAGE_VERSION)' \
" \
# containers_image_openpgp for containers/image
GO_BUILD_TAGS = containers_image_openpgp

export GO111MODULE = on
export CGO_ENABLED = 0
Expand All @@ -39,7 +41,7 @@ export PATH := $(PWD)/$(BUILD_DIR):$(PWD)/$(TOOLS_DIR):$(PATH)
generate: build # Generate CLI docs and samples
rm -rf testdata
$(GO) run ./hack/generate/cncf-maintainers/main.go
$(GO) run ./hack/generate/cli-doc/gen-cli-doc.go
$(GO) run -tags=$(GO_BUILD_TAGS) ./hack/generate/cli-doc/gen-cli-doc.go
$(GO) run ./hack/generate/samples/generate_testdata.go
$(GO) generate ./...

Expand All @@ -54,15 +56,15 @@ fix: ## Fixup files in the repo.
$(GO) mod tidy
$(GO) fmt ./...
make setup-lint
$(TOOLS_DIR)/golangci-lint run --fix
$(TOOLS_DIR)/golangci-lint run --fix --build-tags $(GO_BUILD_TAGS)

.PHONY: setup-lint
setup-lint: ## Setup the lint
$(SCRIPTS_DIR)/fetch golangci-lint 1.64.8

.PHONY: lint
lint: setup-lint ## Run the lint check
$(TOOLS_DIR)/golangci-lint run
$(TOOLS_DIR)/golangci-lint run --build-tags $(GO_BUILD_TAGS)


.PHONY: clean
Expand All @@ -89,11 +91,11 @@ install: ## Install operator-sdk and helm-operator.
.PHONY: build
build: ## Build operator-sdk and helm-operator.
@mkdir -p $(BUILD_DIR)
$(GO) build $(GO_BUILD_ARGS) -o $(BUILD_DIR) ./cmd/{operator-sdk,helm-operator}
$(GO) build $(GO_BUILD_ARGS) -tags=$(GO_BUILD_TAGS) -o $(BUILD_DIR) ./cmd/{operator-sdk,helm-operator}

.PHONY: build/operator-sdk build/helm-operator
build/operator-sdk build/helm-operator:
$(GO) build $(GO_BUILD_ARGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)
$(GO) build $(GO_BUILD_ARGS) -tags=$(GO_BUILD_TAGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)

# Build scorecard binaries.
.PHONY: build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests
Expand Down Expand Up @@ -151,7 +153,7 @@ test-sanity: generate fix ## Test repo formatting, linting, etc.
git diff --exit-code # fast-fail if generate or fix produced changes
./hack/check-license.sh
./hack/check-error-log-msg-format.sh
$(GO) vet ./...
$(GO) vet -tags=$(GO_BUILD_TAGS) ./...
make setup-lint
make lint
git diff --exit-code # diff again to ensure other checks don't change repo
Expand All @@ -165,7 +167,7 @@ test-docs: ## Test doc links
.PHONY: test-unit
TEST_PKGS = $(shell $(GO) list ./... | grep -v -E 'github.com/operator-framework/operator-sdk/test/')
test-unit: ## Run unit tests
$(GO) test -coverprofile=coverage.out -covermode=count -short $(TEST_PKGS)
$(GO) test -tags=$(GO_BUILD_TAGS) -coverprofile=coverage.out -covermode=count -short $(TEST_PKGS)

e2e_tests := test-e2e-go test-e2e-helm test-e2e-integration
e2e_targets := test-e2e $(e2e_tests)
Expand Down
Loading