diff --git a/Makefile b/Makefile index 478c29e..ded0881 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ SWAGGER_UI_DIR:=./swagger-ui # Build available information. GIT_HASH:=$(shell git log --format="%h" -n 1 2> /dev/null) -GIT_BRANCH:=$(shell git branch 2> /dev/null | grep '*' | cut -f2 -d' ') +GIT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD) APP_VERSION:="$(GIT_BRANCH)-$(GIT_HASH)" GOPKG:=github.com/launchrctl/launchr diff --git a/README.md b/README.md index 4fb82fe..e180fc2 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ To run Launchr Web server: ```shell # Run web server on http://localhost:8080 bin/launchr web +# To use example as base dir for actions discovery. +LAUNCHR_ACTIONS_PATH=example bin/launchr web # Run web server on http://localhost:3000 bin/launchr web -p 3000 # Serve swagger-ui and swagger.json diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..d48491c --- /dev/null +++ b/action.yaml @@ -0,0 +1,35 @@ +runtime: plugin +action: + title: Web UI + description: >- + Starts Web UI. Example: "web", "web --foreground", "web stop" + alias: + - ui + arguments: + - name: op + title: Operation + description: "Operates the web server. Optional. Allowed: [stop]" + type: string + enum: [stop] + options: + - name: port + shorthand: p + title: Port + description: Web server port + type: integer + default: 8080 + - name: foreground + title: Foreground + description: Run server in foreground. By default Web UI starts in background. + type: boolean + default: false + - name: proxy-client + title: Proxy client + description: Proxies to client web server, useful in local development + type: string + default: "" + - name: swagger-ui + title: Swagger UI + description: Serve swagger.json on /api/swagger.json and Swagger UI on /api/swagger-ui + type: boolean + default: false diff --git a/client/openapi.d.ts b/client/openapi.d.ts index a69d8f3..7149d8c 100644 --- a/client/openapi.d.ts +++ b/client/openapi.d.ts @@ -180,7 +180,7 @@ export interface components { }; JSONSchema: Record; Error: { - /** Format: int32 */ + /** Format: int */ code: number; message: string; }; diff --git a/client/src/utils/helpers.tsx b/client/src/utils/helpers.tsx index 41153ce..31d9d7e 100644 --- a/client/src/utils/helpers.tsx +++ b/client/src/utils/helpers.tsx @@ -7,8 +7,12 @@ export const sentenceCase = (a: string) => { } export const splitActionId = (actionId: string) => { + if (!actionId.includes(':') && !actionId.includes('.')) { + return { levels: [], id: actionId } + } + const [path, id] = actionId.split(':') - const levels = path?.split('.') || [] + const levels = path ? path.split('.') : [] return { levels, id } } diff --git a/client/src/utils/react-flow-builder.tsx b/client/src/utils/react-flow-builder.tsx index 449e994..fe6bc78 100644 --- a/client/src/utils/react-flow-builder.tsx +++ b/client/src/utils/react-flow-builder.tsx @@ -22,6 +22,18 @@ const layerColorSchemesHSL = [ [346.93, 83.26, 57.84], [160.47, 68.42, 51.57], [252.15, 91.86, 66.27], + [214.79, 87.25, 50.78], + [346.93, 83.26, 57.84], + [160.47, 68.42, 51.57], + [252.15, 91.86, 66.27], + [214.79, 87.25, 50.78], + [346.93, 83.26, 57.84], + [160.47, 68.42, 51.57], + [252.15, 91.86, 66.27], + [214.79, 87.25, 50.78], + [346.93, 83.26, 57.84], + [160.47, 68.42, 51.57], + [252.15, 91.86, 66.27], ] export const buildNodeColor = ({ diff --git a/foundation/software/flatcar/actions/bump/action.yaml b/example/foundation/software/flatcar/actions/bump/action.yaml similarity index 95% rename from foundation/software/flatcar/actions/bump/action.yaml rename to example/foundation/software/flatcar/actions/bump/action.yaml index 35d50a1..2343ceb 100644 --- a/foundation/software/flatcar/actions/bump/action.yaml +++ b/example/foundation/software/flatcar/actions/bump/action.yaml @@ -18,5 +18,8 @@ action: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/foundation/software/flatcar/actions/deploy/action.yaml b/example/foundation/software/flatcar/actions/deploy/action.yaml similarity index 82% rename from foundation/software/flatcar/actions/deploy/action.yaml rename to example/foundation/software/flatcar/actions/deploy/action.yaml index 799263a..6a83a9d 100644 --- a/foundation/software/flatcar/actions/deploy/action.yaml +++ b/example/foundation/software/flatcar/actions/deploy/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/actions/test-action-1/action.yaml b/example/interaction/actions/test-action-1/action.yaml similarity index 82% rename from interaction/actions/test-action-1/action.yaml rename to example/interaction/actions/test-action-1/action.yaml index e17f4bf..de4d402 100644 --- a/interaction/actions/test-action-1/action.yaml +++ b/example/interaction/actions/test-action-1/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/actions/test-action-2/action.yaml b/example/interaction/actions/test-action-2/action.yaml similarity index 82% rename from interaction/actions/test-action-2/action.yaml rename to example/interaction/actions/test-action-2/action.yaml index 8fb1322..216ac09 100644 --- a/interaction/actions/test-action-2/action.yaml +++ b/example/interaction/actions/test-action-2/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/actions/test-action-3/action.yaml b/example/interaction/applications/actions/test-action-3/action.yaml similarity index 82% rename from interaction/applications/actions/test-action-3/action.yaml rename to example/interaction/applications/actions/test-action-3/action.yaml index da37b45..fec3f9f 100644 --- a/interaction/applications/actions/test-action-3/action.yaml +++ b/example/interaction/applications/actions/test-action-3/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/roles/actions/test-action-4/action.yaml b/example/interaction/applications/roles/actions/test-action-4/action.yaml similarity index 82% rename from interaction/applications/roles/actions/test-action-4/action.yaml rename to example/interaction/applications/roles/actions/test-action-4/action.yaml index 172a0ea..01e7238 100644 --- a/interaction/applications/roles/actions/test-action-4/action.yaml +++ b/example/interaction/applications/roles/actions/test-action-4/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/roles/erp/actions/collect-data/action.yaml b/example/interaction/applications/roles/erp/actions/collect-data/action.yaml similarity index 82% rename from interaction/applications/roles/erp/actions/collect-data/action.yaml rename to example/interaction/applications/roles/erp/actions/collect-data/action.yaml index 6e2599f..aba6c87 100644 --- a/interaction/applications/roles/erp/actions/collect-data/action.yaml +++ b/example/interaction/applications/roles/erp/actions/collect-data/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/roles/erp/actions/generate-report/action.yaml b/example/interaction/applications/roles/erp/actions/generate-report/action.yaml similarity index 82% rename from interaction/applications/roles/erp/actions/generate-report/action.yaml rename to example/interaction/applications/roles/erp/actions/generate-report/action.yaml index dfc52f4..a64c47c 100644 --- a/interaction/applications/roles/erp/actions/generate-report/action.yaml +++ b/example/interaction/applications/roles/erp/actions/generate-report/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/roles/messenger/actions/create-account/action.yaml b/example/interaction/applications/roles/mail/actions/create-account/action.yaml similarity index 82% rename from interaction/applications/roles/messenger/actions/create-account/action.yaml rename to example/interaction/applications/roles/mail/actions/create-account/action.yaml index 01f798e..67e5afb 100644 --- a/interaction/applications/roles/messenger/actions/create-account/action.yaml +++ b/example/interaction/applications/roles/mail/actions/create-account/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/roles/mail/actions/send-mails/action.yaml b/example/interaction/applications/roles/mail/actions/send-mails/action.yaml similarity index 82% rename from interaction/applications/roles/mail/actions/send-mails/action.yaml rename to example/interaction/applications/roles/mail/actions/send-mails/action.yaml index 82432f6..1a865cb 100644 --- a/interaction/applications/roles/mail/actions/send-mails/action.yaml +++ b/example/interaction/applications/roles/mail/actions/send-mails/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/roles/mail/actions/create-account/action.yaml b/example/interaction/applications/roles/messenger/actions/create-account/action.yaml similarity index 82% rename from interaction/applications/roles/mail/actions/create-account/action.yaml rename to example/interaction/applications/roles/messenger/actions/create-account/action.yaml index 01f798e..67e5afb 100644 --- a/interaction/applications/roles/mail/actions/create-account/action.yaml +++ b/example/interaction/applications/roles/messenger/actions/create-account/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/interaction/applications/roles/messenger/actions/create-channel/action.yaml b/example/interaction/applications/roles/messenger/actions/create-channel/action.yaml similarity index 82% rename from interaction/applications/roles/messenger/actions/create-channel/action.yaml rename to example/interaction/applications/roles/messenger/actions/create-channel/action.yaml index ddab03c..5fed06f 100644 --- a/interaction/applications/roles/messenger/actions/create-channel/action.yaml +++ b/example/interaction/applications/roles/messenger/actions/create-channel/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/platform/actions/build/action.yaml b/example/platform/actions/build/action.yaml similarity index 92% rename from platform/actions/build/action.yaml rename to example/platform/actions/build/action.yaml index 8ffd7a5..bc28447 100644 --- a/platform/actions/build/action.yaml +++ b/example/platform/actions/build/action.yaml @@ -9,7 +9,7 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option @@ -30,6 +30,9 @@ action: title: Option 4 description: Some additional info for option type: array + +runtime: + type: container # image: python:3.7-slim image: ubuntu # command: python3 {{ .opt4 }} diff --git a/platform/actions/bump/action.yaml b/example/platform/actions/bump/action.yaml similarity index 82% rename from platform/actions/bump/action.yaml rename to example/platform/actions/bump/action.yaml index 20076b7..99dc731 100644 --- a/platform/actions/bump/action.yaml +++ b/example/platform/actions/bump/action.yaml @@ -8,9 +8,12 @@ action: - name: arg2 title: Argument 2 description: Some additional info for arg - options: # TODO Use json schema. By default string. Do not allow complex data. + options: - name: opt1 title: Option 1 description: Some additional info for option + +runtime: + type: container image: python:3.7-slim command: python3 %s diff --git a/rjsf/actions/arrays/action.yaml b/example/rjsf/actions/arrays/action.yaml similarity index 62% rename from rjsf/actions/arrays/action.yaml rename to example/rjsf/actions/arrays/action.yaml index c2126f2..ad2336e 100644 --- a/rjsf/actions/arrays/action.yaml +++ b/example/rjsf/actions/arrays/action.yaml @@ -1,10 +1,13 @@ action: title: RJSF Example of Arrays description: RJSF Arrays arguments - image: alpine:latest - command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"] arguments: - name: optarr title: Array description: Some additional info for option - type: array \ No newline at end of file + type: array + +runtime: + type: container + image: alpine:latest + command: [ "sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done" ] \ No newline at end of file diff --git a/rjsf/actions/enumeration/action.yaml b/example/rjsf/actions/enumeration/action.yaml similarity index 81% rename from rjsf/actions/enumeration/action.yaml rename to example/rjsf/actions/enumeration/action.yaml index 0f3317a..8dd5249 100644 --- a/rjsf/actions/enumeration/action.yaml +++ b/example/rjsf/actions/enumeration/action.yaml @@ -1,8 +1,6 @@ action: title: RJSF Example of Enumeration description: RJSF Enumeration arguments - image: alpine:latest - command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"] arguments: - name: select title: Select @@ -11,4 +9,9 @@ action: - name: radio title: Radio type: string - enum: [ Ola, Hello, Bonjour, Buongiorno, GutenTag ] \ No newline at end of file + enum: [ Ola, Hello, Bonjour, Buongiorno, GutenTag ] + +runtime: + type: container + image: alpine:latest + command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"] diff --git a/rjsf/actions/enumeration/ui-schema.yaml b/example/rjsf/actions/enumeration/ui-schema.yaml similarity index 100% rename from rjsf/actions/enumeration/ui-schema.yaml rename to example/rjsf/actions/enumeration/ui-schema.yaml diff --git a/rjsf/actions/numbers/action.yaml b/example/rjsf/actions/numbers/action.yaml similarity index 94% rename from rjsf/actions/numbers/action.yaml rename to example/rjsf/actions/numbers/action.yaml index c722e51..5e9cd73 100644 --- a/rjsf/actions/numbers/action.yaml +++ b/example/rjsf/actions/numbers/action.yaml @@ -1,8 +1,6 @@ action: title: RJSF Example of Numbers description: RJSF Numbers arguments - image: alpine:latest - command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"] arguments: - name: float title: Float @@ -26,3 +24,8 @@ action: minimum: -50 maximum: 50 multipleOf: 25 + +runtime: + type: container + image: alpine:latest + command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"] \ No newline at end of file diff --git a/rjsf/actions/numbers/ui-schema.yaml b/example/rjsf/actions/numbers/ui-schema.yaml similarity index 100% rename from rjsf/actions/numbers/ui-schema.yaml rename to example/rjsf/actions/numbers/ui-schema.yaml diff --git a/rjsf/actions/strings/action.yaml b/example/rjsf/actions/strings/action.yaml similarity index 89% rename from rjsf/actions/strings/action.yaml rename to example/rjsf/actions/strings/action.yaml index 3568767..e1e15ce 100644 --- a/rjsf/actions/strings/action.yaml +++ b/example/rjsf/actions/strings/action.yaml @@ -1,8 +1,6 @@ action: title: RJSF Example of strings description: RJSF Example of strings arguments - image: alpine:latest - command: ["sh", "-c", "for i in $(seq 60); do echo -e \"\\033[32m$$i\\033[0m\"; sleep 1; done"] arguments: - name: simpleString title: Simple inline string @@ -30,3 +28,7 @@ action: title: Label with word passphrase type: string +runtime: + type: container + image: alpine:latest + command: ["sh", "-c", "for i in $(seq 60); do echo $$i; sleep 1; done"] \ No newline at end of file diff --git a/rjsf/actions/strings/ui-schema.yaml b/example/rjsf/actions/strings/ui-schema.yaml similarity index 100% rename from rjsf/actions/strings/ui-schema.yaml rename to example/rjsf/actions/strings/ui-schema.yaml diff --git a/gen.go b/gen.go index aeb051d..c4ba659 100644 --- a/gen.go +++ b/gen.go @@ -26,7 +26,7 @@ const ( // Generate implements [launchr.GeneratePlugin] interface. func (p *Plugin) Generate(config launchr.GenerateConfig) error { - launchr.Term().Info().Println("Preparing launchrctl/web plugin assets...") + launchr.Term().Info().Printfln("Preparing %s plugin assets...", repoName) // Download web client assets. subdir := "web-plugin" @@ -63,6 +63,9 @@ func downloadGithubRelease(dir string, project string, version string) error { if err != nil { return err } + if releaseURL == "" { + return fmt.Errorf("gen: failed to get release url for %s %s", project, version) + } launchr.Log().Debug("get github release archive stream", "url", releaseURL) gzippedStream, err := getFileStreamByURL(releaseURL) if err != nil { @@ -118,6 +121,9 @@ func getGithubReleaseDownloadURL(repo, version string) (string, error) { } // Parse release JSON. defer releaseResp.Body.Close() + if releaseResp.StatusCode != http.StatusOK { + return "", fmt.Errorf("gen: failed to fetch %s (%d)", apiURL, releaseResp.StatusCode) + } body, err := io.ReadAll(releaseResp.Body) if err != nil { return "", err @@ -148,7 +154,7 @@ func getFileStreamByURL(url string) (io.ReadCloser, error) { return nil, err } if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("could not download from the url: %s", url) + return nil, fmt.Errorf("gen: could not download from the url %s", url) } // Return the body of the file. diff --git a/go.mod b/go.mod index 5cc1d99..3633c04 100644 --- a/go.mod +++ b/go.mod @@ -1,21 +1,20 @@ module github.com/launchrctl/web -go 1.23.1 +go 1.23.2 -toolchain go1.23.2 +toolchain go1.23.4 require ( github.com/getkin/kin-openapi v0.128.0 - github.com/go-chi/chi/v5 v5.1.0 + github.com/go-chi/chi/v5 v5.2.0 github.com/go-chi/cors v1.2.1 github.com/go-chi/render v1.0.3 github.com/gorilla/websocket v1.5.3 - github.com/launchrctl/launchr v0.16.4 + github.com/launchrctl/launchr v0.17.1 github.com/oapi-codegen/nethttp-middleware v1.0.2 github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 github.com/oapi-codegen/runtime v1.1.1 - github.com/spf13/cobra v1.8.1 - golang.org/x/sys v0.26.0 + golang.org/x/sys v0.29.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -23,7 +22,7 @@ require ( atomicgo.dev/cursor v0.2.0 // indirect atomicgo.dev/keyboard v0.2.9 // indirect atomicgo.dev/schedule v0.1.0 // indirect - github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect + github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/ajg/form v1.5.1 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect @@ -31,7 +30,7 @@ require ( github.com/containerd/console v1.0.4 // indirect github.com/containerd/log v0.1.0 // indirect github.com/distribution/reference v0.6.0 // indirect - github.com/docker/docker v27.3.1+incompatible // indirect + github.com/docker/docker v27.5.0+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dprotaso/go-yit v0.0.0-20240618133044-5a0af90af097 // indirect @@ -51,7 +50,7 @@ require ( github.com/klauspost/compress v1.17.11 // indirect github.com/knadh/koanf v1.5.0 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect - github.com/mailru/easyjson v0.7.7 // indirect + github.com/mailru/easyjson v0.9.0 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -62,7 +61,7 @@ require ( github.com/moby/sys/signal v0.7.1 // indirect github.com/moby/sys/user v0.3.0 // indirect github.com/moby/sys/userns v0.1.0 // indirect - github.com/moby/term v0.5.0 // indirect + github.com/moby/term v0.5.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect @@ -70,27 +69,28 @@ require ( github.com/pelletier/go-toml v1.9.5 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pterm/pterm v0.12.79 // indirect + github.com/pterm/pterm v0.12.80 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/rogpeppe/go-internal v1.13.1 // indirect - github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect + github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/speakeasy-api/openapi-overlay v0.9.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect - go.opentelemetry.io/otel v1.31.0 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect + go.opentelemetry.io/otel v1.33.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect - go.opentelemetry.io/otel/trace v1.31.0 // indirect + go.opentelemetry.io/otel/metric v1.33.0 // indirect + go.opentelemetry.io/otel/trace v1.33.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/mock v0.5.0 // indirect - golang.org/x/mod v0.21.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/term v0.25.0 // indirect - golang.org/x/text v0.19.0 // indirect - golang.org/x/tools v0.26.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/term v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/tools v0.29.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect google.golang.org/grpc v1.67.1 // indirect diff --git a/go.sum b/go.sum index eb10545..ce0e720 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk= github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg= +github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= github.com/MarvinJWendt/testza v0.2.1/go.mod h1:God7bhG8n6uQxwdScay+gjm9/LnO4D3kkcZX4hv9Rp8= @@ -80,8 +80,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI= -github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= +github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/docker/docker v27.5.0+incompatible h1:um++2NcQtGRTz5eEgO6aJimo6/JxrTXC941hd05JO6U= +github.com/docker/docker v27.5.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -107,8 +109,8 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/getkin/kin-openapi v0.128.0 h1:jqq3D9vC9pPq1dGcOCv7yOp1DaEe7c/T1vzcLbITSp4= github.com/getkin/kin-openapi v0.128.0/go.mod h1:OZrfXzUfGrNbsKj+xmFBx6E5c6yH3At/tAKSc2UszXM= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= -github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.2.0 h1:Aj1EtB0qR2Rdo2dG4O94RIU35w2lvQSj6BRA4+qwFL0= +github.com/go-chi/chi/v5 v5.2.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4= @@ -262,12 +264,12 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/launchrctl/launchr v0.16.4 h1:uVbRLZZQuTGhjDBN8kLpdPGeZZkpBjiiSjCxDEmeM6g= -github.com/launchrctl/launchr v0.16.4/go.mod h1:EGMn1cGbaGEpo+eQyJVdlq9BO3OSIDP60BOPS2odDxo= +github.com/launchrctl/launchr v0.17.1 h1:0mzOBE2M776MVQf62IuT686u/cZKQJDruMlVRq6RQw0= +github.com/launchrctl/launchr v0.17.1/go.mod h1:aI/DfDXJLk7xya2jowNAAykWeRoe1Tp6qI2NGGJwmj8= github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= +github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -310,8 +312,8 @@ github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= -github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/moby/term v0.5.2 h1:6qk3FJAFDs6i/q3W/pQ97SX192qKfZgGjCQqfCJkgzQ= +github.com/moby/term v0.5.2/go.mod h1:d3djjFCrjnB+fl8NJux+EJzu0msscUP+f8it8hPkFLc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -388,8 +390,8 @@ github.com/pterm/pterm v0.12.31/go.mod h1:32ZAWZVXD7ZfG0s8qqHXePte42kdz8ECtRyEej github.com/pterm/pterm v0.12.33/go.mod h1:x+h2uL+n7CP/rel9+bImHD5lF3nM9vJj80k9ybiiTTE= github.com/pterm/pterm v0.12.36/go.mod h1:NjiL09hFhT/vWjQHSj1athJpx6H8cjpHXNAK5bUw8T8= github.com/pterm/pterm v0.12.40/go.mod h1:ffwPLwlbXxP+rxT0GsgDTzS3y3rmpAO1NMjUkGTYf8s= -github.com/pterm/pterm v0.12.79 h1:lH3yrYMhdpeqX9y5Ep1u7DejyHy7NSQg9qrBjF9dFT4= -github.com/pterm/pterm v0.12.79/go.mod h1:1v/gzOF1N0FsjbgTHZ1wVycRkKiatFvJSJC4IGaQAAo= +github.com/pterm/pterm v0.12.80 h1:mM55B+GnKUnLMUSqhdINe4s6tOuVQIetQ3my8JGyAIg= +github.com/pterm/pterm v0.12.80/go.mod h1:c6DeF9bSnOSeFPZlfs4ZRAFcf5SCoTwvwQ5xaKGQlHo= github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= @@ -401,12 +403,13 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4= -github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 h1:PKK9DyHxif4LZo+uQSgXNqs0jj5+xZwwfKHgph2lxBw= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.1/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -427,8 +430,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= @@ -443,20 +446,22 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 h1:yd02MEjBdJkG3uabWP9apV+OuWRIXGDuJEUJbOHmCFU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0/go.mod h1:umTcuxiv1n/s/S6/c2AT/g2CQ7u5C59sHDNmfSwgz7Q= +go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= +go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0/go.mod h1:B5Ki776z/MBnVha1Nzwp5arlzBbE3+1jk+pGmaP5HME= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 h1:lUsI2TYsQw2r1IASwoROaCnjdj2cvC2+Jbxvk6nHnWU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0/go.mod h1:2HpZxxQurfGxJlJDblybejHB6RX6pmExPNe517hREw4= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ= +go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M= go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= +go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -471,8 +476,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA= -golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -483,8 +488,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -508,8 +513,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -524,8 +529,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -573,15 +578,15 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -591,8 +596,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= @@ -610,8 +615,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= +golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/plugin.go b/plugin.go index 003da6d..9e0efd9 100644 --- a/plugin.go +++ b/plugin.go @@ -2,11 +2,13 @@ package web import ( + "context" + _ "embed" "fmt" "path/filepath" "github.com/launchrctl/launchr" - "github.com/spf13/cobra" + "github.com/launchrctl/launchr/pkg/action" ) const ( @@ -18,6 +20,9 @@ const ( APIPrefix = "/api" ) +//go:embed action.yaml +var actionYaml []byte + func init() { launchr.RegisterPlugin(&Plugin{}) } @@ -48,54 +53,37 @@ type webFlags struct { PluginDir string } -// CobraAddCommands implements [launchr.CobraPlugin] interface to provide web functionality. -func (p *Plugin) CobraAddCommands(rootCmd *launchr.Command) error { - pluginTmpDir := p.cfg.Path(pluginName) - webPidFile := filepath.Join(pluginTmpDir, pidFile) - - webRunFlags := webFlags{ - PluginDir: pluginTmpDir, - } - - var foreground bool - var cmd = &launchr.Command{ - Use: "web [stop]", - Short: "Starts Web UI", - Args: cobra.MatchAll(cobra.RangeArgs(0, 1), cobra.OnlyValidArgs), - ValidArgs: []string{stopArg}, - Aliases: []string{"ui"}, - Example: `web -web --foreground -web stop`, - RunE: func(cmd *launchr.Command, args []string) error { - // Don't show usage help on a runtime error. - cmd.SilenceUsage = true - - // If 'stop' arg passed, try to interrupt process and remove PID file. - if len(args) > 0 && args[0] == stopArg { - return stopWeb(webPidFile, webRunFlags.PluginDir) - } - - if url, _ := getExistingWeb(webPidFile, webRunFlags.PluginDir); url != "" { - return fmt.Errorf("another web UI is already running at %s\nPlease stop the existing server before starting a new one", url) - } - - if foreground { - return p.runWeb(cmd.Context(), webRunFlags) - } - - return p.runBackgroundWeb(cmd, webRunFlags, webPidFile) - }, - } - - cmd.Flags().IntVarP(&webRunFlags.Port, "port", "p", 8080, `Web server port`) - // Check if swagger assets are available before adding option. - if _, err := GetSwaggerUIAssetsFS(); err == nil { - cmd.Flags().BoolVarP(&webRunFlags.UseSwaggerUI, "swagger-ui", "", false, `Serve swagger.json on /api/swagger.json and Swagger UI on /api/swagger-ui`) - } - cmd.Flags().StringVarP(&webRunFlags.ProxyClient, "proxy-client", "", "", `Proxies to client web server, useful in local development`) - cmd.Flags().BoolVarP(&foreground, "foreground", "", false, `Run server in foreground`) - // Command flags. - rootCmd.AddCommand(cmd) - return nil +// DiscoverActions implements [launchr.ActionDiscoveryPlugin] interface. +func (p *Plugin) DiscoverActions(_ context.Context) ([]*action.Action, error) { + a := action.NewFromYAML("web", actionYaml) + a.SetRuntime(action.NewFnRuntime(func(ctx context.Context, a *action.Action) error { + pluginTmpDir := p.cfg.Path(pluginName) + webPidFile := filepath.Join(pluginTmpDir, pidFile) + input := a.Input() + webRunFlags := webFlags{ + PluginDir: pluginTmpDir, + Port: input.Opt("port").(int), + UseSwaggerUI: input.Opt("swagger-ui").(bool), + ProxyClient: input.Opt("proxy-client").(string), + } + foreground := input.Opt("foreground").(bool) + + // If 'stop' arg passed, try to interrupt process and remove PID file. + op := input.Arg("op") + switch op { + case stopArg: + return stopWeb(webPidFile, webRunFlags.PluginDir) + } + + if url, _ := getExistingWeb(webPidFile, webRunFlags.PluginDir); url != "" { + return fmt.Errorf("another web UI is already running at %s\nPlease stop the existing server before starting a new one", url) + } + + if foreground { + return p.runWeb(ctx, webRunFlags) + } + + return p.runBackgroundWeb(ctx, webRunFlags, webPidFile) + })) + return []*action.Action{a}, nil } diff --git a/server/api.go b/server/api.go index 3ed2dc4..c688cc3 100644 --- a/server/api.go +++ b/server/api.go @@ -103,7 +103,7 @@ func (l *launchrServer) GetRunningActionStreams(w http.ResponseWriter, _ *http.R sendError(w, http.StatusNotFound, fmt.Sprintf("action run info with id %q is not found", id)) return } - streams := ri.Action.GetInput().IO + streams := ri.Action.Input().Streams() fStreams, ok := streams.(fileStreams) if !ok { panic("not supported") @@ -147,10 +147,6 @@ func (l *launchrServer) GetActionByID(w http.ResponseWriter, _ *http.Request, id sendError(w, http.StatusNotFound, fmt.Sprintf("action with id %q is not found", id)) return } - if err := a.EnsureLoaded(); err != nil { - sendError(w, http.StatusInternalServerError, fmt.Sprintf("error on loading action %q", id)) - return - } afull, err := apiActionFull(l.basePath(), a) if err != nil { @@ -168,10 +164,6 @@ func (l *launchrServer) GetActionJSONSchema(w http.ResponseWriter, _ *http.Reque sendError(w, http.StatusNotFound, fmt.Sprintf("action with id %q is not found", id)) return } - if err := a.EnsureLoaded(); err != nil { - sendError(w, http.StatusInternalServerError, fmt.Sprintf("error on loading action %q", id)) - return - } afull, err := apiActionFull(l.basePath(), a) if err != nil { @@ -209,6 +201,7 @@ func (l *launchrServer) RunAction(w http.ResponseWriter, r *http.Request, id str sendError(w, http.StatusNotFound, fmt.Sprintf("action with id %q is not found", id)) return } + // Parse JSON Schema input. var params ActionRunParams if err = json.NewDecoder(r.Body).Decode(¶ms); err != nil { @@ -231,11 +224,7 @@ func (l *launchrServer) RunAction(w http.ResponseWriter, r *http.Request, id str // streams.Close() //} }() - err = a.SetInput(action.Input{ - Args: params.Arguments, - Opts: params.Options, - IO: streams, - }) + err = a.SetInput(action.NewInput(a, params.Arguments, params.Options, streams)) if err != nil { // @todo validate must have info about which fields failed. sendError(w, http.StatusBadRequest, "invalid actions input") @@ -258,9 +247,12 @@ func (l *launchrServer) RunAction(w http.ResponseWriter, r *http.Request, id str } func apiActionFull(baseURL string, a *action.Action) (ActionFull, error) { + short, err := apiActionShort(a) + if err != nil { + return ActionFull{}, err + } jsonschema := a.JSONSchema() jsonschema.ID = fmt.Sprintf("%s/actions/%s/schema.json", baseURL, url.QueryEscape(a.ID)) - def := a.ActionDef() var uiSchema map[string]interface{} @@ -280,21 +272,20 @@ func apiActionFull(baseURL string, a *action.Action) (ActionFull, error) { return ActionFull{ ID: a.ID, - Title: def.Title, - Description: def.Description, + Title: short.Title, + Description: short.Description, JSONSchema: jsonschema, UISchema: uiSchema, }, nil } func apiActionShort(a *action.Action) (ActionShort, error) { - err := a.EnsureLoaded() def := a.ActionDef() return ActionShort{ ID: a.ID, Title: def.Title, Description: def.Description, - }, err + }, nil } func sendError(w http.ResponseWriter, code int, message string) { diff --git a/server/openapi.gen.go b/server/openapi.gen.go index 8eca65c..139375a 100644 --- a/server/openapi.gen.go +++ b/server/openapi.gen.go @@ -52,9 +52,9 @@ type ActionRunInfo struct { // ActionRunParams defines model for ActionRunParams. type ActionRunParams struct { - Arguments action.TypeArgs `json:"arguments"` - Changed *[]string `json:"changed,omitempty"` - Options action.TypeOpts `json:"options"` + Arguments action.InputParams `json:"arguments"` + Changed *[]string `json:"changed,omitempty"` + Options action.InputParams `json:"options"` } // ActionRunStatus defines model for ActionRunStatus. @@ -565,28 +565,28 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/8xYy3LjthL9FRbuXVKiPNlxp7GdlFKu0ZSVrBwvYLJJYoZ4GI/YKpX+PQWAT5GyqLLs", - "ZCWRaKJPn+4+bHCHEk4FZ8C0QvEOCSwxBQ3SXS0TTThbpfZ/CiqRRNgbKEarm4BnAXbrgeZBBjopUIiI", - "XRRY2/8MU0AxIikKkYRnQySkKNbSQIhUUgDFdl+9FdZKaUlYjvb7sPJ6b9iKZfy4c11AIA1jhOUVkHH/", - "0tgIzoNwRyjRQ8fM0CeQ1jmUQC1nNnYJ2sjG+bMBuW29l26nrjeKXwk1FMVXi0WIKGHVVVjjIExDDtIB", - "WWeZgslI1E8ijuDgfqORsFt3e0uSEpwpcOm/gQybUt9KyaW9TjjTwBwaLERJEmzRRD+UhbTr7Px/CRmK", - "0f+itrgiv6oiv5tz1g/JMHgVkGhIA6hsarSdYvzVlKUDUJbrDMUPbzvzz2wKLjXahzskJBcgNfHxWeAD", - "OvjTD0gsUa+znM8q9n7frL9tvGW1UFm3W8yH6zNChfXs+koXKEY50YV5miecRiU2LClkosv6byR+5lEH", - "k43fkGkA/1yNwqNYPPiyfrRplhlOYLfvYbQ1M+MuCbicCe7sfI/4gqi75qHL12N4AGf/eNi5/Sz1mSfp", - "sO/6Aa1ukE2/xtqoUyXVuN1480PcToGqrU4A/271T70FHcvc0FouR1NS3fSaNP9jK2Apc/XewqgkzsaW", - "FJjl4CgkGqga0bAmSiwl3tprn+JzUK+Fvhzqg5S0LLbITqRm09QCMCuYDyiRgDU4bffvARSijDCiCnfT", - "q0i7a8tNZ08JmN5gjd9KeUf3Blsl3PRWGjUNa8kdXfN32lCUTtfGybNOV8z/3sox9AdEutWwgRi2Qu+R", - "vUWq18U3Au8J9EjwU9tYE13C+Jt20Kfetv9yGA/i2ijNKVH4AN+oQPaMrznLSH5ZrQxR8548rJ7UxZ5x", - "SbH2ZYDCkZqgoBTOJ/Dkdmzth+yE3RfWgBjXjKRS6P47eMmC5feVHSvufBNXk5Vt05IkwJSDV3G6FDgp", - "IPgyX6AQGVmiGBVaCxVH0cvLyxy75TmXeVQ9q6K71fXtt83t7Mt8MS80LTvVgSqXKER/g1Qe0NV8MV94", - "+QKGBUEx+mV+5RxaDXIERzXGeIfysWHp3g1oKsBlGZT9uP5iToBA4nrSRb+BXjZB9+ahL4vFWWNQI87T", - "R5QD2R5OSRXuoAaGnIWb0455amKIegOdG68MpVhuLflEac9QzaZdr6mNdiTdH+VX1vz648DTNnCdfITW", - "r9vVjUtfe9I4MsW1JlFzEtk/vjMpp3PhRsyj1F+c+fsx9vYhElyNcA2vkBgNqj3y9Gm+N2xZr7yL4mcD", - "Sn/l6fbC7LZD1gjF3iRopoMAszSo54PDI9x+UAlXl8fqJtnPKwZpmkoYNmBUjzmnGrF/LFZjvXjvTSql", - "+5d78gyhbFIyVSotGQGpHrlkvx6SfDRd0c59gpisnw3gkbStGfQy987EhRNt248xn6C/E7rug1I62P5U", - "SiPlDhDqzI4M6sdONeamsfvEDJ9+pPoqNcHSf0j7ZIHonOrOl4kmNx8qF62XQYlVn5NqEqYohrUNVP0B", - "6Mjc1fuG9V+cvjoAj6epG+rHdH/Pg81OcnjOrFIy4Hn8jPnxhd8/CE8o+cRhu/jw0sMReCfW/f6fAAAA", - "///k7iMNZhgAAA==", + "H4sIAAAAAAAC/8xYy27juBL9FYH3LmXL6dlp504yAw+CTiPGrDJZMFJJYrdIKnxMYhj+9wEfesuxgjjp", + "WdkSS6xTp6qOitqjhNOKM2BKoniPKiwwBQXCXq0TRTjbpOZ/CjIRpDI3UIw2VwHPAmzXA8WDDFRSoBAR", + "s1hhZf4zTAHFiKQoRAKeNBGQolgJDSGSSQEUm33VrjJWUgnCcnQ4hN7rnWYblvHjzlUBgdCMEZZ7INP+", + "hTYRvA3CDaFEjR0zTR9BGOdQAjWcmdgFKC0a508axK71Xtqdut4ofiFUUxRfrFYhooT5q7DGQZiCHIQF", + "cptlEmYjkT9JdQQHdxtNhN26OxiSZMWZBJv+K8iwLtW1EFyY64QzBcyiwVVVkgQbNNEPaSDtOzv/X0CG", + "YvS/qC2uyK3KyO1mnfVD0gxeKkgUpAF4mxptpxh/12VpAZTlbYbi+9eduWe2BRcKHcI9qgSvQCji4jPA", + "R3Twxx+QGKJeFjlfePb+3N5+2zpLv+Ct2y2W4/UFoZXxbPtKFShGOVGFflwmnEYl1iwpRKLK+m9U/cyj", + "DiYTvybzAP61mYRHcXXvyvrBpFlkOIH9oYfR1MyC2yTgclFxa+d6xBVE3TX3Xb4ewgGcw8Owc/tZ6jNP", + "0nHf9QPaXCGTfoWVlqdKqnG7deZD3FaB/FYngH83+idfg45Frmktl5Mp8TedJi03rNLKb/vO2vAqZ8JL", + "CsxysCwSBVROyFgTKBYC78y1y/KvBD5ITMtlC+5EgrZNRQAzsnmPEgFYgVV49zZAIcoII7KwN52WtLu2", + "9HT2FIDpFVb4tcR31G+0VcJ1b6XR1LAW3sk1d6cNRar0VluRVumGud9rMYV+QKRdDRuIYSv3DtlrpDp1", + "fCXwnkxPBD+3mRVRJUy/b0fd6mz7r4jpIC61VJwSiQf4JmWyZ3zJWUby8ypmiJq35bB6Uht7xgXFypUB", + "CidqgoKUOJ/Bk92xtR+zE3ZfWyNibDMSr9P9N/GaBevvGzNc3Lgm9vOVadOSJMCkhec5XVc4KSD4slyh", + "EGlRohgVSlUyjqLn5+cltstLLvLIPyujm83l9bft9eLLcrUsFC071YG8SxSif0BIB+hiuVqunIIBwxVB", + "MfpteWEdGg2yBEc1xniP8qmR6c6OaTLAZRmU/bj+ZlaAQOB63kV/gFo3Qfemoi+r1ZuGoUaf5w8qA+Ue", + "z0oed1ADQ9bCTmvHPDUxRL2xzg5ZmlIsdoZ8IpVjqGbTrNfURnuSHo7yK2p+3aHgcRfYTj5C69fd5sqm", + "rz1vHJnlWpOoOY8cHt6ZlNO5sIPmUerPzvzdFHuHEFVcTnANL5BoBbI9+PRpvtNsXa+8i+InDVJ95enu", + "zOy2o9YExc4kaKaDALM0qOeD4UHuMKqEi/NjtfPs5xWD0E0ljBswqsecU43YPxzLqV68cyZe6X5xT75B", + "KJuUzJVKQ0ZA/CPn7NchyUfTFe3th4jZ+tkAnkjbLYNe5t6ZuHCmbftJ5hP0d0bXfVBKR9ufSmkk7QFC", + "vrEjg/qxU425bew+McOnH/HfpmZYus9pnywQnVPd22Wiyc2HykXrZVRi/qNSTcIcxTC2gaw/Ax2Zu3pf", + "sv6L01cH4PE0dUP9mO7veTDZSYbnTJ+SEc/TZ8yPL/z+QXhGyScW29mHlx6OwDkx7g//BgAA//87yBSw", + "bBgAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/server/openapi.yaml b/server/openapi.yaml index abcbffb..45a6034 100644 --- a/server/openapi.yaml +++ b/server/openapi.yaml @@ -234,12 +234,12 @@ components: properties: arguments: type: object - x-go-type: "action.TypeArgs" + x-go-type: "action.InputParams" x-go-type-import: path: "github.com/launchrctl/launchr/pkg/action" options: type: object - x-go-type: "action.TypeOpts" + x-go-type: "action.InputParams" x-go-type-import: path: "github.com/launchrctl/launchr/pkg/action" changed: diff --git a/server/server.go b/server/server.go index d20b547..e85aceb 100644 --- a/server/server.go +++ b/server/server.go @@ -25,8 +25,9 @@ import ( "github.com/go-chi/cors" "github.com/go-chi/render" "github.com/gorilla/websocket" - "github.com/launchrctl/launchr" middleware "github.com/oapi-codegen/nethttp-middleware" + + "github.com/launchrctl/launchr" ) // RunOptions is a set of options for running openapi http server. @@ -331,7 +332,7 @@ func getStreams(msg messageType, ws *websocket.Conn, l *launchrServer) { ri, _ := l.actionMngr.RunInfoByID(msg.Action) // Get the streams data - streams := ri.Action.GetInput().IO + streams := ri.Action.Input().Streams() fStreams, _ := streams.(fileStreams) params := GetRunningActionStreamsParams{ Offset: new(int), diff --git a/web_runner.go b/web_runner.go index e5539a3..dd49f00 100644 --- a/web_runner.go +++ b/web_runner.go @@ -66,17 +66,17 @@ func (p *Plugin) runWeb(ctx context.Context, webOpts webFlags) error { return server.Run(ctx, p.app, serverOpts) } -func (p *Plugin) runBackgroundWeb(cmd *launchr.Command, flags webFlags, pidFile string) error { +func (p *Plugin) runBackgroundWeb(ctx context.Context, flags webFlags, pidFile string) error { if isBackGroundEnv() { err := redirectOutputs(flags.PluginDir) if err != nil { return err } - return p.runWeb(cmd.Context(), flags) + return p.runWeb(ctx, flags) } - pid, err := runBackgroundCmd(cmd, pidFile) + pid, err := runBackgroundCmd(pidFile) if err != nil { return err } @@ -146,16 +146,14 @@ func stopWeb(pidFile, pluginDir string) (err error) { return nil } -func runBackgroundCmd(cmd *launchr.Command, pidFile string) (int, error) { +func runBackgroundCmd(pidFile string) (int, error) { err := launchr.EnsurePath(filepath.Dir(pidFile)) if err != nil { return 0, fmt.Errorf("cannot create tmp directory for %q", pidFile) } // Prepare the command to restart itself in the background - args := append([]string{cmd.Name()}, os.Args[2:]...) - - command := exec.Command(os.Args[0], args...) //nolint G204 + command := exec.Command(os.Args[0], os.Args[1:]...) //nolint G204 command.Env = append(os.Environ(), backgroundEnvVar+"=1") // Set platform-specific process ID