Skip to content

Commit 0de1ccc

Browse files
authored
chore: 3.20.0 protocol changes (#200)
* chore: 3.20.0 protocol changes * chore: update * chore: update * fix: review resource * chore: update * chore: support color protocol * chore: update
1 parent 513da75 commit 0de1ccc

60 files changed

Lines changed: 1288 additions & 313 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
go-version-file: "go.mod"
1717
- run: go generate ./...
1818
- name: golangci-lint
19-
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
19+
uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.2.1
2020
with:
21-
version: v1.64.7
21+
version: v2.12.2
2222
args: --verbose --timeout 20m --max-same-issues=30 --allow-parallel-runners
2323
go-tidy:
2424
runs-on: ubuntu-latest

.golangci.yaml

Lines changed: 90 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,95 @@
1+
version: "2"
2+
run:
3+
build-tags:
4+
- mysql
15
linters:
26
enable:
3-
- errcheck
4-
- goimports
5-
- revive
6-
- govet
7-
- staticcheck
8-
- misspell
7+
- forbidigo
98
- gocritic
10-
- sqlclosecheck
11-
- rowserrcheck
12-
- nilerr
139
- godot
14-
- forbidigo
15-
16-
# golangci-lint run --exclude="Rollback,logger.Sync,pgInstance.Stop"
17-
issues:
18-
include:
19-
# https://golangci-lint.run/usage/configuration/#command-line-options
20-
- EXC0012
21-
- EXC0013
22-
- EXC0014
23-
- EXC0015
24-
exclude:
25-
- Rollback
26-
- logger.Sync
27-
- pgInstance.Stop
28-
- fmt.Printf
29-
- fmt.Print
30-
31-
run:
32-
timeout: 5m
33-
build-tags:
34-
- mysql
35-
36-
linters-settings:
37-
goimports:
38-
# Put imports beginning with prefix after 3rd-party packages.
39-
# It's a comma-separated list of prefixes.
40-
local-prefixes: github.com/bytebase/terraform-provider-bytebase
41-
revive:
42-
# Default to run all linters so that new rules in the future could automatically be added to the static check.
43-
enable-all-rules: true
10+
- misspell
11+
- nilerr
12+
- revive
13+
- rowserrcheck
14+
- sqlclosecheck
15+
settings:
16+
forbidigo:
17+
forbid:
18+
- pattern: fmt\.Errorf(# Please use errors\.Wrap\|Wrapf\|Errorf instead)?
19+
- pattern: ioutil\.ReadDir(# Please use os\.ReadDir)?
20+
gocritic:
21+
disabled-checks:
22+
- ifElseChain
23+
revive:
24+
enable-all-rules: true
25+
rules:
26+
- name: file-header
27+
disabled: true
28+
- name: line-length-limit
29+
disabled: true
30+
- name: function-length
31+
disabled: true
32+
- name: max-public-structs
33+
disabled: true
34+
- name: function-result-limit
35+
disabled: true
36+
- name: banned-characters
37+
disabled: true
38+
- name: argument-limit
39+
disabled: true
40+
- name: cognitive-complexity
41+
disabled: true
42+
- name: cyclomatic
43+
disabled: true
44+
- name: confusing-results
45+
disabled: true
46+
- name: add-constant
47+
disabled: true
48+
- name: flag-parameter
49+
disabled: true
50+
- name: nested-structs
51+
disabled: true
52+
- name: import-shadowing
53+
disabled: true
54+
- name: early-return
55+
disabled: true
56+
- name: use-any
57+
disabled: true
58+
- name: unchecked-type-assertion
59+
disabled: true
60+
- name: redundant-import-alias
61+
disabled: true
62+
exclusions:
63+
generated: lax
64+
presets:
65+
- common-false-positives
66+
- legacy
67+
- std-error-handling
4468
rules:
45-
# The following rules are too strict and make coding harder. We do not enable them for now.
46-
- name: file-header
47-
disabled: true
48-
- name: line-length-limit
49-
disabled: true
50-
- name: function-length
51-
disabled: true
52-
- name: max-public-structs
53-
disabled: true
54-
- name: function-result-limit
55-
disabled: true
56-
- name: banned-characters
57-
disabled: true
58-
- name: argument-limit
59-
disabled: true
60-
- name: cognitive-complexity
61-
disabled: true
62-
- name: cyclomatic
63-
disabled: true
64-
- name: confusing-results
65-
disabled: true
66-
- name: add-constant
67-
disabled: true
68-
- name: flag-parameter
69-
disabled: true
70-
- name: nested-structs
71-
disabled: true
72-
- name: import-shadowing
73-
disabled: true
74-
- name: early-return
75-
disabled: true
76-
- name: use-any
77-
disabled: true
78-
- name: unchecked-type-assertion
79-
disabled: true
80-
- name: redundant-import-alias
81-
disabled: true
82-
gocritic:
83-
disabled-checks:
84-
- ifElseChain
85-
forbidigo:
86-
forbid:
87-
- 'fmt\.Errorf(# Please use errors\.Wrap\|Wrapf\|Errorf instead)?'
88-
- 'ioutil\.ReadDir(# Please use os\.ReadDir)?'
69+
- path: (.+)\.go$
70+
text: Rollback
71+
- path: (.+)\.go$
72+
text: logger.Sync
73+
- path: (.+)\.go$
74+
text: pgInstance.Stop
75+
- path: (.+)\.go$
76+
text: fmt.Printf
77+
- path: (.+)\.go$
78+
text: fmt.Print
79+
paths:
80+
- third_party$
81+
- builtin$
82+
- examples$
83+
formatters:
84+
enable:
85+
- goimports
86+
settings:
87+
goimports:
88+
local-prefixes:
89+
- github.com/bytebase/terraform-provider-bytebase
90+
exclusions:
91+
generated: lax
92+
paths:
93+
- third_party$
94+
- builtin$
95+
- examples$

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ NAMESPACE=bytebase
44
NAME=bytebase
55
BINARY=terraform-provider-${NAMESPACE}
66
VERSION=${shell cat ./VERSION}
7-
OS_ARCH=darwin_amd64
7+
OS_ARCH?=$(shell go env GOOS)_$(shell go env GOARCH)
8+
PLUGIN_DIR=~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
9+
PLUGIN_BINARY=${BINARY}_v${VERSION}
810

911
default: install
1012

@@ -15,8 +17,9 @@ release:
1517
goreleaser release --rm-dist --snapshot --skip-publish --skip-sign
1618

1719
install: build
18-
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
19-
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
20+
mkdir -p ${PLUGIN_DIR}
21+
rm -f ${PLUGIN_DIR}/${BINARY}
22+
mv ${BINARY} ${PLUGIN_DIR}/${PLUGIN_BINARY}
2023

2124
test:
2225
go test -i $(TEST) || exit 1

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ air -c scripts/.air.toml
5656
# install the provider in your local machine
5757
cd terraform-provider-bytebase && make install
5858

59-
# build for darwin_arm64
60-
# replace {version} with the real local version
61-
go build -o terraform-provider-bytebase . && \
62-
mkdir -p ~/.terraform.d/plugins/terraform.local/bytebase/bytebase/{version}/darwin_arm64 && \
63-
cp terraform-provider-bytebase ~/.terraform.d/plugins/terraform.local/bytebase/bytebase/{version}/darwin_arm64/
64-
6559
# test
6660
# Any BYTEBASE_SERVICE_ACCOUNT/BYTEBASE_SERVICE_KEY/BYTEBASE_URL value should work since the service is mocked
6761
TF_ACC=1 BYTEBASE_SERVICE_ACCOUNT=test@service.bytebase.com BYTEBASE_SERVICE_KEY=test_secret BYTEBASE_URL=https://bytebase.example.com go test -v ./...

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.18.1
1+
3.20.0

docs/data-sources/environment.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,23 @@ The environment data source.
2121

2222
### Optional
2323

24-
- `color` (String) The environment color.
2524
- `protected` (Boolean) The environment is protected or not.
2625

2726
### Read-Only
2827

28+
- `color` (List of Object) The environment color. (see [below for nested schema](#nestedatt--color))
2929
- `id` (String) The ID of this resource.
3030
- `name` (String) The environment full name in environments/{resource id} format.
3131
- `order` (Number) The environment sorting order.
3232
- `title` (String) The environment unique name.
3333

34+
<a id="nestedatt--color"></a>
35+
### Nested Schema for `color`
36+
37+
Read-Only:
38+
39+
- `blue` (Number)
40+
- `green` (Number)
41+
- `red` (Number)
42+
3443

docs/data-sources/instance.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Read-Only:
160160
- `password_key_name` (String)
161161
- `secret_name` (String)
162162
- `token` (String)
163+
- `token_type` (String)
163164
- `url` (String)
164165

165166
<a id="nestedobjatt--data_sources--external_secret--vault--app_role"></a>

docs/data-sources/instance_list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ Read-Only:
169169
- `password_key_name` (String)
170170
- `secret_name` (String)
171171
- `token` (String)
172+
- `token_type` (String)
172173
- `url` (String)
173174

174175
<a id="nestedobjatt--instances--data_sources--external_secret--vault--app_role"></a>

docs/data-sources/project.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,27 @@ The project data source.
3737
- `require_issue_approval` (Boolean) Whether to require issue approval before rollout.
3838
- `require_plan_check_no_error` (Boolean) Whether to require plan check to have no error before rollout.
3939
- `title` (String) The project title.
40-
- `webhooks` (List of Object) The webhooks in the project. When url is write-only, webhook identity for diffing uses the (title, type) pair, and duplicate (title, type) pairs are rejected at plan time. (see [below for nested schema](#nestedatt--webhooks))
40+
- `webhooks` (List of Object) The webhooks in the project. (see [below for nested schema](#nestedatt--webhooks))
4141

4242
<a id="nestedatt--issue_labels"></a>
4343
### Nested Schema for `issue_labels`
4444

4545
Read-Only:
4646

47-
- `color` (String)
47+
- `color` (List of Object) (see [below for nested schema](#nestedobjatt--issue_labels--color))
4848
- `group` (String)
4949
- `value` (String)
5050

51+
<a id="nestedobjatt--issue_labels--color"></a>
52+
### Nested Schema for `issue_labels.color`
53+
54+
Read-Only:
55+
56+
- `blue` (Number)
57+
- `green` (Number)
58+
- `red` (Number)
59+
60+
5161

5262
<a id="nestedatt--webhooks"></a>
5363
### Nested Schema for `webhooks`

docs/data-sources/project_list.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,20 @@ Read-Only:
5454

5555
Read-Only:
5656

57-
- `color` (String)
57+
- `color` (List of Object) (see [below for nested schema](#nestedobjatt--projects--issue_labels--color))
5858
- `group` (String)
5959
- `value` (String)
6060

61+
<a id="nestedobjatt--projects--issue_labels--color"></a>
62+
### Nested Schema for `projects.issue_labels.color`
63+
64+
Read-Only:
65+
66+
- `blue` (Number)
67+
- `green` (Number)
68+
- `red` (Number)
69+
70+
6171

6272
<a id="nestedobjatt--projects--webhooks"></a>
6373
### Nested Schema for `projects.webhooks`

0 commit comments

Comments
 (0)