You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/04/13 02:20:05 UTC

[skywalking-infra-e2e] branch goinstall created (now 246dce6)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a change to branch goinstall
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git


      at 246dce6  Support installing via go install and add install doc

This branch includes the following new commits:

     new 246dce6  Support installing via go install and add install doc

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking-infra-e2e] 01/01: Support installing via go install and add install doc

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch goinstall
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git

commit 246dce6495d7b9f50572369b9d6fa4003a3ee534
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Apr 13 09:59:16 2022 +0800

    Support installing via go install and add install doc
---
 .gitignore                            |  7 ++++---
 Makefile                              |  6 +++---
 cmd/{ => e2e}/main.go                 |  0
 docs/en/setup/Install.md              | 30 ++++++++++++++++++++++++++++++
 docs/en/setup/README.md               |  3 ++-
 docs/menu.yml                         |  4 +++-
 internal/components/cleanup/kind.go   |  3 +--
 internal/components/verifier/funcs.go |  6 +++---
 internal/config/globalConfig.go       |  5 ++---
 internal/util/k8s.go                  |  5 ++---
 internal/util/utils.go                |  5 ++---
 11 files changed, 52 insertions(+), 22 deletions(-)

diff --git a/.gitignore b/.gitignore
index 773aa1e..2b6d05a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,17 +5,18 @@
 # the Apache License, Version 2.0 (the "License"); you may
 # not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# 
+#
 .idea/
 bin/
 .DS_Store
 coverage.txt
+.vscode/
diff --git a/Makefile b/Makefile
index d7b224d..0c88cb1 100644
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,9 @@
 # the Apache License, Version 2.0 (the "License"); you may
 # not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-# 
+#
 #     http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -55,7 +55,7 @@ test: clean
 .PHONY: $(PLATFORMS)
 $(PLATFORMS):
 	mkdir -p $(OUT_DIR)
-	GOOS=$(os) GOARCH=$(GOARCH) $(GO_BUILD) $(GO_BUILD_FLAGS) -ldflags "$(GO_BUILD_LDFLAGS)" -o $(OUT_DIR)/$(os)/$(PROJECT) cmd/main.go
+	GOOS=$(os) GOARCH=$(GOARCH) $(GO_BUILD) $(GO_BUILD_FLAGS) -ldflags "$(GO_BUILD_LDFLAGS)" -o $(OUT_DIR)/$(os)/$(PROJECT) cmd/e2e/main.go
 
 .PHONY: build
 build: windows linux darwin
