这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix issue where uploaded files were not included in vercel builder #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions client/deployment_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ type CreateDeploymentRequest struct {
Build struct {
Environment map[string]string `json:"env,omitempty"`
} `json:"build,omitempty"`
ProjectID string `json:"project,omitempty"`
ProjectSettings map[string]*string `json:"projectSettings,omitempty"`
Name string `json:"name"`
Regions []string `json:"regions,omitempty"`
Routes []interface{} `json:"routes,omitempty"`
Target string `json:"target,omitempty"`
ProjectID string `json:"project,omitempty"`
ProjectSettings map[string]interface{} `json:"projectSettings"`
Name string `json:"name"`
Regions []string `json:"regions,omitempty"`
Routes []interface{} `json:"routes,omitempty"`
Target string `json:"target,omitempty"`
}

type DeploymentResponse struct {
Expand Down Expand Up @@ -130,7 +130,7 @@ func (c *Client) CreateDeployment(ctx context.Context, request CreateDeploymentR
request.Name = request.ProjectID // Name is ignored if project is specified
request.Build.Environment = request.Environment // Ensure they are both the same, as project environment variables are
url := fmt.Sprintf("%s/v12/now/deployments?skipAutoDetectionConfirmation=1", c.baseURL)
tflog.Info(ctx, "creating deployment", "request", string(mustMarshal(request.Files)))
tflog.Info(ctx, "creating deployment", "request", string(mustMarshal(request)))
if teamID != "" {
url = fmt.Sprintf("%s&teamId=%s", url, teamID)
}
Expand Down
10 changes: 6 additions & 4 deletions vercel/resource_deployment_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Deployment struct {
URL types.String `tfsdk:"url"`
}

func setIfNotUnknown(m map[string]*string, v types.String, name string) {
func setIfNotUnknown(m map[string]interface{}, v types.String, name string) {
if v.Null {
m[name] = nil
}
Expand All @@ -39,11 +39,13 @@ func setIfNotUnknown(m map[string]*string, v types.String, name string) {
}
}

func (p *ProjectSettings) toRequest() map[string]*string {
func (p *ProjectSettings) toRequest() map[string]interface{} {
res := map[string]interface{}{
"sourceFilesOutsideRootDirectory": true,
}
if p == nil {
return nil
return res
}
res := map[string]*string{}

setIfNotUnknown(res, p.BuildCommand, "buildCommand")
setIfNotUnknown(res, p.Framework, "framework")
Expand Down