Skip to content
Open
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
25 changes: 23 additions & 2 deletions pkg/app/pipedv1/plugin/cloudrun/config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@

package config

import "github.com/pipe-cd/piped-plugin-sdk-go/unit"
import (
"encoding/json"

"github.com/creasty/defaults"
"github.com/pipe-cd/piped-plugin-sdk-go/unit"
)

type CloudRunApplicationSpec struct {
// Input for CloudRun deployment such as docker image...
Expand All @@ -23,10 +28,26 @@ type CloudRunApplicationSpec struct {
QuickSync CloudRunSyncStageOptions `json:"quickSync"`
}

func (s *CloudRunApplicationSpec) UnmarshalJSON(data []byte) error {
type alias CloudRunApplicationSpec

var a alias
if err := json.Unmarshal(data, &a); err != nil {
return err
}

*s = CloudRunApplicationSpec(a)
if err := defaults.Set(s); err != nil {
return err
}

return nil
}

type CloudRunDeploymentInput struct {
// The name of service manifest file placing in application directory.
// Default is service.yaml
ServiceManifestFile string `json:"serviceManifestFile"`
ServiceManifestFile string `json:"serviceManifestFile" default:"service.yaml"`
}

// CloudRunSyncStageOptions contains all configurable values for a CLOUDRUN_SYNC stage.
Expand Down
22 changes: 22 additions & 0 deletions pkg/app/pipedv1/plugin/terraform/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

package config

import (
"encoding/json"

"github.com/creasty/defaults"
)

// Config represents the plugin-scoped configuration.
type Config struct{}

Expand All @@ -30,6 +36,22 @@ type DeployTargetConfig struct {
DriftDetectionEnabled *bool `json:"driftDetectionEnabled" default:"true"`
}

func (c *DeployTargetConfig) UnmarshalJSON(data []byte) error {
type alias DeployTargetConfig

var a alias
if err := json.Unmarshal(data, &a); err != nil {
return err
}

*c = DeployTargetConfig(a)
if err := defaults.Set(c); err != nil {
return err
}

return nil
}

// ApplicationConfigSpec represents the application-scoped plugin config.
type ApplicationConfigSpec struct {
// The terraform workspace name.
Expand Down