Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint #19

Merged
merged 2 commits into from
Jun 14, 2023
Merged

Lint #19

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
2 changes: 1 addition & 1 deletion .github/workflows/analysis-scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: OpenSSF Scorecard
on:
branch_protection_rule:
push:
branches: [ main ]
branches: [main]
schedule:
- cron: '30 0 * * 5'

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:

permissions:
Expand Down Expand Up @@ -79,7 +79,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 Expand Up @@ -167,7 +167,7 @@ jobs:
needs: [artifacts]
strategy:
matrix:
k8s_version: ["v1.24.13", "v1.25.9", "v1.26.4", "v1.27.1" ]
k8s_version: ["v1.24.13", "v1.25.9", "v1.26.4", "v1.27.1"]
# vault_version: ["1.10.11", "1.11.10", "1.12.6", "1.13.2"]

steps:
Expand Down
53 changes: 4 additions & 49 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,51 +1,6 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

/.licensei.cache

./bank-vaults

# Operator
operator/build/_output/bin/*
operator/vendor
operator/go.mod
operator/go.sum

/vendor/

/.licensei.cache
bin/*
/build/
/bin/

# Helm
**/*.tgz
**/*.lock
!flake.lock

# Certificates
*.csr
*.pem

vault-config.yaml

# goreleaser
dist/

# Vault configs
*.hcl

# VS Code config
.vscode/

/.devenv/
/.direnv/
/.pre-commit-config.yaml
/bin/
/build/
/tmp/
3 changes: 3 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignored:
- DL3018
- DL3059
3 changes: 3 additions & 0 deletions .yamlignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/deploy/
/e2e/deploy/
/e2e/test/
6 changes: 6 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ignore-from-file: [.gitignore, .yamlignore]

extends: default

rules:
line-length: disable
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,24 @@ test-e2e-local: container-image ## Run e2e tests locally
LOAD_IMAGE=${CONTAINER_IMAGE_REF} WEBHOOK_VERSION=dev ${MAKE} test-e2e

.PHONY: lint
lint: lint-go lint-helm lint-docker lint-yaml
lint: ## Run linter
golangci-lint run ${LINT_ARGS}

.PHONY: lint-go
lint-go:
golangci-lint run $(if ${CI},--out-format github-actions,)

.PHONY: lint-helm
lint-helm:
helm lint deploy/charts/vault-secrets-webhook

.PHONY: lint-docker
lint-docker:
hadolint Dockerfile

.PHONY: lint-yaml
lint-yaml:
yamllint $(if ${CI},-f github,) --no-warnings .

.PHONY: fmt
fmt: ## Format code
Expand Down Expand Up @@ -121,4 +137,4 @@ bin/helm-docs:
.PHONY: help
.DEFAULT_GOAL := help
help:
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
vault.enable = true;
};

pre-commit.hooks = {
nixpkgs-fmt.enable = true;
yamllint.enable = true;
hadolint.enable = true;
};

packages = with pkgs; [
gnumake

Expand All @@ -36,6 +42,9 @@
kustomize
kubernetes-helm
helm-docs

yamllint
hadolint
] ++ [
self'.packages.licensei
];
Expand Down