Skip to content

Commit

Permalink
Merge pull request #80 from jgramoll/required_artifact_ids
Browse files Browse the repository at this point in the history
add support for required_artifact_ids
  • Loading branch information
jgramoll committed Sep 23, 2020
2 parents 35b479e + 1ff6d6d commit 527e6bc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/base_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type BaseStage struct {
RestrictedExecutionWindow *StageExecutionWindow `json:"restrictedExecutionWindow"`
Notifications *[]*Notification `json:"notifications"`
ExpectedArtifacts *[]*ManifestExpectedArtifact `json:"expectedArtifacts"`
RequiredArtifactIds *[]string `json:"requiredArtifactIds"`
}

func newBaseStage(t StageType) *BaseStage {
Expand All @@ -29,6 +30,7 @@ func newBaseStage(t StageType) *BaseStage {
FailPipeline: true,
RequisiteStageRefIds: []string{},
ExpectedArtifacts: &[]*ManifestExpectedArtifact{},
RequiredArtifactIds: &[]string{},
}
}

Expand Down
8 changes: 8 additions & 0 deletions provider/pipeline_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type baseStage struct {
StageTimeoutMS int `mapstructure:"stage_timeout_ms"`
RestrictExecutionDuringTimeWindow bool `mapstructure:"restrict_execution_during_time_window"`
RestrictedExecutionWindow *[]*stageExecutionWindow `mapstructure:"restricted_execution_window"`
RequiredArtifactIds *[]string `mapstructure:"required_artifact_ids"`
}

func newBaseStage() *baseStage {
Expand Down Expand Up @@ -63,6 +64,7 @@ func (s *baseStage) baseToClientStage(cs *client.BaseStage, refID string, notifi
cs.StageTimeoutMS = s.StageTimeoutMS
cs.RestrictExecutionDuringTimeWindow = s.RestrictExecutionDuringTimeWindow
cs.RestrictedExecutionWindow = toClientExecutionWindow(s.RestrictedExecutionWindow)
cs.RequiredArtifactIds = s.RequiredArtifactIds
return nil
}

Expand All @@ -88,6 +90,7 @@ func (s *baseStage) baseFromClientStage(clientStage *client.BaseStage, notificat
s.StageTimeoutMS = clientStage.StageTimeoutMS
s.RestrictExecutionDuringTimeWindow = clientStage.RestrictExecutionDuringTimeWindow
s.RestrictedExecutionWindow = fromClientExecutionWindow(clientStage.RestrictedExecutionWindow)
s.RequiredArtifactIds = clientStage.RequiredArtifactIds
return nil
}

Expand Down Expand Up @@ -144,5 +147,10 @@ func (s *baseStage) baseSetResourceData(d *schema.ResourceData) error {
if err != nil {
return err
}
err = d.Set("required_artifact_ids", s.RequiredArtifactIds)
if err != nil {
return err
}

return nil
}
8 changes: 8 additions & 0 deletions provider/pipeline_stage_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ func stageResource(in map[string]*schema.Schema) map[string]*schema.Schema {
MaxItems: 1,
Elem: stageEnabledResource(),
},
"required_artifact_ids": {
Type: schema.TypeList,
Description: "These artifacts must be present in the context for this stage to successfully complete. Artifacts specified will be bound to the deployed manifest.",
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
}

// merge input
Expand Down

0 comments on commit 527e6bc

Please sign in to comment.