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

[GitHub] [skywalking-infra-e2e] ethan256 opened a new pull request, #104: Automatically pull images before loading into KinD

ethan256 opened a new pull request, #104:
URL: https://github.com/apache/skywalking-infra-e2e/pull/104

   When the image does not exist locally, the image is automatically pulled before importing into KinD.


-- 
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


[GitHub] [skywalking-infra-e2e] lujiajing1126 commented on a diff in pull request #104: Automatically pull images before loading into KinD

Posted by "lujiajing1126 (via GitHub)" <gi...@apache.org>.
lujiajing1126 commented on code in PR #104:
URL: https://github.com/apache/skywalking-infra-e2e/pull/104#discussion_r1111428065


##########
internal/components/setup/kind.go:
##########
@@ -73,8 +77,76 @@ type kindPort struct {
 	waitExpose string // Need to use when expose
 }
 
-//nolint:gocyclo // skip the cyclomatic complexity check here
+func listLocalImages(ctx context.Context, cli *docker.Client) (map[string]struct{}, error) {
+	summary, err := cli.ImageList(ctx, types.ImageListOptions{})
+	if err != nil {
+		return nil, err
+	}
+	res := make(map[string]struct{}, len(summary))
+	for i := 0; i < len(summary); i++ {
+		tags := summary[i].RepoTags
+		for j := 0; j < len(tags); j++ {
+			res[tags[j]] = struct{}{}
+		}
+	}
+	return res, nil
+}
+
+// pullImages pull docker image from a private repository
+func pullImages(ctx context.Context, images []string) error {
+	cli, err := docker.NewClientWithOpts(docker.FromEnv)
+	if err != nil {
+		return err
+	}
+	defer cli.Close()
+
+	localImages, err := listLocalImages(ctx, cli)
+	if err != nil {
+		logger.Log.Error("list local images error", "error", err)

Review Comment:
   Since the error is returned and logged in the caller, we don't need to log here. A simple `errors.Wrap` can be used.



##########
internal/components/setup/kind.go:
##########
@@ -117,6 +189,11 @@ func KindSetup(e2eConfig *config.E2EConfig) error {
 
 	// import images
 	if len(e2eConfig.Setup.Kind.ImportImages) > 0 {
+		// pull images if this image not exist
+		if err := pullImages(context.Background(), e2eConfig.Setup.Kind.ImportImages); err != nil {

Review Comment:
   You must expand images first!



##########
internal/components/setup/kind.go:
##########
@@ -73,8 +77,76 @@ type kindPort struct {
 	waitExpose string // Need to use when expose
 }
 
-//nolint:gocyclo // skip the cyclomatic complexity check here
+func listLocalImages(ctx context.Context, cli *docker.Client) (map[string]struct{}, error) {
+	summary, err := cli.ImageList(ctx, types.ImageListOptions{})
+	if err != nil {
+		return nil, err
+	}
+	res := make(map[string]struct{}, len(summary))
+	for i := 0; i < len(summary); i++ {
+		tags := summary[i].RepoTags
+		for j := 0; j < len(tags); j++ {
+			res[tags[j]] = struct{}{}
+		}
+	}
+	return res, nil
+}
+
+// pullImages pull docker image from a private repository

Review Comment:
   ```suggestion
   // pullImages pulls docker image from a docker repository
   ```
   
   Not necessary to be a "private" repo.



-- 
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


[GitHub] [skywalking-infra-e2e] lujiajing1126 commented on pull request #104: Automatically pull images before loading into KinD

Posted by "lujiajing1126 (via GitHub)" <gi...@apache.org>.
lujiajing1126 commented on PR #104:
URL: https://github.com/apache/skywalking-infra-e2e/pull/104#issuecomment-1438257439

   Could u pls have another check? @kezhenxu94 


-- 
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


[GitHub] [skywalking-infra-e2e] wu-sheng merged pull request #104: Automatically pull images before loading into KinD

Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng merged PR #104:
URL: https://github.com/apache/skywalking-infra-e2e/pull/104


-- 
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