Skip to content

Commit

Permalink
feat: agentMock, RunMock, and Bk plugin annotation is unused
Browse files Browse the repository at this point in the history
  • Loading branch information
therealvio committed Dec 5, 2024
1 parent aed830d commit 2d95081
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 91 deletions.
1 change: 0 additions & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (

require (
github.com/kr/pretty v0.1.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)

Expand Down
2 changes: 0 additions & 2 deletions src/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
Expand Down
3 changes: 1 addition & 2 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import (

func main() {
ctx := context.Background()
agent := &buildkite.Agent{}
fetcher := plugin.EnvironmentConfigFetcher{}
taskRunnerPlugin := plugin.TaskRunnerPlugin{}

err := taskRunnerPlugin.Run(ctx, fetcher, agent)
err := taskRunnerPlugin.Run(ctx, fetcher)

if err != nil {
buildkite.LogFailuref("plugin execution failed: %s\n", err.Error())
Expand Down
19 changes: 1 addition & 18 deletions src/plugin/task-runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ type ConfigFetcher interface {
Fetch(config *Config) error
}

type Agent interface {
Annotate(ctx context.Context, message string, style string, annotationContext string) error
}

func (trp TaskRunnerPlugin) Run(ctx context.Context, fetcher ConfigFetcher, agent Agent) error {
func (trp TaskRunnerPlugin) Run(ctx context.Context, fetcher ConfigFetcher) error {
var config Config
err := fetcher.Fetch(&config)
if err != nil {
Expand All @@ -36,19 +32,6 @@ func (trp TaskRunnerPlugin) Run(ctx context.Context, fetcher ConfigFetcher, agen

buildkite.Log("Executing task-runner plugin\n")

annotation := config.ParameterName
err = agent.Annotate(ctx, annotation, "info", "message")
if err != nil {
buildkite.LogFailuref("buildkite annotation error: %s\n", err.Error())
return err
}
annotation = config.Script
err = agent.Annotate(ctx, annotation, "info", "message")
if err != nil {
buildkite.LogFailuref("buildkite annotation error: %s\n", err.Error())
return err
}

cfg, err := awsconfig.LoadDefaultConfig(ctx)
if err != nil {
log.Fatalf("config load failed: %v", err)
Expand Down
40 changes: 0 additions & 40 deletions src/plugin/task-runner_mocks_test.go

This file was deleted.

28 changes: 0 additions & 28 deletions src/plugin/task-runner_test.go

This file was deleted.

0 comments on commit 2d95081

Please sign in to comment.