From 8a4efe5a3c547741b7d1baf41da265704103e9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20SZKIBA?= Date: Thu, 23 Jan 2025 10:46:41 +0100 Subject: [PATCH] Embedded k6 PoC removed --- .github/workflows/build.yml | 14 --- .github/workflows/lint.yml | 15 ---- .github/workflows/release.yml | 14 --- .github/workflows/test.yml | 15 ---- .gitignore | 2 - CONTRIBUTING.md | 7 -- Makefile | 9 -- README.md | 14 --- cmd/cmd.go | 5 +- cmd/cmd_test.go | 2 +- cmd/help.md | 4 - cmd/k6exec/.gitignore | 1 - cmd/k6exec/embed.go | 145 ------------------------------ cmd/k6exec/embed_darwin_amd64.go | 9 -- cmd/k6exec/embed_darwin_arm64.go | 9 -- cmd/k6exec/embed_linux_amd64.go | 9 -- cmd/k6exec/embed_linux_arm64.go | 9 -- cmd/k6exec/embed_windows_amd64.go | 9 -- cmd/k6exec/embed_windows_arm64.go | 9 -- cmd/k6exec/main.go | 2 +- cmd/state.go | 3 +- cmd/state_internal_test.go | 4 +- command.go | 2 +- go.mod | 2 +- k6-version.txt | 1 - options.go | 17 ---- provision.go | 26 +++--- releases/v0.3.0.md | 11 +++ tools/gendoc/main.go | 2 +- tools/getk6 | 55 ------------ 30 files changed, 31 insertions(+), 395 deletions(-) delete mode 100644 cmd/k6exec/.gitignore delete mode 100644 cmd/k6exec/embed.go delete mode 100644 cmd/k6exec/embed_darwin_amd64.go delete mode 100644 cmd/k6exec/embed_darwin_arm64.go delete mode 100644 cmd/k6exec/embed_linux_amd64.go delete mode 100644 cmd/k6exec/embed_linux_arm64.go delete mode 100644 cmd/k6exec/embed_windows_amd64.go delete mode 100644 cmd/k6exec/embed_windows_arm64.go delete mode 100644 k6-version.txt create mode 100644 releases/v0.3.0.md delete mode 100755 tools/getk6 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 157a7ea..aad6e17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,25 +15,11 @@ on: jobs: build: runs-on: ubuntu-latest - env: - EGET_DIR: ${{github.workspace}}/.eget - EGET_CONFIG: ${{github.workspace}}/.eget/.eget.toml steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup eget - shell: bash - run: | - curl https://zyedidia.github.io/eget.sh | sh - mkdir -p $EGET_DIR && mv eget $EGET_DIR - DIR=$(readlink -f $EGET_DIR) # workaround for windows + toml - printf "[global]\ntarget='$DIR'\nquiet=true\ngithub_token='${{ github.token }}'\n" > $EGET_CONFIG - echo $EGET_DIR >> $GITHUB_PATH - echo "EGET_CONFIG=$EGET_CONFIG" >> $GITHUB_ENV - - name: Download k6 - run: ./tools/getk6 $(< k6-version.txt) - name: Set up Go uses: actions/setup-go@v5 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9cc672c..4dc83e1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,24 +20,9 @@ jobs: lint: name: lint runs-on: ubuntu-latest - env: - EGET_DIR: ${{github.workspace}}/.eget - EGET_CONFIG: ${{github.workspace}}/.eget/.eget.toml steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup eget - shell: bash - run: | - curl https://zyedidia.github.io/eget.sh | sh - mkdir -p $EGET_DIR && mv eget $EGET_DIR - DIR=$(readlink -f $EGET_DIR) # workaround for windows + toml - printf "[global]\ntarget='$DIR'\nquiet=true\ngithub_token='${{ github.token }}'\n" > $EGET_CONFIG - echo $EGET_DIR >> $GITHUB_PATH - echo "EGET_CONFIG=$EGET_CONFIG" >> $GITHUB_ENV - - name: Download k6 - shell: bash - run: ./tools/getk6 $(< k6-version.txt) - name: Go linter uses: golangci/golangci-lint-action@v6 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e242ce7..6efb50b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,8 +12,6 @@ jobs: runs-on: ubuntu-latest env: REGISTRY: ghcr.io - EGET_DIR: ${{github.workspace}}/.eget - EGET_CONFIG: ${{github.workspace}}/.eget/.eget.toml steps: - name: Checkout uses: actions/checkout@v4 @@ -23,18 +21,6 @@ jobs: uses: actions/setup-go@v5 with: go-version: "1.23.x" - - name: Setup eget - shell: bash - run: | - curl https://zyedidia.github.io/eget.sh | sh - mkdir -p $EGET_DIR && mv eget $EGET_DIR - DIR=$(readlink -f $EGET_DIR) # workaround for windows + toml - printf "[global]\ntarget='$DIR'\nquiet=true\ngithub_token='${{ github.token }}'\n" > $EGET_CONFIG - echo $EGET_DIR >> $GITHUB_PATH - echo "EGET_CONFIG=$EGET_CONFIG" >> $GITHUB_ENV - - name: Download k6 - shell: bash - run: ./tools/getk6 $(< k6-version.txt) - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 399b395..de1cc4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,8 +25,6 @@ jobs: runs-on: ${{matrix.platform}} env: REGISTRY: ghcr.io - EGET_DIR: ${{github.workspace}}/.eget - EGET_CONFIG: ${{github.workspace}}/.eget/.eget.toml steps: - name: Install Go uses: actions/setup-go@v5 @@ -34,19 +32,6 @@ jobs: go-version: "1.23.x" - name: Checkout code uses: actions/checkout@v4 - - name: Setup eget - shell: bash - run: | - curl https://zyedidia.github.io/eget.sh | sh - mkdir -p $EGET_DIR && mv eget $EGET_DIR - DIR=$(readlink -f $EGET_DIR) # workaround for windows + toml - printf "[global]\ntarget='$DIR'\nquiet=true\ngithub_token='${{ github.token }}'\n" > $EGET_CONFIG - echo $EGET_DIR >> $GITHUB_PATH - echo "EGET_CONFIG=$EGET_CONFIG" >> $GITHUB_ENV - - name: Download k6 - shell: bash - run: ./tools/getk6 $(< k6-version.txt) - - name: Test run: go test -race -count 1 ./... diff --git a/.gitignore b/.gitignore index f5999a2..efd6b07 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,3 @@ /k6exec /k6exec.exe /build -/cmd/k6exec/k6 -/.eget \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f3cac5..0f967b0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -158,13 +158,6 @@ Requires [docker]: <#docker---building-a-docker-image> -### embed - Get k6 release artifacts for embedding - -```sh -./tools/getk6 $(< k6-version.txt) -mdcode update -``` - ### readme - Update README.md Update the CLI documentation and the example code in `README.md`. diff --git a/Makefile b/Makefile index 02f6012..23366e4 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,6 @@ __help__: @echo ' clean Clean the working directory' @echo ' coverage View the test coverage report' @echo ' docker Building a Docker image' - @echo ' embed Get k6 release artifacts for embedding' @echo ' examples Run examples' @echo ' format Format the go source codes' @echo ' lint Run the linter' @@ -55,14 +54,6 @@ docker: docker build -t k6exec -f Dockerfile.goreleaser build;\ ) -# Get k6 release artifacts for embedding -.PHONY: embed -embed: - @(\ - ./tools/getk6 $$(< k6-version.txt);\ - mdcode update;\ - ) - # Run examples .PHONY: examples examples: diff --git a/README.md b/README.md index 40c4aad..243820b 100644 --- a/README.md +++ b/README.md @@ -31,16 +31,6 @@ Docker images are available on the GitHub [Packages](https://github.com/grafana/ docker pull ghcr.io/grafana/k6exec:latest ``` -### Embedded k6 - -For a better user experience, a k6 executable without extensions is embedded in k6exec. If no extensions are required to run the current k6 command, or the user does not use extensions in the script, the embedded k6 executable will be executed. - -The version of k6 to be embedded is found in the `k6-version.txt` file, whose value is currently: - -```txt file=k6-version.txt -v0.56.0 -``` - ## Usage @@ -130,10 +120,6 @@ The manifest file is a JSON file, the `dependencies` property of which can speci The manifest file is a file named `package.json`, which is located closest to the k6 test script or the current directory, depending on whether the given subcommand has a test script argument (e.g. run, archive) or not (e.g. version). The `package.json` file is searched for up to the root of the directory hierarchy. -### Embedded k6 - -For a better user experience, a k6 executable without extensions is embedded in k6exec. If no extensions are required to run the current k6 command, or the user does not use extensions in the script, the embedded k6 executable will be executed. - ### Limitations Version constraints can be specified in several sources ([pragma](#pragma), [environment](#environment), [manifest](#manifest)) but cannot be overwritten. That is, for a given extension, the version constraints from different sources must either be equal, or only one source can contain a version constraint. diff --git a/cmd/cmd.go b/cmd/cmd.go index 53e8fd2..82fee98 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -5,7 +5,6 @@ import ( _ "embed" "log/slog" - "github.com/grafana/k6exec" "github.com/spf13/cobra" ) @@ -13,8 +12,8 @@ import ( var help string // New creates new cobra command for exec command. -func New(levelVar *slog.LevelVar, provisioner k6exec.ProvisionerFunc) *cobra.Command { - state := newState(levelVar, provisioner) +func New(levelVar *slog.LevelVar) *cobra.Command { + state := newState(levelVar) root := &cobra.Command{ Use: "k6exec [flags] [command]", diff --git a/cmd/cmd_test.go b/cmd/cmd_test.go index 2a44bbc..2185cca 100644 --- a/cmd/cmd_test.go +++ b/cmd/cmd_test.go @@ -14,7 +14,7 @@ import ( func TestNew(t *testing.T) { //nolint:paralleltest lvar := new(slog.LevelVar) - c := cmd.New(lvar, nil) + c := cmd.New(lvar) require.Contains(t, c.Use, "k6exec") require.Contains(t, c.Long, "k6exec") diff --git a/cmd/help.md b/cmd/help.md index 9ed857a..0b08306 100644 --- a/cmd/help.md +++ b/cmd/help.md @@ -78,10 +78,6 @@ The manifest file is a JSON file, the `dependencies` property of which can speci The manifest file is a file named `package.json`, which is located closest to the k6 test script or the current directory, depending on whether the given subcommand has a test script argument (e.g. run, archive) or not (e.g. version). The `package.json` file is searched for up to the root of the directory hierarchy. -### Embedded k6 - -For a better user experience, a k6 executable without extensions is embedded in k6exec. If no extensions are required to run the current k6 command, or the user does not use extensions in the script, the embedded k6 executable will be executed. - ### Limitations Version constraints can be specified in several sources ([pragma](#pragma), [environment](#environment), [manifest](#manifest)) but cannot be overwritten. That is, for a given extension, the version constraints from different sources must either be equal, or only one source can contain a version constraint. diff --git a/cmd/k6exec/.gitignore b/cmd/k6exec/.gitignore deleted file mode 100644 index 5ed2f93..0000000 --- a/cmd/k6exec/.gitignore +++ /dev/null @@ -1 +0,0 @@ -k6 diff --git a/cmd/k6exec/embed.go b/cmd/k6exec/embed.go deleted file mode 100644 index 4f81167..0000000 --- a/cmd/k6exec/embed.go +++ /dev/null @@ -1,145 +0,0 @@ -package main - -import ( - "bytes" - "compress/gzip" - "context" - "crypto/sha256" - "encoding/hex" - "errors" - "io" - "log/slog" - "os" - "os/exec" - "path/filepath" - "runtime" - "syscall" - - "github.com/Masterminds/semver/v3" - "github.com/grafana/k6deps" - "github.com/grafana/k6exec" - "github.com/grafana/k6provision" -) - -const ( - dirMode = syscall.S_IXUSR | syscall.S_IRUSR | syscall.S_IWUSR - exeMode = syscall.S_IXUSR | syscall.S_IRUSR | syscall.S_IWUSR - dataMode = syscall.S_IRUSR | syscall.S_IWUSR - versionFile = "version.txt" - hashFile = "sha256.txt" -) - -var binBaseDir = filepath.Join("k6", runtime.GOOS, runtime.GOARCH) //nolint:gochecknoglobals - -func tryEmbedded(ctx context.Context, deps k6deps.Dependencies, exe string, next k6exec.ProvisionerFunc) error { - if len(deps) > 1 { // at least one non-k6 dependency exists - return next(ctx, deps, exe, next) - } - - ek6ver := embeddedVersion() - k6dep := &k6deps.Dependency{Name: "k6"} - - if len(deps) == 1 { - dep, found := deps[k6dep.Name] - if !found { // non-k6 dependency exists - return next(ctx, deps, exe, next) - } - - k6dep = dep - } - - if !k6dep.GetConstraints().Check(ek6ver) { - return next(ctx, deps, exe, next) - } - - slog.Debug("Using the embedded k6", "version", ek6ver.String(), "constraints", k6dep.GetConstraints()) - - if alreadyExtracted(exe) { - return nil - } - - return extractExe(exe) -} - -func alreadyExtracted(exe string) bool { - _, err := exec.LookPath(exe) - - if err != nil && !errors.Is(err, exec.ErrDot) { - return false - } - - file, err := os.Open(filepath.Clean(exe)) //nolint:forbidigo - if err != nil { - return false - } - - defer file.Close() //nolint:errcheck - - hash := sha256.New() - if _, err := io.Copy(hash, file); err != nil { - return false - } - - ehash, err := embeddedHash() - if err != nil { - return false - } - - return bytes.Equal(ehash, hash.Sum(nil)) -} - -func embeddedHash() ([]byte, error) { - strhash, err := binFS.ReadFile(filepath.Join(binBaseDir, hashFile)) - if err != nil { - return nil, err - } - - return hex.DecodeString(string(strhash[0:64])) -} - -func embeddedVersion() *semver.Version { - binver, err := binFS.ReadFile(filepath.Join(binBaseDir, versionFile)) - if err == nil { - ver, err := semver.NewVersion(string(binver)) - if err == nil { - return ver - } - } - - return semver.New(0, 0, 0, "", "") -} - -//nolint:forbidigo -func extractExe(exe string) error { - slog.Debug("extract exe") - - src, err := binFS.Open(filepath.Join(binBaseDir, k6provision.ExeName+".gz")) - if err != nil { - return err - } - - defer src.Close() //nolint:errcheck - - reader, err := gzip.NewReader(src) - if err != nil { - return err - } - - defer reader.Close() //nolint:errcheck - - dst, err := os.Create(filepath.Clean(exe)) - if err != nil { - return err - } - - _, err = io.Copy(dst, reader) //nolint:gosec - if err != nil { - return err - } - - if err := dst.Close(); err != nil { - return err - } - - return os.Chmod(exe, exeMode) -} diff --git a/cmd/k6exec/embed_darwin_amd64.go b/cmd/k6exec/embed_darwin_amd64.go deleted file mode 100644 index 53985c8..0000000 --- a/cmd/k6exec/embed_darwin_amd64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && amd64 -// +build darwin,amd64 - -package main - -import "embed" - -//go:embed k6/darwin/amd64 -var binFS embed.FS diff --git a/cmd/k6exec/embed_darwin_arm64.go b/cmd/k6exec/embed_darwin_arm64.go deleted file mode 100644 index e4b7ab2..0000000 --- a/cmd/k6exec/embed_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 -// +build darwin,arm64 - -package main - -import "embed" - -//go:embed k6/darwin/arm64 -var binFS embed.FS diff --git a/cmd/k6exec/embed_linux_amd64.go b/cmd/k6exec/embed_linux_amd64.go deleted file mode 100644 index 90cdcda..0000000 --- a/cmd/k6exec/embed_linux_amd64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build linux && amd64 -// +build linux,amd64 - -package main - -import "embed" - -//go:embed k6/linux/amd64 -var binFS embed.FS diff --git a/cmd/k6exec/embed_linux_arm64.go b/cmd/k6exec/embed_linux_arm64.go deleted file mode 100644 index 7b53f4e..0000000 --- a/cmd/k6exec/embed_linux_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build linux && arm64 -// +build linux,arm64 - -package main - -import "embed" - -//go:embed k6/linux/arm64 -var binFS embed.FS diff --git a/cmd/k6exec/embed_windows_amd64.go b/cmd/k6exec/embed_windows_amd64.go deleted file mode 100644 index 6b20bbc..0000000 --- a/cmd/k6exec/embed_windows_amd64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build windows && amd64 -// +build windows,amd64 - -package main - -import "embed" - -//go:embed k6/windows/amd64 -var binFS embed.FS diff --git a/cmd/k6exec/embed_windows_arm64.go b/cmd/k6exec/embed_windows_arm64.go deleted file mode 100644 index ef9a10f..0000000 --- a/cmd/k6exec/embed_windows_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build windows && arm64 -// +build windows,arm64 - -package main - -import "embed" - -//go:embed k6/windows/arm64 -var binFS embed.FS diff --git a/cmd/k6exec/main.go b/cmd/k6exec/main.go index 0d1e09d..16c6974 100644 --- a/cmd/k6exec/main.go +++ b/cmd/k6exec/main.go @@ -37,7 +37,7 @@ func main() { } func newCmd(args []string, levelVar *slog.LevelVar) *cobra.Command { - root := cmd.New(levelVar, tryEmbedded) + root := cmd.New(levelVar) root.Version = version if len(args) == 1 && (args[0] == "-h" || args[0] == "--help") { diff --git a/cmd/state.go b/cmd/state.go index 05325c2..8a5c565 100644 --- a/cmd/state.go +++ b/cmd/state.go @@ -28,11 +28,10 @@ type state struct { } //nolint:forbidigo -func newState(levelVar *slog.LevelVar, provisioner k6exec.ProvisionerFunc) *state { +func newState(levelVar *slog.LevelVar) *state { s := new(state) s.levelVar = levelVar - s.Options.Provisioner = provisioner if value, found := os.LookupEnv("K6_BUILD_SERVICE_URL"); found { s.buildServiceURL = value diff --git a/cmd/state_internal_test.go b/cmd/state_internal_test.go index 1da05a4..f1763c6 100644 --- a/cmd/state_internal_test.go +++ b/cmd/state_internal_test.go @@ -17,7 +17,7 @@ func Test_newState(t *testing.T) { t.Setenv("K6_BUILD_SERVICE_URL", "") t.Setenv("K6_EXTENSION_CATALOG_URL", "") - st := newState(lvar, nil) + st := newState(lvar) require.Same(t, lvar, st.levelVar) require.Empty(t, st.buildServiceURL) @@ -26,7 +26,7 @@ func Test_newState(t *testing.T) { t.Setenv("K6_BUILD_SERVICE_URL", "foo") t.Setenv("K6_EXTENSION_CATALOG_URL", "bar") - st = newState(lvar, nil) + st = newState(lvar) require.Equal(t, "foo", st.buildServiceURL) require.Equal(t, "bar", st.extensionCatalogURL) diff --git a/command.go b/command.go index d0bc88d..e2bc513 100644 --- a/command.go +++ b/command.go @@ -28,7 +28,7 @@ func Command(ctx context.Context, args []string, opts *Options) (*exec.Cmd, func exe := filepath.Join(dir, k6provision.ExeName) - if err := opts.provisioner()(ctx, deps, exe, defaultProvisioner(opts)); err != nil { + if err := provision(ctx, deps, exe, opts); err != nil { return nil, nil, err } diff --git a/go.mod b/go.mod index 4f9fa40..798a39a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/grafana/k6exec go 1.22.2 require ( - github.com/Masterminds/semver/v3 v3.3.1 github.com/grafana/clireadme v0.1.0 github.com/grafana/k6deps v0.2.0 github.com/grafana/k6provision v0.1.0 @@ -15,6 +14,7 @@ require ( ) require ( + github.com/Masterminds/semver/v3 v3.3.1 // indirect github.com/adrg/xdg v0.5.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/evanw/esbuild v0.24.2 // indirect diff --git a/k6-version.txt b/k6-version.txt deleted file mode 100644 index c676b21..0000000 --- a/k6-version.txt +++ /dev/null @@ -1 +0,0 @@ -v0.56.0 diff --git a/options.go b/options.go index 7b4513e..42ca0af 100644 --- a/options.go +++ b/options.go @@ -1,7 +1,6 @@ package k6exec import ( - "context" "net/http" "net/url" @@ -44,20 +43,4 @@ type Options struct { // BuildServiceURL contains the URL of the k6 build service to be used. // If the value is not nil, the k6 binary is built using the build service instead of the local build. BuildServiceURL *url.URL - // Provisioner contains the optional custom k6 provisioning function. - // If it is missing, provisioning is done using k6provision.Provision(). - Provisioner ProvisionerFunc -} - -// ProvisionerFunc is a function type that implements a chain of responsibility for k6 provisioning. -// If the function cannot or does not want to provision k6 based on the dependencies, -// it continues to call the next provisioning function received in the next parameter. -type ProvisionerFunc func(ctx context.Context, deps k6deps.Dependencies, exe string, next ProvisionerFunc) error - -func (o *Options) provisioner() ProvisionerFunc { - if o != nil && o.Provisioner != nil { - return o.Provisioner - } - - return noopProvisioner } diff --git a/provision.go b/provision.go index 6b2effd..b697276 100644 --- a/provision.go +++ b/provision.go @@ -7,22 +7,16 @@ import ( "github.com/grafana/k6provision" ) -func noopProvisioner(ctx context.Context, deps k6deps.Dependencies, exe string, next ProvisionerFunc) error { - return next(ctx, deps, exe, nil) -} - -func defaultProvisioner(opts *Options) ProvisionerFunc { - return func(ctx context.Context, deps k6deps.Dependencies, exe string, _ ProvisionerFunc) error { - popts := new(k6provision.Options) +func provision(ctx context.Context, deps k6deps.Dependencies, exe string, opts *Options) error { + popts := new(k6provision.Options) - if opts != nil { - popts.AppName = opts.AppName - popts.CacheDir = opts.CacheDir - popts.Client = opts.Client - popts.BuildServiceURL = opts.BuildServiceURL - popts.ExtensionCatalogURL = opts.ExtensionCatalogURL - } - - return k6provision.Provision(ctx, deps, exe, popts) + if opts != nil { + popts.AppName = opts.AppName + popts.CacheDir = opts.CacheDir + popts.Client = opts.Client + popts.BuildServiceURL = opts.BuildServiceURL + popts.ExtensionCatalogURL = opts.ExtensionCatalogURL } + + return k6provision.Provision(ctx, deps, exe, popts) } diff --git a/releases/v0.3.0.md b/releases/v0.3.0.md new file mode 100644 index 0000000..90a9434 --- /dev/null +++ b/releases/v0.3.0.md @@ -0,0 +1,11 @@ +k6exec `v0.3.0` is here 🎉! + +## Embedded k6 PoC removed + +The `embedded k6 PoC` introduced in v0.3.0 does not allow `k6exec` to be installed using the regular `go install` command. Since we want to keep the `go install` installation method, the `embedded k6 PoC` has been removed. + +**Description from the v0.2.0 release notes:** + +> *Default k6 executable has been embedded* +> +> *For a better user experience, the default k6 executable has been embedded in `k6exec`. If the user does not use any extensions and does not specify any version constraints for k6, the embedded default k6 executable will be executed. This results in much faster execution in a significant number of cases.* diff --git a/tools/gendoc/main.go b/tools/gendoc/main.go index fe344fb..77777fa 100644 --- a/tools/gendoc/main.go +++ b/tools/gendoc/main.go @@ -7,6 +7,6 @@ import ( ) func main() { - root := cmd.New(nil, nil) + root := cmd.New(nil) clireadme.Main(root, 1) } diff --git a/tools/getk6 b/tools/getk6 deleted file mode 100755 index 8fae0b1..0000000 --- a/tools/getk6 +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -export TAG="$1" - -if [ -z "$TAG" ]; then - echo "Usage: getk6 version-tag" >&2 - exit 1 -fi - -export BASE="cmd/k6exec/k6" -export DISTRO="grafana/k6" -export OS_LIST=("linux" "darwin" "windows") -export ARCH_LIST=("amd64" "arm64") - -download() { - local os="$1" - local arch="$2" - local platform="${os}/${arch}" - local target="${BASE}/${platform}" - local asset=".zip" - if [ "$os" == "linux" ]; then - asset=".tar.gz" - fi - if [ "$os" == "windows" ]; then - ext=".exe" - fi - - mkdir -p "${target}" - eget --tag="${TAG}" --to "${target}" -s "${platform}" --asset="${asset}" "${DISTRO}" - pushd "${target}" - shasum --algorithm 256 --binary "k6${ext}" | cut -f1 -d ' ' > "sha256.txt" - echo -n "${TAG}" > version.txt - popd -} - -compress() { - local os="$1" - local arch="$2" - local platform="${os}/${arch}" - local target="${BASE}/${platform}" - local ext="" - if [ "$os" == "windows" ]; then - ext=".exe" - fi - local exe="${target}/k6${ext}" - - gzip --force --best "${exe}" -} - -for OS in ${OS_LIST[*]}; do - for ARCH in ${ARCH_LIST[*]}; do - download "${OS}" "${ARCH}" - compress "${OS}" "${ARCH}" - done -done