Skip to content

Commit d36605a

Browse files
committed
feat: Create provisioner abstraction
Creates a provisioner abstraction that takes prior art from the Terraform plugin system. It's safe to assume this code will change a lot when it becomes integrated with provisionerd. Closes #10.
1 parent 2769f4c commit d36605a

17 files changed

+1759
-10
lines changed

.github/workflows/coder.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ jobs:
3838
with:
3939
version: latest
4040

41+
gen:
42+
name: "style/gen"
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- name: Install Protoc
47+
uses: arduino/setup-protoc@v1
48+
with:
49+
version: "3.6.1"
50+
- uses: actions/setup-go@v2
51+
with:
52+
go-version: "^1.17"
53+
- run: go install github.com/kyleconroy/sqlc/cmd/sqlc@latest
54+
- run: go install github.com/storj/drpc/cmd/protoc-gen-go-drpc@v0.0.20
55+
- run: "make --output-sync -j gen"
56+
4157
style:
4258
name: "style/${{ matrix.style }}"
4359
runs-on: ubuntu-latest

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"files.exclude": {
3+
"**/node_modules": true
4+
},
25
"go.lintTool": "golangci-lint",
36
"go.lintFlags": ["--fast"],
47
"go.lintOnSave": "package",

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ database/dump.sql: $(wildcard database/migrations/*.sql)
33
go run database/dump/main.go
44

55
# Generates Go code for querying the database.
6-
.PHONY: database/generate
76
database/generate: database/dump.sql database/query.sql
87
cd database && sqlc generate && rm db_tmp.go
98
cd database && gofmt -w -r 'Querier -> querier' *.go
109
cd database && gofmt -w -r 'Queries -> sqlQuerier' *.go
10+
.PHONY: database/generate
1111

1212
fmt/prettier:
1313
@echo "--- prettier"
@@ -21,3 +21,16 @@ endif
2121

2222
fmt: fmt/prettier
2323
.PHONY: fmt
24+
25+
gen: database/generate provisionersdk/proto
26+
.PHONY: gen
27+
28+
# Generates the protocol files.
29+
provisionersdk/proto: provisionersdk/proto/provisioner.proto
30+
cd provisionersdk/proto && protoc \
31+
--go_out=. \
32+
--go_opt=paths=source_relative \
33+
--go-drpc_out=. \
34+
--go-drpc_opt=paths=source_relative \
35+
./provisioner.proto
36+
.PHONY: provisionersdk/proto

codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ coverage:
1818
default:
1919
target: 80%
2020
informational: yes
21+
22+
ignore:
23+
# This is generated code.
24+
- provisionersdk/proto

go.mod

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ module github.com/coder/coder
22

33
go 1.17
44

5+
// Required until https://github.com/hashicorp/terraform-config-inspect/pull/74 is merged.
6+
replace github.com/hashicorp/terraform-config-inspect => github.com/kylecarbs/terraform-config-inspect v0.0.0-20211215004401-bbc517866b88
7+
58
require (
69
cdr.dev/slog v1.4.1
710
github.com/golang-migrate/migrate/v4 v4.15.1
11+
github.com/google/uuid v1.3.0
12+
github.com/hashicorp/go-version v1.3.0
13+
github.com/hashicorp/terraform-config-inspect v0.0.0-20211115214459-90acf1ca460f
14+
github.com/hashicorp/terraform-exec v0.15.0
815
github.com/lib/pq v1.10.4
916
github.com/ory/dockertest/v3 v3.8.1
1017
github.com/pion/datachannel v1.5.2
@@ -15,13 +22,20 @@ require (
1522
go.uber.org/atomic v1.7.0
1623
go.uber.org/goleak v1.1.12
1724
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
25+
google.golang.org/protobuf v1.27.1
26+
storj.io/drpc v0.0.26
1827
)
1928

2029
require (
30+
cloud.google.com/go v0.92.3 // indirect
31+
cloud.google.com/go/storage v1.14.0 // indirect
2132
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
2233
github.com/Microsoft/go-winio v0.5.1 // indirect
2334
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
35+
github.com/agext/levenshtein v1.2.2 // indirect
2436
github.com/alecthomas/chroma v0.9.1 // indirect
37+
github.com/apparentlymart/go-textseg v1.0.0 // indirect
38+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
2539
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
2640
github.com/containerd/continuity v0.1.0 // indirect
2741
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
@@ -35,13 +49,17 @@ require (
3549
github.com/fatih/color v1.12.0 // indirect
3650
github.com/gogo/protobuf v1.3.2 // indirect
3751
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
52+
github.com/google/go-cmp v0.5.6 // indirect
3853
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
39-
github.com/google/uuid v1.3.0 // indirect
4054
github.com/hashicorp/errwrap v1.0.0 // indirect
4155
github.com/hashicorp/go-multierror v1.1.0 // indirect
56+
github.com/hashicorp/hcl v1.0.0 // indirect
57+
github.com/hashicorp/hcl/v2 v2.0.0 // indirect
58+
github.com/hashicorp/terraform-json v0.13.0 // indirect
4259
github.com/imdario/mergo v0.3.12 // indirect
4360
github.com/mattn/go-colorable v0.1.8 // indirect
44-
github.com/mattn/go-isatty v0.0.12 // indirect
61+
github.com/mattn/go-isatty v0.0.13 // indirect
62+
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
4563
github.com/mitchellh/mapstructure v1.4.1 // indirect
4664
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
4765
github.com/opencontainers/go-digest v1.0.0 // indirect
@@ -66,11 +84,15 @@ require (
6684
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
6785
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
6886
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
87+
github.com/zclconf/go-cty v1.9.1 // indirect
88+
github.com/zeebo/errs v1.2.2 // indirect
6989
go.opencensus.io v0.23.0 // indirect
7090
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
7191
golang.org/x/net v0.0.0-20211215060638-4ddde0e984e9 // indirect
7292
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect
73-
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
93+
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
94+
golang.org/x/text v0.3.7 // indirect
95+
google.golang.org/grpc v1.43.0 // indirect
7496
gopkg.in/yaml.v2 v2.4.0 // indirect
7597
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
7698
)

0 commit comments

Comments
 (0)