File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 5
5
require (
6
6
github.com/aws/aws-sdk-go v1.37.1
7
7
github.com/prometheus/client_golang v1.9.0
8
+ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
8
9
)
Original file line number Diff line number Diff line change @@ -312,6 +312,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ
312
312
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 /go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM =
313
313
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 /go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM =
314
314
golang.org/x/sync v0.0.0-20190423024810-112230192c58 /go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM =
315
+ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY =
315
316
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e /go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM =
316
317
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc /go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY =
317
318
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 /go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY =
Original file line number Diff line number Diff line change 7
7
"os"
8
8
"strconv"
9
9
"strings"
10
+ "sync"
10
11
"time"
11
12
12
13
"github.com/aws/aws-sdk-go/aws"
@@ -109,16 +110,25 @@ func getECRImageScanFindings(repositories []string) error {
109
110
return fmt .Errorf ("failed to get image tags: %w" , err )
110
111
}
111
112
113
+ var wg sync.WaitGroup
114
+
112
115
for _ , repo := range repositories {
113
116
for _ , imageTag := range imageTags {
114
- result , err := describeImageScanFindings (svc , repo , imageTag )
115
- if err != nil {
116
- return fmt .Errorf ("failed to describe image scan findings: %w" , err )
117
- }
117
+ wg .Add (1 )
118
118
119
- collectMetrics (result )
119
+ go func (svc * ecr.ECR , repo string , imageTag string ) {
120
+ result , err := describeImageScanFindings (svc , repo , imageTag )
121
+ if err != nil {
122
+ log .Printf ("failed to describe image scan findings: %v" , err )
123
+ }
124
+
125
+ collectMetrics (result )
126
+ wg .Done ()
127
+ }(svc , repo , imageTag )
120
128
}
121
129
}
130
+ wg .Wait ()
131
+
122
132
return nil
123
133
}
124
134
You can’t perform that action at this time.
0 commit comments