diff --git a/cmd/main.go b/cmd/e2e/main.go
similarity index 100%
rename from cmd/main.go
rename to cmd/e2e/main.go
diff --git a/docs/en/setup/Install.md b/docs/en/setup/Install.md
new file mode 100644
index 0000000..42eec17
--- /dev/null
+++ b/docs/en/setup/Install.md
@@ -0,0 +1,30 @@
+# Install SkyWalking Infra E2E
+
+## Download pre-built binaries
+
+Download the pre-built binaries from [our website](https://skywalking.apache.org/downloads/#SkyWalkingInfraE2E),
+currently we have pre-built binaries for macOS, Linux and Windows. Extract the tarball and add `bin/<os>/e2e`
+to you `PATH` environment variable.
+
+## Install from source codes
+
+If you want to try some features that are not released yet, you can compile from the source code.
+
+```shell
+mkdir skywalking-infra-e2e && cd skywalking-infra-e2e
+git clone https://github.com/apache/skywalking-infra-e2e.git .
+make build
+```
+
+Then add the binary in `bin/<os>/e2e` to your `PATH`.
+
+## Install via `go install`
+
+If you already have Go SDK installed, you can also directly install `e2e` via `go install`.
+
+```shell
+go install github.com/apache/skywalking-infra-e2e/cmd/e2e@<revision>
+```
+
+Note that installation via `go install` is only supported after Git commit (TODO after this gets merged)
+so you can only `go install` a revision afterwards.
diff --git a/docs/en/setup/README.md b/docs/en/setup/README.md
index 679d47b..9961f58 100644
--- a/docs/en/setup/README.md
+++ b/docs/en/setup/README.md
@@ -3,5 +3,6 @@
 The most important thing in E2E Testing is that it uses a separate configuration file and command to execute.
 If you haven't read the [Module Design](../concepts-and-designs/module-design.md), recommend read this document first.
 
+* [Installation](Install.md)
 * [Configuration file](Configuration-File.md)
-* [Run E2E Tests](Run-E2E-Tests.md)
\ No newline at end of file
+* [Run E2E Tests](Run-E2E-Tests.md)
diff --git a/docs/menu.yml b/docs/menu.yml
index 71e2dbd..4ad2e27 100644
--- a/docs/menu.yml
+++ b/docs/menu.yml
@@ -27,6 +27,8 @@ catalog:
         path: /en/concepts-and-designs/module-design
   - name: Setup
     catalog:
+      - name: Installation
+        path: /en/setup/install
       - name: Configuration file
         path: /en/setup/configuration-file
       - name: Run E2E Tests
@@ -34,4 +36,4 @@ catalog:
   - name: Contribution
     catalog:
       - name: Compiling Guidance
-        path: /en/contribution/compiling-guidance
\ No newline at end of file
+        path: /en/contribution/compiling-guidance
diff --git a/internal/components/cleanup/kind.go b/internal/components/cleanup/kind.go
index 9e2abf6..f0f6888 100644
--- a/internal/components/cleanup/kind.go
+++ b/internal/components/cleanup/kind.go
@@ -19,7 +19,6 @@
 package cleanup
 
 import (
-	"io/ioutil"
 	"os"
 	"strings"
 
@@ -57,7 +56,7 @@ func KindCleanUp(e2eConfig *config.E2EConfig) error {
 }
 
 func getKindClusterName(kindConfigFilePath string) (name string, err error) {
-	data, err := ioutil.ReadFile(kindConfigFilePath)
+	data, err := os.ReadFile(kindConfigFilePath)
 	if err != nil {
 		return "", err
 	}
diff --git a/internal/components/verifier/funcs.go b/internal/components/verifier/funcs.go
index af8a0ea..86a780b 100644
--- a/internal/components/verifier/funcs.go
+++ b/internal/components/verifier/funcs.go
@@ -56,16 +56,16 @@ func notEmpty(s string) string {
 	if len(strings.TrimSpace(s)) > 0 {
 		return s
 	}
-	return fmt.Sprintf(`<"%s" is empty, wanted is not empty>`, s)
+	return fmt.Sprintf("<%q is empty, wanted is not empty>", s)
 }
 
 func regexpMatch(s, pattern string) string {
 	matched, err := regexp.MatchString(pattern, s)
 	if err != nil {
-		return fmt.Sprintf(`<"%s">`, err)
+		return fmt.Sprintf(`<%q>`, err)
 	}
 	if !matched {
-		return fmt.Sprintf(`<"%s" does not match the pattern %s">`, s, pattern)
+		return fmt.Sprintf("<%q does not match the pattern %q>", s, pattern)
 	}
 	return s
 }
diff --git a/internal/config/globalConfig.go b/internal/config/globalConfig.go
index ff50c9c..13899af 100644
--- a/internal/config/globalConfig.go
+++ b/internal/config/globalConfig.go
@@ -20,7 +20,6 @@ package config
 
 import (
 	"fmt"
-	"io/ioutil"
 	"os"
 	"path/filepath"
 
@@ -53,7 +52,7 @@ func ReadGlobalConfigFile() {
 		return
 	}
 
-	data, err := ioutil.ReadFile(util.CfgFile)
+	data, err := os.ReadFile(util.CfgFile)
 	if err != nil {
 		GlobalConfig.Error = fmt.Errorf("read e2e config file %s error: %s", util.CfgFile, err)
 		return
@@ -115,7 +114,7 @@ func convertSingleCase(verifyCase VerifyCase, baseFile string) ([]VerifyCase, er
 			return nil, fmt.Errorf("reuse case config file %s not exist", includePath)
 		}
 
-		data, err := ioutil.ReadFile(includePath)
+		data, err := os.ReadFile(includePath)
 		if err != nil {
 			return nil, fmt.Errorf("reuse case config file %s error: %s", includePath, err)
 		}
diff --git a/internal/util/k8s.go b/internal/util/k8s.go
index 2da0496..6213b07 100644
--- a/internal/util/k8s.go
+++ b/internal/util/k8s.go
@@ -21,7 +21,6 @@ package util
 import (
 	"bytes"
 	"context"
-	"io/ioutil"
 	"os"
 	"path/filepath"
 	"strings"
@@ -68,7 +67,7 @@ func ConnectToK8sCluster(kubeConfigPath string) (info *K8sClusterInfo, err error
 		return nil, err
 	}
 
-	kubeConfigYaml, err := ioutil.ReadFile(kubeConfigPath)
+	kubeConfigYaml, err := os.ReadFile(kubeConfigPath)
 	if err != nil {
 		return nil, err
 	}
@@ -168,7 +167,7 @@ func GetManifests(manifests string) (files []string, err error) {
 
 // OperateManifest operates manifest in k8s cluster which kind created.
 func OperateManifest(c *kubernetes.Clientset, dc dynamic.Interface, manifest string, operation apiv1.Operation) error {
-	b, err := ioutil.ReadFile(manifest)
+	b, err := os.ReadFile(manifest)
 	if err != nil {
 		return err
 	}
diff --git a/internal/util/utils.go b/internal/util/utils.go
index 3d4146f..a182ed8 100644
--- a/internal/util/utils.go
+++ b/internal/util/utils.go
@@ -22,7 +22,6 @@ import (
 	"bytes"
 	_ "embed"
 	"errors"
-	"io/ioutil"
 	"os"
 	"os/exec"
 	"path/filepath"
@@ -44,7 +43,7 @@ func PathExist(_path string) bool {
 // ReadFileContent reads the file content.
 func ReadFileContent(filename string) (string, error) {
 	if PathExist(filename) {
-		content, err := ioutil.ReadFile(filename)
+		content, err := os.ReadFile(filename)
 		if err != nil {
 			return "", err
 		}
@@ -102,7 +101,7 @@ func hookScript() (string, error) {
 }
 
 func ExportEnvVars(envFile string) {
-	b, err := ioutil.ReadFile(envFile)
+	b, err := os.ReadFile(envFile)
 	if err != nil {
 		logger.Log.Warnf("failed to export environment variables, %v", err)
 		return