Skip to content

Commit

Permalink
Merge pull request #88 from grafana/87-remove-embedded-k6-poc
Browse files Browse the repository at this point in the history
Embedded k6 PoC removed
  • Loading branch information
szkiba authored Jan 23, 2025
2 parents f697601 + 8a4efe5 commit c8d2c26
Show file tree
Hide file tree
Showing 30 changed files with 31 additions and 395 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,13 @@ 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
with:
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 ./...

Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
/k6exec
/k6exec.exe
/build
/cmd/k6exec/k6
/.eget
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<!-- #region cli -->
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ import (
_ "embed"
"log/slog"

"github.com/grafana/k6exec"
"github.com/spf13/cobra"
)

//go:embed help.md
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]",
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 0 additions & 4 deletions cmd/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion cmd/k6exec/.gitignore

This file was deleted.

145 changes: 0 additions & 145 deletions cmd/k6exec/embed.go

This file was deleted.

9 changes: 0 additions & 9 deletions cmd/k6exec/embed_darwin_amd64.go

This file was deleted.

9 changes: 0 additions & 9 deletions cmd/k6exec/embed_darwin_arm64.go

This file was deleted.

9 changes: 0 additions & 9 deletions cmd/k6exec/embed_linux_amd64.go

This file was deleted.

Loading

0 comments on commit c8d2c26

Please sign in to comment.