feat: progress towards kv js implementation

This commit is contained in:
Tine 2024-06-08 19:36:27 +02:00
parent cf1d26100b
commit 7c12fc069f
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
5 changed files with 23 additions and 13 deletions

View file

@ -10,6 +10,8 @@ build:
unstable:
#!/bin/env bash
set -exuo pipefail
export DOCKER_REGISTRY={{ DOCKER_REGISTRY }}
goreleaser release --clean --snapshot --config ./build/release.yaml
IMAGES=$(docker image ls --format "{{'{{ .Repository }}:{{ .Tag }}'}}" | grep -e "{{ DOCKER_IMAGE }}.*")

View file

@ -7,17 +7,12 @@ set dotenv-load
export JWT_PRIVATE_KEY := `cat jwt.private.pem || echo ""`
export JWT_PUBLIC_KEY := `cat jwt.public.pem || echo ""`
DOCKER_REGISTRY := "ghcr.io/mentos1386/zdravko"
GIT_SHA := `git rev-parse --short HEAD`
export DOCKER_REGISTRY := "ghcr.io/mentos1386/zdravko"
DOCKER_IMAGE := "ghcr.io/mentos1386/zdravko:sha-"+GIT_SHA
DOCKER_IMAGE := "{{ DOCKER_REGISTRY }}:sha-{{ GIT_SHA }}"
STATIC_DIR := "./web/static"
OS := "linux darwin"
ARCH := "amd64 arm64"
export CGO_ENABLED := "0"
import 'build/Justfile'
import 'deploy/Justfile'

11
pkg/k6/zdravko/kv.go Normal file
View file

@ -0,0 +1,11 @@
package zdravko
import "github.com/dop251/goja"
type Kv struct {
}
func (z *Zdravko) Kv() goja.Value {
zdravkoContext := GetZdravkoContext(z.vu.Context())
return z.vu.Runtime().ToValue(zdravkoContext.Target)
}

8
pkg/k6/zdravko/target.go Normal file
View file

@ -0,0 +1,8 @@
package zdravko
import "github.com/dop251/goja"
func (z *Zdravko) GetTarget() goja.Value {
zdravkoContext := GetZdravkoContext(z.vu.Context())
return z.vu.Runtime().ToValue(zdravkoContext.Target)
}

View file

@ -1,7 +1,6 @@
package zdravko
import (
"github.com/dop251/goja"
"go.k6.io/k6/js/modules"
)
@ -53,11 +52,6 @@ type Zdravko struct {
Targets []Target
}
func (z *Zdravko) GetTarget() goja.Value {
zdravkoContext := GetZdravkoContext(z.vu.Context())
return z.vu.Runtime().ToValue(zdravkoContext.Target)
}
// Exports implements the modules.Instance interface and returns the exported types for the JS module.
func (mi *ModuleInstance) Exports() modules.Exports {
return modules.Exports{