Skip to content

Commit

Permalink
chore: update deps (#588)
Browse files Browse the repository at this point in the history
chore: update deps



feat: reduce test matrix

Signed-off-by: Bence Csati <[email protected]>
  • Loading branch information
csatib02 authored Sep 24, 2024
1 parent ab6fd4f commit d2c0bb4
Show file tree
Hide file tree
Showing 8 changed files with 434 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
run: nix develop --impure .#ci

- name: Lint
run: nix develop --impure .#ci -c make lint
run: nix develop --impure .#ci -c make lint -j

license-check:
name: License check
Expand Down
15 changes: 13 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
run:
timeout: 10m
skip-dirs:

issues:
exclude-dirs:
- pkg/apis

# TODO: fixme
Expand All @@ -17,16 +19,25 @@ linters-settings:
misspell:
locale: US
nolintlint:
allow-leading-space: false # require machine-readable nolint directives (with no leading space)
allow-unused: false # report any unused nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
revive:
confidence: 0

linters:
enable:
- bodyclose
- errcheck
- gci
- gofmt
- gofumpt
- goimports
- gosimple
- ineffassign
- misspell
- nolintlint
- revive
- unconvert
- unparam
- unused
- whitespace
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.5.0@sha256:0c6a569797744e45955f39d4f7538ac344bfb7ebf0a54006a0a4297b153ccf0f AS xx

FROM --platform=$BUILDPLATFORM golang:1.22.3-alpine3.18@sha256:d1a601b64de09e2fa38c95e55838961811d5ca11062a8f4230a5c434b3ae2a34 AS builder
FROM --platform=$BUILDPLATFORM golang:1.23.1-alpine3.20@sha256:ac67716dd016429be8d4c2c53a248d7bcdf06d34127d3dc451bda6aa5a87bc06 AS builder

COPY --from=xx / /

Expand Down
61 changes: 31 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
export PATH := $(abspath bin/):${PATH}

# Target image name
IMG ?= ghcr.io/bank-vaults/vault-operator:dev
CONTAINER_IMAGE_REF ?= ghcr.io/bank-vaults/vault-operator:dev

# Default test data
TEST_K8S_VERSION ?= 1.27.1
TEST_VAULT_VERSION ?= 1.14.8
TEST_BANK_VAULTS_VERSION ?= v1.31.1-softhsm
TEST_BANK_VAULTS_IMAGE ?= ghcr.io/bank-vaults/bank-vaults:$(TEST_BANK_VAULTS_VERSION)
TEST_OPERATOR_VERSION ?= $(lastword $(subst :, ,$(IMG)))
TEST_OPERATOR_VERSION ?= $(lastword $(subst :, ,$(CONTAINER_IMAGE_REF)))
TEST_KIND_CLUSTER ?= vault-operator

# Setting SHELL to bash allows bash commands to be executed by recipes.
Expand All @@ -31,7 +31,7 @@ help: ## Display this help
##@ Checks

.PHONY: check
check: lint test ## Run lint checks and tests
check: test lint## Run tests and lint checks

.PHONY: test
test: ## Run tests
Expand All @@ -49,7 +49,7 @@ lint: ## Run lint checks

.PHONY: lint-go
lint-go:
$(GOLANGCI_LINT_BIN) run $(if ${CI},--out-format github-actions,)
$(GOLANGCI_LINT_BIN) run $(if ${CI},--out-format colored-line-number,)

.PHONY: lint-helm
lint-helm:
Expand All @@ -63,15 +63,15 @@ lint-docker:
lint-yaml:
$(YAMLLINT_BIN) $(if ${CI},-f github,) --no-warnings .

.PHONY: fmt
fmt: ## Format code
$(GOLANGCI_LINT_BIN) run --fix

.PHONY: license-check
license-check: ## Run license check
$(LICENSEI_BIN) check
$(LICENSEI_BIN) header

.PHONY: fmt
fmt: ## Format code
$(GOLANGCI_LINT_BIN) run --fix

##@ Development

.PHONY: run
Expand All @@ -91,7 +91,7 @@ prepare-kind: ## Prepare kind cluster for development/testing
docker pull ghcr.io/bank-vaults/bank-vaults:$(TEST_BANK_VAULTS_VERSION)
docker pull hashicorp/vault:$(TEST_VAULT_VERSION)

$(KIND_BIN) load docker-image ${IMG} --name $(TEST_KIND_CLUSTER)
$(KIND_BIN) load docker-image ${CONTAINER_IMAGE_REF} --name $(TEST_KIND_CLUSTER)
$(KIND_BIN) load docker-image ghcr.io/bank-vaults/bank-vaults:$(TEST_BANK_VAULTS_VERSION) --name $(TEST_KIND_CLUSTER)
$(KIND_BIN) load docker-image hashicorp/vault:$(TEST_VAULT_VERSION) --name $(TEST_KIND_CLUSTER)

Expand All @@ -102,18 +102,22 @@ build: ## Build binary
@mkdir -p build
go build -race -o build/manager ./cmd

.PHONY: artifacts
artifacts: docker-build helm-chart
artifacts: ## Build docker image and helm chart

# If you wish built the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: docker-build
docker-build: ## Build docker image
docker build -t ${IMG} .
docker build -t ${CONTAINER_IMAGE_REF} .

# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
# architectures. (i.e. make docker-buildx CONTAINER_IMAGE_REF=myregistry/mypoperator:0.0.1). To use this option you need to:
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
# - be able to push the image for your registry (i.e. if you do not inform a valid value via CONTAINER_IMAGE_REF=<myregistry/image:<tag>> then the export will fail)
# To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
Expand All @@ -122,7 +126,7 @@ docker-buildx: ## Build docker image for cross-platform support
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
- docker buildx build --push --platform=$(PLATFORMS) --tag ${CONTAINER_IMAGE_REF} -f Dockerfile.cross .
- docker buildx rm project-v3-builder
rm Dockerfile.cross

Expand All @@ -131,12 +135,12 @@ helm-chart: ## Build helm chart
@mkdir -p build
$(HELM_BIN) package -d build/ deploy/charts/vault-operator

.PHONY: artifacts
artifacts: docker-build helm-chart
artifacts: ## Build docker image and helm chart

##@ Autogeneration

.PHONY: generate
generate: gen-manifests gen-code gen-helm-docs
generate: ## Generate manifests, code, and docs resources

.PHONY: gen-manifests
gen-manifests: ## Generate webhook, RBAC, and CRD resources
$(CONTROLLER_GEN_BIN) rbac:roleName=vault crd:maxDescLen=0 webhook paths="./..." \
Expand All @@ -154,10 +158,6 @@ gen-code: ## Generate deepcopy, client, lister, and informer objects
gen-helm-docs: ## Generate Helm chart documentation
$(HELM_DOCS_BIN) -s file -c deploy/charts/ -t README.md.gotmpl

.PHONY: generate
generate: gen-manifests gen-code gen-helm-docs
generate: ## Generate manifests, code, and docs resources

##@ Deployment

.PHONY: install
Expand All @@ -170,7 +170,7 @@ uninstall: gen-manifests ## Uninstall CRDs from the K8s cluster

.PHONY: deploy
deploy: gen-manifests ## Deploy resources to the K8s cluster
cd deploy/manager && $(PWD)/$(KUSTOMIZE_BIN) edit set image controller=${IMG}
cd deploy/manager && $(PWD)/$(KUSTOMIZE_BIN) edit set image controller=${CONTAINER_IMAGE_REF}
$(KUSTOMIZE_BIN) build deploy/default | kubectl apply -f -

.PHONY: undeploy
Expand All @@ -185,14 +185,15 @@ deps: bin/kurun bin/kustomize bin/licensei bin/setup-envtest
deps: ## Install dependencies

# Dependency versions
GOLANGCI_VERSION = 1.53.3
LICENSEI_VERSION = 0.8.0
KIND_VERSION = 0.20.0
GOLANGCI_LINT_VERSION = 1.61.0
LICENSEI_VERSION = 0.9.0
KIND_VERSION = 0.24.0
HELM_VERSION = 3.16.1
KURUN_VERSION = 0.7.0
CODE_GENERATOR_VERSION = 0.27.1
HELM_DOCS_VERSION = 1.11.0
KUSTOMIZE_VERSION = 5.1.0
CONTROLLER_TOOLS_VERSION = 0.15.0
HELM_DOCS_VERSION = 1.14.2
KUSTOMIZE_VERSION = 5.4.3
CONTROLLER_TOOLS_VERSION = 0.16.3

# Dependency binaries
GOLANGCI_LINT_BIN := golangci-lint
Expand Down Expand Up @@ -237,7 +238,7 @@ bin/setup-envtest:

bin/golangci-lint:
@mkdir -p bin
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- v${GOLANGCI_VERSION}
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- v${GOLANGCI_LINT_VERSION}

bin/licensei:
@mkdir -p bin
Expand All @@ -250,7 +251,7 @@ bin/kind:

bin/helm:
@mkdir -p bin
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | USE_SUDO=false HELM_INSTALL_DIR=bin bash
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | USE_SUDO=false HELM_INSTALL_DIR=bin DESIRED_VERSION=v${HELM_VERSION} bash
@chmod +x bin/helm

bin/helm-docs:
Expand Down
Loading

0 comments on commit d2c0bb4

Please sign in to comment.