You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "mrproliu (via GitHub)" <gi...@apache.org> on 2023/02/17 03:36:01 UTC

[GitHub] [skywalking-infra-e2e] mrproliu commented on a diff in pull request #101: support pull images in kind mod (#10397)

mrproliu commented on code in PR #101:
URL: https://github.com/apache/skywalking-infra-e2e/pull/101#discussion_r1109264943


##########
internal/components/setup/kind.go:
##########
@@ -73,8 +77,38 @@ type kindPort struct {
 	waitExpose string // Need to use when expose
 }
 
-//nolint:gocyclo // skip the cyclomatic complexity check here
+// pullImages pull docker image from a private repository
+func pullImages(images []string) error {
+	cli, err := docker.NewClientWithOpts(docker.FromEnv)
+	if err != nil {
+		return err
+	}
+	defer cli.Close()
+
+	var count int32
+	var wg sync.WaitGroup
+	for _, image := range images {
+		wg.Add(1)
+		go func(image string) {
+			defer wg.Done()
+			out, err := cli.ImagePull(context.Background(), image, types.ImagePullOptions{})
+			if err != nil {
+				logger.Log.Error("pull image error", "name", image, "error", err)
+			}
+			atomic.AddInt32(&count, 1)
+			out.Close()
+		}(image)
+	}
+	wg.Wait()
+	if int(count) != len(images) {

Review Comment:
   I think this condition is always `true`? Because even if the error is detected, the count is always added. Please re-check and run it locally. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org