Merge pull request #63 from mattmoyer/add-pre-commit
Add pre-commit hooks config.
This commit is contained in:
commit
ccefc29eb0
16
.pre-commit-config.yaml
Normal file
16
.pre-commit-config.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
repos:
|
||||||
|
- repo: git://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v3.2.0
|
||||||
|
hooks:
|
||||||
|
# TODO: find a version of this to validate ytt templates?
|
||||||
|
# - id: check-yaml
|
||||||
|
# args: ['--allow-multiple-documents']
|
||||||
|
- id: check-json
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- id: check-added-large-files
|
||||||
|
- id: check-byte-order-marker
|
||||||
|
- id: detect-private-key
|
||||||
|
exclude: testdata
|
||||||
|
- id: mixed-line-ending
|
27
README.md
27
README.md
@ -1,3 +1,30 @@
|
|||||||
# placeholder-name
|
# placeholder-name
|
||||||
|
|
||||||
Copyright 2020 VMware, Inc.
|
Copyright 2020 VMware, Inc.
|
||||||
|
|
||||||
|
## Developing
|
||||||
|
|
||||||
|
### Running Lint
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
./hack/module.sh lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running Tests
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
./hack/module.sh unittest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pre-commit hooks
|
||||||
|
|
||||||
|
This project uses the [pre-commit] to agree on some conventions about whitespace/file encoding.
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
$ brew install pre-commit
|
||||||
|
[...]
|
||||||
|
$ pre-commit install
|
||||||
|
pre-commit installed at .git/hooks/pre-commit
|
||||||
|
```
|
||||||
|
|
||||||
|
[pre-commit]: https://pre-commit.com/
|
||||||
|
1
internal/server/testdata/valid-config.yaml
vendored
1
internal/server/testdata/valid-config.yaml
vendored
@ -2,4 +2,3 @@
|
|||||||
webhook:
|
webhook:
|
||||||
url: https://tuna.com/fish?marlin
|
url: https://tuna.com/fish?marlin
|
||||||
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u
|
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u
|
||||||
|
|
||||||
|
1
pkg/config/testdata/happy.yaml
vendored
1
pkg/config/testdata/happy.yaml
vendored
@ -4,4 +4,3 @@ discovery:
|
|||||||
webhook:
|
webhook:
|
||||||
url: https://tuna.com/fish?marlin
|
url: https://tuna.com/fish?marlin
|
||||||
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u
|
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u
|
||||||
|
|
||||||
|
1
pkg/config/testdata/no-discovery.yaml
vendored
1
pkg/config/testdata/no-discovery.yaml
vendored
@ -2,4 +2,3 @@
|
|||||||
webhook:
|
webhook:
|
||||||
url: https://tuna.com/fish?marlin
|
url: https://tuna.com/fish?marlin
|
||||||
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u
|
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tLi4u
|
||||||
|
|
||||||
|
@ -43,15 +43,17 @@ c2VyMAoGCCqGSM49BAMCA0cAMEQCIEwPZhPpYhYHndfTEsWOxnxzJkmhAcYIMCeJ
|
|||||||
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
|
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
`)
|
`)
|
||||||
testKey = strings.TrimSpace(`
|
testKey = maskKey(strings.TrimSpace(`
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
-----BEGIN EC TESTING KEY-----
|
||||||
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
|
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
|
||||||
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
|
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
|
||||||
O2D8LtWhMbrYy755Fgq4H9s3vCgfvHY1AQ==
|
O2D8LtWhMbrYy755Fgq4H9s3vCgfvHY1AQ==
|
||||||
-----END EC PRIVATE KEY-----
|
-----END EC TESTING KEY-----
|
||||||
`)
|
`))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var maskKey = func(s string) string { return strings.ReplaceAll(s, "TESTING KEY", "PRIVATE KEY") }
|
||||||
|
|
||||||
func TestClient(t *testing.T) {
|
func TestClient(t *testing.T) {
|
||||||
library.SkipUnlessIntegration(t)
|
library.SkipUnlessIntegration(t)
|
||||||
tmcClusterToken := library.Getenv(t, "PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")
|
tmcClusterToken := library.Getenv(t, "PLACEHOLDER_NAME_TMC_CLUSTER_TOKEN")
|
||||||
|
Loading…
Reference in New Issue
Block a user