|
@@ -47,6 +47,7 @@ type Deletions struct {
|
|
|
type ValidatePorterAppRequest struct {
|
|
type ValidatePorterAppRequest struct {
|
|
|
AppName string `json:"app_name"`
|
|
AppName string `json:"app_name"`
|
|
|
Base64AppProto string `json:"b64_app_proto"`
|
|
Base64AppProto string `json:"b64_app_proto"`
|
|
|
|
|
+ Base64AppOverrides string `json:"b64_app_overrides"`
|
|
|
DeploymentTargetId string `json:"deployment_target_id"`
|
|
DeploymentTargetId string `json:"deployment_target_id"`
|
|
|
CommitSHA string `json:"commit_sha"`
|
|
CommitSHA string `json:"commit_sha"`
|
|
|
Deletions Deletions `json:"deletions"`
|
|
Deletions Deletions `json:"deletions"`
|
|
@@ -121,11 +122,32 @@ func (c *ValidatePorterAppHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ
|
|
|
telemetry.AttributeKV{Key: "commit-sha", Value: request.CommitSHA},
|
|
telemetry.AttributeKV{Key: "commit-sha", Value: request.CommitSHA},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ var overrides *porterv1.PorterApp
|
|
|
|
|
+ if request.Base64AppOverrides != "" {
|
|
|
|
|
+ decoded, err := base64.StdEncoding.DecodeString(request.Base64AppOverrides)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ err := telemetry.Error(ctx, span, err, "error decoding base yaml")
|
|
|
|
|
+ c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusBadRequest))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ overrides = &porterv1.PorterApp{}
|
|
|
|
|
+ err = helpers.UnmarshalContractObject(decoded, overrides)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ err := telemetry.Error(ctx, span, err, "error unmarshalling app proto")
|
|
|
|
|
+ c.HandleAPIError(w, r, apierrors.NewErrPassThroughToClient(err, http.StatusBadRequest))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "validated-with-overrides", Value: true})
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
validateReq := connect.NewRequest(&porterv1.ValidatePorterAppRequest{
|
|
validateReq := connect.NewRequest(&porterv1.ValidatePorterAppRequest{
|
|
|
ProjectId: int64(project.ID),
|
|
ProjectId: int64(project.ID),
|
|
|
DeploymentTargetId: request.DeploymentTargetId,
|
|
DeploymentTargetId: request.DeploymentTargetId,
|
|
|
CommitSha: request.CommitSHA,
|
|
CommitSha: request.CommitSHA,
|
|
|
App: appProto,
|
|
App: appProto,
|
|
|
|
|
+ AppOverrides: overrides,
|
|
|
Deletions: &porterv1.Deletions{
|
|
Deletions: &porterv1.Deletions{
|
|
|
ServiceNames: request.Deletions.ServiceNames,
|
|
ServiceNames: request.Deletions.ServiceNames,
|
|
|
EnvVariableNames: request.Deletions.EnvVariableNames,
|
|
EnvVariableNames: request.Deletions.EnvVariableNames,
|