Skip to content

Commit 44076c0

Browse files
authoredJun 8, 2024··
chore: update repo config (#188)
* chore: update license headers to match other BV repos Signed-off-by: Bence Csati <bcsati@cisco.com> * chore: upgrade and update project dependencies Signed-off-by: Bence Csati <bcsati@cisco.com> --------- Signed-off-by: Bence Csati <bcsati@cisco.com>
1 parent bb1587a commit 44076c0

27 files changed

+144
-61
lines changed
 

‎.envrc

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
22
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
33
fi
44
use flake . --impure
5+
6+
# Vault
7+
export VAULT_ADDR=http://127.0.0.1:8200
8+
export VAULT_TOKEN=227e1cce-6bf7-30bb-2d2a-acc854318caf

‎.goreleaser.yaml

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
project_name: secret-sync
2+
13
dist: build/dist
24

5+
before:
6+
hooks:
7+
- go mod tidy
38
builds:
4-
- main: .
5-
env:
9+
- env:
610
- CGO_ENABLED=0
7-
flags:
8-
- -trimpath
9-
ldflags: "-s -w -X main.version={{ .Version }}"
11+
main: .
1012
goos:
1113
- linux
1214
- darwin
@@ -15,18 +17,18 @@ builds:
1517
- arm64
1618

1719
archives:
18-
- name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
19-
format_overrides:
20-
- goos: windows
21-
format: zip
20+
- format: tar.gz
21+
# this name template makes the OS and Arch compatible with the results of uname.
22+
name_template: >-
23+
{{ .ProjectName }}_
24+
{{- title .Os }}_
25+
{{- if eq .Arch "amd64" }}x86_64
26+
{{- else if eq .Arch "386" }}i386
27+
{{- else }}{{ .Arch }}{{ end }}
28+
{{- if .Arm }}v{{ .Arm }}{{ end }}
2229
2330
checksum:
2431
name_template: "checksums.txt"
2532

2633
changelog:
27-
skip: false
28-
29-
release:
30-
draft: true
31-
replace_existing_draft: true
32-
prerelease: auto
34+
disable: true

‎.hadolint.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ignored:
2+
- DL3018
3+
- DL3059

‎.licensei.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ignored = [
3838
]
3939

4040
[header]
41-
authors = ["Cisco"]
41+
authors = ["Bank-Vaults Maintainers"]
4242
ignorePaths = [".direnv", ".devenv", "vendor", "examples"]
4343
ignoreFiles = ["zz_generated.*.go"]
4444
template = """// Copyright © :YEAR: :AUTHOR:

‎.yamlignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.github/

‎.yamllint.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
ignore-from-file: [.gitignore]
1+
ignore-from-file: [.gitignore, .yamlignore]
22

33
extends: default
44

55
rules:
66
line-length: disable
7+
document-start: disable
8+
comments: disable

‎Makefile

+63-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,39 @@ default: help
1212
help: ## Display this help
1313
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
1414

15+
##@ Development
16+
17+
.PHONY: up
18+
up: ## Start development environment
19+
docker compose -f dev/vault/docker-compose.yml up -d
20+
21+
.PHONY: stop
22+
stop: ## Stop development environment
23+
docker compose -v -f dev/vault/docker-compose.yml stop
24+
25+
.PHONY: down
26+
down: ## Destroy development environment
27+
docker compose -v -f dev/vault/docker-compose.yml down
28+
1529
##@ Build
1630

1731
.PHONY: build
1832
build: ## Build binary
1933
@mkdir -p build
2034
go build -race -o build/
2135

36+
.PHONY: container-image
37+
container-image: ## Build container image
38+
docker build .
39+
40+
.PHONY: binary-snapshot
41+
binary-snapshot: ## Build binary snapshot
42+
VERSION=v${GORELEASER_VERSION} ${GORELEASER_BIN} release --clean --skip=publish --snapshot
43+
44+
.PHONY: artifacts
45+
artifacts: container-image binary-snapshot
46+
artifacts: ## Build artifacts
47+
2248
##@ Checks
2349

2450
.PHONY: check
@@ -29,38 +55,45 @@ test: ## Run tests
2955
go test -race -v ./...
3056

3157
.PHONY: lint
32-
lint: lint-go lint-yaml #lint-docker
58+
lint: lint-go lint-docker lint-yaml
3359
lint: ## Run linters
3460

3561
.PHONY: lint-go
3662
lint-go:
3763
$(GOLANGCI_LINT_BIN) run $(if ${CI},--out-format github-actions,)
3864

65+
.PHONY: lint-docker
66+
lint-docker:
67+
hadolint Dockerfile
68+
3969
.PHONY: lint-yaml
4070
lint-yaml:
4171
yamllint $(if ${CI},-f github,) --no-warnings .
4272

73+
.PHONY: fmt
74+
fmt: ## Format code
75+
$(GOLANGCI_LINT_BIN) run --fix
76+
4377
.PHONY: license-check
4478
license-check: ## Run license check
4579
$(LICENSEI_BIN) check
4680
$(LICENSEI_BIN) header
4781

48-
.PHONY: fmt
49-
fmt: ## Format code
50-
$(GOLANGCI_LINT_BIN) run --fix
51-
5282
##@ Dependencies
5383

54-
deps: bin/golangci-lint bin/licensei
84+
deps: bin/golangci-lint bin/licensei bin/cosign bin/goreleaser
5585
deps: ## Install dependencies
5686

5787
# Dependency versions
58-
GOLANGCI_VERSION = 1.53.3
59-
LICENSEI_VERSION = 0.8.0
88+
GOLANGCI_VERSION = 1.59.0
89+
LICENSEI_VERSION = 0.9.0
90+
COSIGN_VERSION = 2.2.4
91+
GORELEASER_VERSION = 2.0.0
6092

6193
# Dependency binaries
6294
GOLANGCI_LINT_BIN := golangci-lint
6395
LICENSEI_BIN := licensei
96+
GORELEASER_BIN := goreleaser
6497

6598
# If we have "bin" dir, use those binaries instead
6699
ifneq ($(wildcard ./bin/.),)
@@ -75,3 +108,25 @@ bin/golangci-lint:
75108
bin/licensei:
76109
@mkdir -p bin
77110
curl -sfL https://raw.githubusercontent.com/goph/licensei/master/install.sh | bash -s -- v${LICENSEI_VERSION}
111+
112+
bin/cosign:
113+
@mkdir -p bin
114+
@OS=$$(uname -s); \
115+
case $$OS in \
116+
"Linux") \
117+
curl -sSfL https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION}/cosign-linux-amd64 -o bin/cosign; \
118+
;; \
119+
"Darwin") \
120+
curl -sSfL https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION}/cosign-darwin-arm64 -o bin/cosign; \
121+
;; \
122+
*) \
123+
echo "Unsupported OS: $$OS"; \
124+
exit 1; \
125+
;; \
126+
esac
127+
@chmod +x bin/cosign
128+
129+
bin/goreleaser:
130+
@mkdir -p bin
131+
curl -sfL https://goreleaser.com/static/run -o bin/goreleaser
132+
@chmod +x bin/goreleaser

‎README.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ Check out the [project documentation](docs) or [pkg.go.dev](https://pkg.go.dev/m
5757

5858
_Alternatively, install [Go](https://go.dev/dl/) on your computer then run `make deps` to install the rest of the dependencies._
5959

60-
Fetch required tools:
60+
Make sure Docker is installed with Compose and Buildx.
61+
62+
Run project dependencies:
6163

6264
```shell
63-
make deps
65+
make up
6466
```
6567

6668
Build the CLI:
@@ -87,6 +89,22 @@ Some linter violations can automatically be fixed:
8789
make fmt
8890
```
8991

92+
Build artifacts locally:
93+
94+
```shell
95+
make artifacts
96+
```
97+
98+
Once you are done either stop or tear down dependencies:
99+
100+
```shell
101+
make stop
102+
103+
# OR
104+
105+
make down
106+
```
107+
90108
## License
91109

92110
The project is licensed under the [Apache 2.0 License](https://github.com/bank-vaults/secret-sync/blob/master/LICENSE).

‎cmd/sync.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎cmd/sync_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎dev/vault/docker-compose.yml

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
services:
22
vault-1:
3-
container_name: vault-1
4-
image: hashicorp/vault:latest
3+
container_name: secret-sync-vault-1
4+
image: hashicorp/vault:1.14.8
55
ports:
6-
- 8200:8200
6+
- 127.0.0.1:8200:8200
77
environment:
8-
VAULT_ADDR: "http://0.0.0.0:8200"
9-
VAULT_API_ADDR: "http://0.0.0.0:8200"
10-
cap_add:
11-
- IPC_LOCK
12-
entrypoint: vault server -dev -dev-listen-address="0.0.0.0:8200" -dev-root-token-id="root"
8+
SKIP_SETCAP: "true"
9+
VAULT_ADDR: http://127.0.0.1:8200
10+
VAULT_TOKEN: 227e1cce-6bf7-30bb-2d2a-acc854318caf
11+
VAULT_DEV_ROOT_TOKEN_ID: 227e1cce-6bf7-30bb-2d2a-acc854318caf
1312

1413
vault-2:
15-
container_name: vault-2
16-
image: hashicorp/vault:latest
14+
container_name: secret-sync-vault-2
15+
image: hashicorp/vault:1.14.8
1716
ports:
18-
- 8201:8200
17+
- 127.0.0.1:8201:8200
1918
environment:
20-
VAULT_ADDR: "http://0.0.0.0:8200"
21-
VAULT_API_ADDR: "http://0.0.0.0:8200"
22-
cap_add:
23-
- IPC_LOCK
24-
entrypoint: vault server -dev -dev-listen-address="0.0.0.0:8200" -dev-root-token-id="root"
19+
SKIP_SETCAP: "true"
20+
VAULT_ADDR: http://127.0.0.1:8200
21+
VAULT_TOKEN: 227e1cce-6bf7-30bb-2d2a-acc854318caf
22+
VAULT_DEV_ROOT_TOKEN_ID: 227e1cce-6bf7-30bb-2d2a-acc854318caf

‎flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
goreleaser
4545

4646
yamllint
47-
# hadolint
47+
hadolint
4848
] ++ [
4949
self'.packages.licensei
5050
self'.packages.golangci-lint

‎main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/apis/v1alpha1/secretkey_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/apis/v1alpha1/secretstore.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/apis/v1alpha1/secretstore_local_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/apis/v1alpha1/secretstore_schema.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/apis/v1alpha1/secretstore_vault_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/apis/v1alpha1/syncjob_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/provider/file/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/provider/file/provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/provider/provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/provider/vault/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/provider/vault/provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/storesync/processor.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/storesync/storesync.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

‎pkg/storesync/storesync_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2023 Cisco
1+
// Copyright © 2023 Bank-Vaults Maintainers
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)
Please sign in to comment.