mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Add templates to create working release (#422)
* Add templates
* Move API structs to codersdk
* Back to green tests!
* It all works, but now with tea! 🧋
* It works!
* Add cancellation to provisionerd
* Tests pass!
* Add deletion of workspaces and projects
* Fix agent lock
* Add clog
* Fix linting errors
* Remove unused CLI tests
* Rename daemon to start
* Fix leaking command
* Fix promptui test
* Update agent connection frequency
* Skip login tests on Windows
* Increase tunnel connect timeout
* Fix templater
* Lower test requirements
* Fix embed
* Disable promptui tests for Windows
* Fix write newline
* Fix PTY write newline
* Fix CloseReader
* Fix compilation on Windows
* Fix linting error
* Remove bubbletea
* Cleanup readwriter
* Use embedded templates instead of serving over API
* Move templates to examples
* Improve workspace create flow
* Fix Windows build
* Fix tests
* Fix linting errors
* Fix untar with extracting max size
* Fix newline char
This commit is contained in:
@@ -10,10 +10,9 @@ var (
|
||||
"windows": {
|
||||
"amd64": `
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
$ErrorActionPreference = "Stop"
|
||||
Invoke-WebRequest -Uri ${ACCESS_URL}/bin/coder-windows-amd64 -OutFile $env:TEMP\coder.exe
|
||||
Invoke-WebRequest -Uri ${ACCESS_URL}bin/coder-windows-amd64.exe -OutFile $env:TEMP\coder.exe
|
||||
$env:CODER_URL = "${ACCESS_URL}"
|
||||
Start-Process -FilePath $env:TEMP\coder.exe workspaces agent
|
||||
Start-Process -FilePath $env:TEMP\coder.exe -ArgumentList "workspaces","agent" -PassThru
|
||||
`,
|
||||
},
|
||||
"linux": {
|
||||
@@ -21,10 +20,10 @@ Start-Process -FilePath $env:TEMP\coder.exe workspaces agent
|
||||
#!/usr/bin/env sh
|
||||
set -eu pipefail
|
||||
BINARY_LOCATION=$(mktemp -d)/coder
|
||||
curl -fsSL ${ACCESS_URL}/bin/coder-linux-amd64 -o $BINARY_LOCATION
|
||||
curl -fsSL ${ACCESS_URL}bin/coder-linux-amd64 -o $BINARY_LOCATION
|
||||
chmod +x $BINARY_LOCATION
|
||||
export CODER_URL="${ACCESS_URL}"
|
||||
exec $BINARY_LOCATION agent
|
||||
exec $BINARY_LOCATION workspaces agent
|
||||
`,
|
||||
},
|
||||
"darwin": {
|
||||
@@ -32,10 +31,10 @@ exec $BINARY_LOCATION agent
|
||||
#!/usr/bin/env sh
|
||||
set -eu pipefail
|
||||
BINARY_LOCATION=$(mktemp -d)/coder
|
||||
curl -fsSL ${ACCESS_URL}/bin/coder-darwin-amd64 -o $BINARY_LOCATION
|
||||
curl -fsSL ${ACCESS_URL}bin/coder-darwin-amd64 -o $BINARY_LOCATION
|
||||
chmod +x $BINARY_LOCATION
|
||||
export CODER_URL="${ACCESS_URL}"
|
||||
exec $BINARY_LOCATION agent
|
||||
exec $BINARY_LOCATION workspaces agent
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -44,12 +44,12 @@ func TestAgentScript(t *testing.T) {
|
||||
t.Skip("Agent not supported...")
|
||||
return
|
||||
}
|
||||
script = strings.ReplaceAll(script, "${ACCESS_URL}", srvURL.String())
|
||||
script = strings.ReplaceAll(script, "${ACCESS_URL}", srvURL.String()+"/")
|
||||
output, err := exec.Command("sh", "-c", script).CombinedOutput()
|
||||
t.Log(string(output))
|
||||
require.NoError(t, err)
|
||||
// Because we use the "echo" binary, we should expect the arguments provided
|
||||
// as the response to executing our script.
|
||||
require.Equal(t, "agent", strings.TrimSpace(string(output)))
|
||||
require.Equal(t, "workspaces agent", strings.TrimSpace(string(output)))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package provisionersdk
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"bytes"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
// Tar archives a directory.
|
||||
func Tar(directory string) ([]byte, error) {
|
||||
var buffer bytes.Buffer
|
||||
tarWriter := tar.NewWriter(&buffer)
|
||||
err := filepath.Walk(directory, func(file string, fileInfo os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
header, err := tar.FileInfoHeader(fileInfo, file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rel, err := filepath.Rel(directory, file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if strings.HasPrefix(rel, ".") {
|
||||
// Don't archive hidden files!
|
||||
return err
|
||||
}
|
||||
if strings.Contains(rel, ".tfstate") {
|
||||
// Don't store tfstate!
|
||||
return err
|
||||
}
|
||||
header.Name = rel
|
||||
if err := tarWriter.WriteHeader(header); err != nil {
|
||||
return err
|
||||
}
|
||||
if fileInfo.IsDir() {
|
||||
return nil
|
||||
}
|
||||
data, err := os.Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := io.Copy(tarWriter, data); err != nil {
|
||||
return err
|
||||
}
|
||||
return data.Close()
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = tarWriter.Flush()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return buffer.Bytes(), nil
|
||||
}
|
||||
|
||||
// Untar extracts the archive to a provided directory.
|
||||
func Untar(directory string, archive []byte) error {
|
||||
reader := tar.NewReader(bytes.NewReader(archive))
|
||||
for {
|
||||
header, err := reader.Next()
|
||||
if xerrors.Is(err, io.EOF) {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// #nosec
|
||||
target := filepath.Join(directory, header.Name)
|
||||
switch header.Typeflag {
|
||||
case tar.TypeDir:
|
||||
if _, err := os.Stat(target); err != nil {
|
||||
if err := os.MkdirAll(target, 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
case tar.TypeReg:
|
||||
file, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, os.FileMode(header.Mode))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Max file size of 10MB.
|
||||
_, err = io.CopyN(file, reader, (1<<20)*10)
|
||||
if xerrors.Is(err, io.EOF) {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = file.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package provisionersdk_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/coder/coder/provisionersdk"
|
||||
)
|
||||
|
||||
func TestTar(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir := t.TempDir()
|
||||
file, err := ioutil.TempFile(dir, "")
|
||||
require.NoError(t, err)
|
||||
_ = file.Close()
|
||||
_, err = provisionersdk.Tar(dir)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestUntar(t *testing.T) {
|
||||
t.Parallel()
|
||||
dir := t.TempDir()
|
||||
file, err := ioutil.TempFile(dir, "")
|
||||
require.NoError(t, err)
|
||||
_ = file.Close()
|
||||
archive, err := provisionersdk.Tar(dir)
|
||||
require.NoError(t, err)
|
||||
dir = t.TempDir()
|
||||
err = provisionersdk.Untar(dir, archive)
|
||||
require.NoError(t, err)
|
||||
_, err = os.Stat(filepath.Join(dir, filepath.Base(file.Name())))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
Generated
+261
-108
@@ -1175,7 +1175,7 @@ func (x *Provision_Metadata) GetWorkspaceTransition() WorkspaceTransition {
|
||||
return WorkspaceTransition_START
|
||||
}
|
||||
|
||||
type Provision_Request struct {
|
||||
type Provision_Start struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@@ -1187,10 +1187,126 @@ type Provision_Request struct {
|
||||
DryRun bool `protobuf:"varint,5,opt,name=dry_run,json=dryRun,proto3" json:"dry_run,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Provision_Start) Reset() {
|
||||
*x = Provision_Start{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Provision_Start) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Provision_Start) ProtoMessage() {}
|
||||
|
||||
func (x *Provision_Start) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Provision_Start.ProtoReflect.Descriptor instead.
|
||||
func (*Provision_Start) Descriptor() ([]byte, []int) {
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 1}
|
||||
}
|
||||
|
||||
func (x *Provision_Start) GetDirectory() string {
|
||||
if x != nil {
|
||||
return x.Directory
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Provision_Start) GetParameterValues() []*ParameterValue {
|
||||
if x != nil {
|
||||
return x.ParameterValues
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Provision_Start) GetMetadata() *Provision_Metadata {
|
||||
if x != nil {
|
||||
return x.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Provision_Start) GetState() []byte {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Provision_Start) GetDryRun() bool {
|
||||
if x != nil {
|
||||
return x.DryRun
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Provision_Cancel struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *Provision_Cancel) Reset() {
|
||||
*x = Provision_Cancel{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Provision_Cancel) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Provision_Cancel) ProtoMessage() {}
|
||||
|
||||
func (x *Provision_Cancel) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Provision_Cancel.ProtoReflect.Descriptor instead.
|
||||
func (*Provision_Cancel) Descriptor() ([]byte, []int) {
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 2}
|
||||
}
|
||||
|
||||
type Provision_Request struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Types that are assignable to Type:
|
||||
// *Provision_Request_Start
|
||||
// *Provision_Request_Cancel
|
||||
Type isProvision_Request_Type `protobuf_oneof:"type"`
|
||||
}
|
||||
|
||||
func (x *Provision_Request) Reset() {
|
||||
*x = Provision_Request{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16]
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1203,7 +1319,7 @@ func (x *Provision_Request) String() string {
|
||||
func (*Provision_Request) ProtoMessage() {}
|
||||
|
||||
func (x *Provision_Request) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[16]
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1216,44 +1332,46 @@ func (x *Provision_Request) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Provision_Request.ProtoReflect.Descriptor instead.
|
||||
func (*Provision_Request) Descriptor() ([]byte, []int) {
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 1}
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 3}
|
||||
}
|
||||
|
||||
func (x *Provision_Request) GetDirectory() string {
|
||||
if x != nil {
|
||||
return x.Directory
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Provision_Request) GetParameterValues() []*ParameterValue {
|
||||
if x != nil {
|
||||
return x.ParameterValues
|
||||
func (m *Provision_Request) GetType() isProvision_Request_Type {
|
||||
if m != nil {
|
||||
return m.Type
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Provision_Request) GetMetadata() *Provision_Metadata {
|
||||
if x != nil {
|
||||
return x.Metadata
|
||||
func (x *Provision_Request) GetStart() *Provision_Start {
|
||||
if x, ok := x.GetType().(*Provision_Request_Start); ok {
|
||||
return x.Start
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Provision_Request) GetState() []byte {
|
||||
if x != nil {
|
||||
return x.State
|
||||
func (x *Provision_Request) GetCancel() *Provision_Cancel {
|
||||
if x, ok := x.GetType().(*Provision_Request_Cancel); ok {
|
||||
return x.Cancel
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Provision_Request) GetDryRun() bool {
|
||||
if x != nil {
|
||||
return x.DryRun
|
||||
}
|
||||
return false
|
||||
type isProvision_Request_Type interface {
|
||||
isProvision_Request_Type()
|
||||
}
|
||||
|
||||
type Provision_Request_Start struct {
|
||||
Start *Provision_Start `protobuf:"bytes,1,opt,name=start,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Provision_Request_Cancel struct {
|
||||
Cancel *Provision_Cancel `protobuf:"bytes,2,opt,name=cancel,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*Provision_Request_Start) isProvision_Request_Type() {}
|
||||
|
||||
func (*Provision_Request_Cancel) isProvision_Request_Type() {}
|
||||
|
||||
type Provision_Complete struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -1267,7 +1385,7 @@ type Provision_Complete struct {
|
||||
func (x *Provision_Complete) Reset() {
|
||||
*x = Provision_Complete{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17]
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1280,7 +1398,7 @@ func (x *Provision_Complete) String() string {
|
||||
func (*Provision_Complete) ProtoMessage() {}
|
||||
|
||||
func (x *Provision_Complete) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[17]
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[19]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1293,7 +1411,7 @@ func (x *Provision_Complete) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Provision_Complete.ProtoReflect.Descriptor instead.
|
||||
func (*Provision_Complete) Descriptor() ([]byte, []int) {
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 2}
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 4}
|
||||
}
|
||||
|
||||
func (x *Provision_Complete) GetState() []byte {
|
||||
@@ -1331,7 +1449,7 @@ type Provision_Response struct {
|
||||
func (x *Provision_Response) Reset() {
|
||||
*x = Provision_Response{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18]
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -1344,7 +1462,7 @@ func (x *Provision_Response) String() string {
|
||||
func (*Provision_Response) ProtoMessage() {}
|
||||
|
||||
func (x *Provision_Response) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[18]
|
||||
mi := &file_provisionersdk_proto_provisioner_proto_msgTypes[20]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -1357,7 +1475,7 @@ func (x *Provision_Response) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Provision_Response.ProtoReflect.Descriptor instead.
|
||||
func (*Provision_Response) Descriptor() ([]byte, []int) {
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 3}
|
||||
return file_provisionersdk_proto_provisioner_proto_rawDescGZIP(), []int{10, 5}
|
||||
}
|
||||
|
||||
func (m *Provision_Response) GetType() isProvision_Response_Type {
|
||||
@@ -1520,7 +1638,7 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{
|
||||
0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e,
|
||||
0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xcd, 0x04, 0x0a,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xd8, 0x05, 0x0a,
|
||||
0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x7c, 0x0a, 0x08, 0x4d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x5f,
|
||||
0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x72,
|
||||
@@ -1529,60 +1647,65 @@ var file_provisionersdk_proto_provisioner_proto_rawDesc = []byte{
|
||||
0x0e, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e,
|
||||
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72,
|
||||
0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xdb, 0x01, 0x0a, 0x07, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72,
|
||||
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f,
|
||||
0x72, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d,
|
||||
0x65, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65,
|
||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a,
|
||||
0x07, 0x64, 0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06,
|
||||
0x64, 0x72, 0x79, 0x52, 0x75, 0x6e, 0x1a, 0x6b, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f,
|
||||
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33,
|
||||
0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e,
|
||||
0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
|
||||
0x63, 0x65, 0x73, 0x1a, 0x77, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x24, 0x0a, 0x03, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, 0x00,
|
||||
0x52, 0x03, 0x6c, 0x6f, 0x67, 0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e,
|
||||
0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x3f, 0x0a, 0x08,
|
||||
0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43,
|
||||
0x45, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x08,
|
||||
0x0a, 0x04, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, 0x52, 0x4e,
|
||||
0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x2a, 0x37, 0x0a,
|
||||
0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x00, 0x12,
|
||||
0x08, 0x0a, 0x04, 0x53, 0x54, 0x4f, 0x50, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53,
|
||||
0x54, 0x52, 0x4f, 0x59, 0x10, 0x02, 0x32, 0xd5, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x76, 0x69,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f,
|
||||
0x77, 0x6e, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72,
|
||||
0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x05, 0x50, 0x61,
|
||||
0x72, 0x73, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65,
|
||||
0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61,
|
||||
0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x4e,
|
||||
0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x2d,
|
||||
0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64,
|
||||
0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xd9, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61,
|
||||
0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79,
|
||||
0x12, 0x46, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74,
|
||||
0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74,
|
||||
0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74,
|
||||
0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x64,
|
||||
0x72, 0x79, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x64, 0x72,
|
||||
0x79, 0x52, 0x75, 0x6e, 0x1a, 0x08, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x80,
|
||||
0x01, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74,
|
||||
0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x76,
|
||||
0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74,
|
||||
0x12, 0x37, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50,
|
||||
0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x48,
|
||||
0x00, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x06, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x1a, 0x6b, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74,
|
||||
0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x33, 0x0a, 0x09, 0x72, 0x65, 0x73,
|
||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75,
|
||||
0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x1a, 0x77,
|
||||
0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x6c, 0x6f,
|
||||
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x48, 0x00, 0x52, 0x03, 0x6c, 0x6f, 0x67,
|
||||
0x12, 0x3d, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72,
|
||||
0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c,
|
||||
0x65, 0x74, 0x65, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x42,
|
||||
0x06, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0x3f, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65,
|
||||
0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x00, 0x12, 0x09,
|
||||
0x0a, 0x05, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x46,
|
||||
0x4f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x03, 0x12, 0x09, 0x0a,
|
||||
0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x2a, 0x37, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b,
|
||||
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x09, 0x0a, 0x05, 0x53, 0x54, 0x41, 0x52, 0x54, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54,
|
||||
0x4f, 0x50, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54, 0x52, 0x4f, 0x59, 0x10,
|
||||
0x02, 0x32, 0xa3, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65,
|
||||
0x72, 0x12, 0x42, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72,
|
||||
0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72,
|
||||
0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75,
|
||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x64, 0x65,
|
||||
0x72, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x73, 0x64, 0x6b,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -1598,7 +1721,7 @@ func file_provisionersdk_proto_provisioner_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_provisionersdk_proto_provisioner_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
|
||||
var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
|
||||
var file_provisionersdk_proto_provisioner_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
|
||||
var file_provisionersdk_proto_provisioner_proto_goTypes = []interface{}{
|
||||
(LogLevel)(0), // 0: provisioner.LogLevel
|
||||
(WorkspaceTransition)(0), // 1: provisioner.WorkspaceTransition
|
||||
@@ -1621,9 +1744,11 @@ var file_provisionersdk_proto_provisioner_proto_goTypes = []interface{}{
|
||||
(*Parse_Complete)(nil), // 18: provisioner.Parse.Complete
|
||||
(*Parse_Response)(nil), // 19: provisioner.Parse.Response
|
||||
(*Provision_Metadata)(nil), // 20: provisioner.Provision.Metadata
|
||||
(*Provision_Request)(nil), // 21: provisioner.Provision.Request
|
||||
(*Provision_Complete)(nil), // 22: provisioner.Provision.Complete
|
||||
(*Provision_Response)(nil), // 23: provisioner.Provision.Response
|
||||
(*Provision_Start)(nil), // 21: provisioner.Provision.Start
|
||||
(*Provision_Cancel)(nil), // 22: provisioner.Provision.Cancel
|
||||
(*Provision_Request)(nil), // 23: provisioner.Provision.Request
|
||||
(*Provision_Complete)(nil), // 24: provisioner.Provision.Complete
|
||||
(*Provision_Response)(nil), // 25: provisioner.Provision.Response
|
||||
}
|
||||
var file_provisionersdk_proto_provisioner_proto_depIdxs = []int32{
|
||||
2, // 0: provisioner.ParameterSource.scheme:type_name -> provisioner.ParameterSource.Scheme
|
||||
@@ -1640,22 +1765,22 @@ var file_provisionersdk_proto_provisioner_proto_depIdxs = []int32{
|
||||
10, // 11: provisioner.Parse.Response.log:type_name -> provisioner.Log
|
||||
18, // 12: provisioner.Parse.Response.complete:type_name -> provisioner.Parse.Complete
|
||||
1, // 13: provisioner.Provision.Metadata.workspace_transition:type_name -> provisioner.WorkspaceTransition
|
||||
8, // 14: provisioner.Provision.Request.parameter_values:type_name -> provisioner.ParameterValue
|
||||
20, // 15: provisioner.Provision.Request.metadata:type_name -> provisioner.Provision.Metadata
|
||||
13, // 16: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource
|
||||
10, // 17: provisioner.Provision.Response.log:type_name -> provisioner.Log
|
||||
22, // 18: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete
|
||||
5, // 19: provisioner.Provisioner.Shutdown:input_type -> provisioner.Empty
|
||||
17, // 20: provisioner.Provisioner.Parse:input_type -> provisioner.Parse.Request
|
||||
21, // 21: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request
|
||||
5, // 22: provisioner.Provisioner.Shutdown:output_type -> provisioner.Empty
|
||||
8, // 14: provisioner.Provision.Start.parameter_values:type_name -> provisioner.ParameterValue
|
||||
20, // 15: provisioner.Provision.Start.metadata:type_name -> provisioner.Provision.Metadata
|
||||
21, // 16: provisioner.Provision.Request.start:type_name -> provisioner.Provision.Start
|
||||
22, // 17: provisioner.Provision.Request.cancel:type_name -> provisioner.Provision.Cancel
|
||||
13, // 18: provisioner.Provision.Complete.resources:type_name -> provisioner.Resource
|
||||
10, // 19: provisioner.Provision.Response.log:type_name -> provisioner.Log
|
||||
24, // 20: provisioner.Provision.Response.complete:type_name -> provisioner.Provision.Complete
|
||||
17, // 21: provisioner.Provisioner.Parse:input_type -> provisioner.Parse.Request
|
||||
23, // 22: provisioner.Provisioner.Provision:input_type -> provisioner.Provision.Request
|
||||
19, // 23: provisioner.Provisioner.Parse:output_type -> provisioner.Parse.Response
|
||||
23, // 24: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response
|
||||
22, // [22:25] is the sub-list for method output_type
|
||||
19, // [19:22] is the sub-list for method input_type
|
||||
19, // [19:19] is the sub-list for extension type_name
|
||||
19, // [19:19] is the sub-list for extension extendee
|
||||
0, // [0:19] is the sub-list for field type_name
|
||||
25, // 24: provisioner.Provisioner.Provision:output_type -> provisioner.Provision.Response
|
||||
23, // [23:25] is the sub-list for method output_type
|
||||
21, // [21:23] is the sub-list for method input_type
|
||||
21, // [21:21] is the sub-list for extension type_name
|
||||
21, // [21:21] is the sub-list for extension extendee
|
||||
0, // [0:21] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_provisionersdk_proto_provisioner_proto_init() }
|
||||
@@ -1845,7 +1970,7 @@ func file_provisionersdk_proto_provisioner_proto_init() {
|
||||
}
|
||||
}
|
||||
file_provisionersdk_proto_provisioner_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Provision_Request); i {
|
||||
switch v := v.(*Provision_Start); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -1857,7 +1982,7 @@ func file_provisionersdk_proto_provisioner_proto_init() {
|
||||
}
|
||||
}
|
||||
file_provisionersdk_proto_provisioner_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Provision_Complete); i {
|
||||
switch v := v.(*Provision_Cancel); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -1869,6 +1994,30 @@ func file_provisionersdk_proto_provisioner_proto_init() {
|
||||
}
|
||||
}
|
||||
file_provisionersdk_proto_provisioner_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Provision_Request); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_provisionersdk_proto_provisioner_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Provision_Complete); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_provisionersdk_proto_provisioner_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Provision_Response); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1890,6 +2039,10 @@ func file_provisionersdk_proto_provisioner_proto_init() {
|
||||
(*Parse_Response_Complete)(nil),
|
||||
}
|
||||
file_provisionersdk_proto_provisioner_proto_msgTypes[18].OneofWrappers = []interface{}{
|
||||
(*Provision_Request_Start)(nil),
|
||||
(*Provision_Request_Cancel)(nil),
|
||||
}
|
||||
file_provisionersdk_proto_provisioner_proto_msgTypes[20].OneofWrappers = []interface{}{
|
||||
(*Provision_Response_Log)(nil),
|
||||
(*Provision_Response_Complete)(nil),
|
||||
}
|
||||
@@ -1899,7 +2052,7 @@ func file_provisionersdk_proto_provisioner_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_provisionersdk_proto_provisioner_proto_rawDesc,
|
||||
NumEnums: 5,
|
||||
NumMessages: 19,
|
||||
NumMessages: 21,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -118,13 +118,20 @@ message Provision {
|
||||
string coder_url = 1;
|
||||
WorkspaceTransition workspace_transition = 2;
|
||||
}
|
||||
message Request {
|
||||
message Start {
|
||||
string directory = 1;
|
||||
repeated ParameterValue parameter_values = 2;
|
||||
Metadata metadata = 3;
|
||||
bytes state = 4;
|
||||
bool dry_run = 5;
|
||||
}
|
||||
message Cancel {}
|
||||
message Request {
|
||||
oneof type {
|
||||
Start start = 1;
|
||||
Cancel cancel = 2;
|
||||
}
|
||||
}
|
||||
message Complete {
|
||||
bytes state = 1;
|
||||
string error = 2;
|
||||
@@ -139,7 +146,6 @@ message Provision {
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc Shutdown(Empty) returns (Empty);
|
||||
rpc Parse(Parse.Request) returns (stream Parse.Response);
|
||||
rpc Provision(Provision.Request) returns (stream Provision.Response);
|
||||
rpc Provision(stream Provision.Request) returns (stream Provision.Response);
|
||||
}
|
||||
|
||||
+25
-54
@@ -38,9 +38,8 @@ func (drpcEncoding_File_provisionersdk_proto_provisioner_proto) JSONUnmarshal(bu
|
||||
type DRPCProvisionerClient interface {
|
||||
DRPCConn() drpc.Conn
|
||||
|
||||
Shutdown(ctx context.Context, in *Empty) (*Empty, error)
|
||||
Parse(ctx context.Context, in *Parse_Request) (DRPCProvisioner_ParseClient, error)
|
||||
Provision(ctx context.Context, in *Provision_Request) (DRPCProvisioner_ProvisionClient, error)
|
||||
Provision(ctx context.Context) (DRPCProvisioner_ProvisionClient, error)
|
||||
}
|
||||
|
||||
type drpcProvisionerClient struct {
|
||||
@@ -53,15 +52,6 @@ func NewDRPCProvisionerClient(cc drpc.Conn) DRPCProvisionerClient {
|
||||
|
||||
func (c *drpcProvisionerClient) DRPCConn() drpc.Conn { return c.cc }
|
||||
|
||||
func (c *drpcProvisionerClient) Shutdown(ctx context.Context, in *Empty) (*Empty, error) {
|
||||
out := new(Empty)
|
||||
err := c.cc.Invoke(ctx, "/provisioner.Provisioner/Shutdown", drpcEncoding_File_provisionersdk_proto_provisioner_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *drpcProvisionerClient) Parse(ctx context.Context, in *Parse_Request) (DRPCProvisioner_ParseClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, "/provisioner.Provisioner/Parse", drpcEncoding_File_provisionersdk_proto_provisioner_proto{})
|
||||
if err != nil {
|
||||
@@ -98,23 +88,18 @@ func (x *drpcProvisioner_ParseClient) RecvMsg(m *Parse_Response) error {
|
||||
return x.MsgRecv(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{})
|
||||
}
|
||||
|
||||
func (c *drpcProvisionerClient) Provision(ctx context.Context, in *Provision_Request) (DRPCProvisioner_ProvisionClient, error) {
|
||||
func (c *drpcProvisionerClient) Provision(ctx context.Context) (DRPCProvisioner_ProvisionClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, "/provisioner.Provisioner/Provision", drpcEncoding_File_provisionersdk_proto_provisioner_proto{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &drpcProvisioner_ProvisionClient{stream}
|
||||
if err := x.MsgSend(in, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type DRPCProvisioner_ProvisionClient interface {
|
||||
drpc.Stream
|
||||
Send(*Provision_Request) error
|
||||
Recv() (*Provision_Response, error)
|
||||
}
|
||||
|
||||
@@ -122,6 +107,10 @@ type drpcProvisioner_ProvisionClient struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcProvisioner_ProvisionClient) Send(m *Provision_Request) error {
|
||||
return x.MsgSend(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{})
|
||||
}
|
||||
|
||||
func (x *drpcProvisioner_ProvisionClient) Recv() (*Provision_Response, error) {
|
||||
m := new(Provision_Response)
|
||||
if err := x.MsgRecv(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}); err != nil {
|
||||
@@ -135,41 +124,27 @@ func (x *drpcProvisioner_ProvisionClient) RecvMsg(m *Provision_Response) error {
|
||||
}
|
||||
|
||||
type DRPCProvisionerServer interface {
|
||||
Shutdown(context.Context, *Empty) (*Empty, error)
|
||||
Parse(*Parse_Request, DRPCProvisioner_ParseStream) error
|
||||
Provision(*Provision_Request, DRPCProvisioner_ProvisionStream) error
|
||||
Provision(DRPCProvisioner_ProvisionStream) error
|
||||
}
|
||||
|
||||
type DRPCProvisionerUnimplementedServer struct{}
|
||||
|
||||
func (s *DRPCProvisionerUnimplementedServer) Shutdown(context.Context, *Empty) (*Empty, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCProvisionerUnimplementedServer) Parse(*Parse_Request, DRPCProvisioner_ParseStream) error {
|
||||
return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCProvisionerUnimplementedServer) Provision(*Provision_Request, DRPCProvisioner_ProvisionStream) error {
|
||||
func (s *DRPCProvisionerUnimplementedServer) Provision(DRPCProvisioner_ProvisionStream) error {
|
||||
return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
type DRPCProvisionerDescription struct{}
|
||||
|
||||
func (DRPCProvisionerDescription) NumMethods() int { return 3 }
|
||||
func (DRPCProvisionerDescription) NumMethods() int { return 2 }
|
||||
|
||||
func (DRPCProvisionerDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
case 0:
|
||||
return "/provisioner.Provisioner/Shutdown", drpcEncoding_File_provisionersdk_proto_provisioner_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCProvisionerServer).
|
||||
Shutdown(
|
||||
ctx,
|
||||
in1.(*Empty),
|
||||
)
|
||||
}, DRPCProvisionerServer.Shutdown, true
|
||||
case 1:
|
||||
return "/provisioner.Provisioner/Parse", drpcEncoding_File_provisionersdk_proto_provisioner_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return nil, srv.(DRPCProvisionerServer).
|
||||
@@ -178,13 +153,12 @@ func (DRPCProvisionerDescription) Method(n int) (string, drpc.Encoding, drpc.Rec
|
||||
&drpcProvisioner_ParseStream{in2.(drpc.Stream)},
|
||||
)
|
||||
}, DRPCProvisionerServer.Parse, true
|
||||
case 2:
|
||||
case 1:
|
||||
return "/provisioner.Provisioner/Provision", drpcEncoding_File_provisionersdk_proto_provisioner_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return nil, srv.(DRPCProvisionerServer).
|
||||
Provision(
|
||||
in1.(*Provision_Request),
|
||||
&drpcProvisioner_ProvisionStream{in2.(drpc.Stream)},
|
||||
&drpcProvisioner_ProvisionStream{in1.(drpc.Stream)},
|
||||
)
|
||||
}, DRPCProvisionerServer.Provision, true
|
||||
default:
|
||||
@@ -196,22 +170,6 @@ func DRPCRegisterProvisioner(mux drpc.Mux, impl DRPCProvisionerServer) error {
|
||||
return mux.Register(impl, DRPCProvisionerDescription{})
|
||||
}
|
||||
|
||||
type DRPCProvisioner_ShutdownStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*Empty) error
|
||||
}
|
||||
|
||||
type drpcProvisioner_ShutdownStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcProvisioner_ShutdownStream) SendAndClose(m *Empty) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
||||
type DRPCProvisioner_ParseStream interface {
|
||||
drpc.Stream
|
||||
Send(*Parse_Response) error
|
||||
@@ -228,6 +186,7 @@ func (x *drpcProvisioner_ParseStream) Send(m *Parse_Response) error {
|
||||
type DRPCProvisioner_ProvisionStream interface {
|
||||
drpc.Stream
|
||||
Send(*Provision_Response) error
|
||||
Recv() (*Provision_Request, error)
|
||||
}
|
||||
|
||||
type drpcProvisioner_ProvisionStream struct {
|
||||
@@ -237,3 +196,15 @@ type drpcProvisioner_ProvisionStream struct {
|
||||
func (x *drpcProvisioner_ProvisionStream) Send(m *Provision_Response) error {
|
||||
return x.MsgSend(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{})
|
||||
}
|
||||
|
||||
func (x *drpcProvisioner_ProvisionStream) Recv() (*Provision_Request, error) {
|
||||
m := new(Provision_Request)
|
||||
if err := x.MsgRecv(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (x *drpcProvisioner_ProvisionStream) RecvMsg(m *Provision_Request) error {
|
||||
return x.MsgRecv(m, drpcEncoding_File_provisionersdk_proto_provisioner_proto{})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package provisionersdk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/coder/coder/provisionersdk/proto"
|
||||
)
|
||||
|
||||
// ResourceAddresses returns an index-matching slice of unique addresses
|
||||
// to access resources.
|
||||
func ResourceAddresses(resources []*proto.Resource) ([]string, error) {
|
||||
resourcesByHost := map[string]*proto.Resource{}
|
||||
for _, resource := range resources {
|
||||
otherByName, exists := resourcesByHost[resource.Name]
|
||||
if !exists {
|
||||
resourcesByHost[resource.Name] = resource
|
||||
continue
|
||||
}
|
||||
// If we have conflicting names, to reduce confusion we prepend the types.
|
||||
delete(resourcesByHost, otherByName.Name)
|
||||
otherAddress := fmt.Sprintf("%s.%s", otherByName.Type, otherByName.Name)
|
||||
resourcesByHost[otherAddress] = otherByName
|
||||
address := fmt.Sprintf("%s.%s", resource.Type, resource.Name)
|
||||
_, exists = resourcesByHost[address]
|
||||
if !exists {
|
||||
resourcesByHost[address] = resource
|
||||
continue
|
||||
}
|
||||
return nil, xerrors.Errorf("found resource with conflicting address %q", otherAddress)
|
||||
}
|
||||
|
||||
addresses := make([]string, 0, len(resources))
|
||||
for _, resource := range resources {
|
||||
found := false
|
||||
for host, other := range resourcesByHost {
|
||||
if resource != other {
|
||||
continue
|
||||
}
|
||||
found = true
|
||||
addresses = append(addresses, host)
|
||||
}
|
||||
if !found {
|
||||
panic(fmt.Sprintf("dev error: resource %s.%s wasn't given an address", resource.Type, resource.Name))
|
||||
}
|
||||
}
|
||||
return addresses, nil
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package provisionersdk_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/coder/coder/provisionersdk"
|
||||
"github.com/coder/coder/provisionersdk/proto"
|
||||
)
|
||||
|
||||
func TestResourceAddresses(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Single", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
addresses, err := provisionersdk.ResourceAddresses([]*proto.Resource{{
|
||||
Type: "google_compute_instance",
|
||||
Name: "dev",
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, addresses, 1)
|
||||
require.Equal(t, addresses[0], "dev")
|
||||
})
|
||||
t.Run("Multiple", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
addresses, err := provisionersdk.ResourceAddresses([]*proto.Resource{{
|
||||
Type: "google_compute_instance",
|
||||
Name: "linux",
|
||||
}, {
|
||||
Type: "google_compute_instance",
|
||||
Name: "windows",
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, addresses, 2)
|
||||
require.Equal(t, addresses[0], "linux")
|
||||
require.Equal(t, addresses[1], "windows")
|
||||
})
|
||||
t.Run("ConflictingDifferent", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
addresses, err := provisionersdk.ResourceAddresses([]*proto.Resource{{
|
||||
Type: "google_compute_instance",
|
||||
Name: "dev",
|
||||
}, {
|
||||
Type: "kubernetes_pod",
|
||||
Name: "dev",
|
||||
}})
|
||||
require.NoError(t, err)
|
||||
require.Len(t, addresses, 2)
|
||||
require.Equal(t, addresses[0], "google_compute_instance.dev")
|
||||
require.Equal(t, addresses[1], "kubernetes_pod.dev")
|
||||
})
|
||||
t.Run("ConflictingSame", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := provisionersdk.ResourceAddresses([]*proto.Resource{{
|
||||
Type: "google_compute_instance",
|
||||
Name: "dev",
|
||||
}, {
|
||||
Type: "google_compute_instance",
|
||||
Name: "dev",
|
||||
}})
|
||||
require.Error(t, err)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user