From 7c12fc069f70cc2e710e2c8e0181e9b2a63b46a8 Mon Sep 17 00:00:00 2001 From: Tine Date: Sat, 8 Jun 2024 19:36:27 +0200 Subject: [PATCH] feat: progress towards kv js implementation --- build/Justfile | 2 ++ justfile | 9 ++------- pkg/k6/zdravko/kv.go | 11 +++++++++++ pkg/k6/zdravko/target.go | 8 ++++++++ pkg/k6/zdravko/zdravko.go | 6 ------ 5 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 pkg/k6/zdravko/kv.go create mode 100644 pkg/k6/zdravko/target.go diff --git a/build/Justfile b/build/Justfile index 0a5aeec..87c059e 100644 --- a/build/Justfile +++ b/build/Justfile @@ -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 }}.*") diff --git a/justfile b/justfile index 2f71c39..4131c8b 100644 --- a/justfile +++ b/justfile @@ -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' diff --git a/pkg/k6/zdravko/kv.go b/pkg/k6/zdravko/kv.go new file mode 100644 index 0000000..ecddda3 --- /dev/null +++ b/pkg/k6/zdravko/kv.go @@ -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) +} diff --git a/pkg/k6/zdravko/target.go b/pkg/k6/zdravko/target.go new file mode 100644 index 0000000..b4dcebb --- /dev/null +++ b/pkg/k6/zdravko/target.go @@ -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) +} diff --git a/pkg/k6/zdravko/zdravko.go b/pkg/k6/zdravko/zdravko.go index c1cdba3..09ecc13 100644 --- a/pkg/k6/zdravko/zdravko.go +++ b/pkg/k6/zdravko/zdravko.go @@ -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{