-
Notifications
You must be signed in to change notification settings - Fork 9
/
provider.go
41 lines (35 loc) · 1.13 KB
/
provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package mock
import (
configv1alpha1 "github.com/padok-team/burrito/api/v1alpha1"
"github.com/padok-team/burrito/internal/burrito/config"
"github.com/padok-team/burrito/internal/controllers/terraformpullrequest/comment"
log "github.com/sirupsen/logrus"
)
type Mock struct{}
func (m *Mock) Init(c *config.Config) error {
log.Infof("Mock provider initialized")
return nil
}
func (m *Mock) IsFromProvider(pr *configv1alpha1.TerraformPullRequest) bool {
return pr.Spec.Provider == "mock"
}
func (m *Mock) GetChanges(repository *configv1alpha1.TerraformRepository, pr *configv1alpha1.TerraformPullRequest) ([]string, error) {
log.Infof("Mock provider all changed files")
var allChangedFiles []string
// Handle not useful PR
if pr.Spec.ID == "100" {
allChangedFiles = []string{
"README.md",
}
return allChangedFiles, nil
}
allChangedFiles = []string{
"terraform/main.tf",
"terragrunt/inputs.hcl",
}
return allChangedFiles, nil
}
func (m *Mock) Comment(repository *configv1alpha1.TerraformRepository, pr *configv1alpha1.TerraformPullRequest, comment comment.Comment) error {
log.Infof("Mock provider comment posted")
return nil
}