Skip to content

Commit

Permalink
Owl more validation (#583)
Browse files Browse the repository at this point in the history
This is in a good state for runner v1. Let's merge and work from smaller
feature branches rather than continually rebasing this branch.

- Introduce complex specs (working title; impeding renaming)
- Introduce tag and dburl validation
- Propagate execution info via context

Unfinished.
  • Loading branch information
sourishkrout authored Jul 31, 2024
1 parent a5a1de7 commit c7ed2e7
Show file tree
Hide file tree
Showing 34 changed files with 1,433 additions and 430 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
hooks:
- id: typos
args: ["--diff", "--force-exclude"]
exclude: "^.vscode/|go.mod"
exclude: "^.vscode/|go.mod|_test.go"
- repo: local
hooks:
- id: go-mod-tidy
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/stateful/runme/v3

go 1.22

// replace github.com/stateful/godotenv => ../godotenv

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2
github.com/Masterminds/semver/v3 v3.2.1
Expand Down Expand Up @@ -36,6 +38,7 @@ require (
github.com/rwtodd/Go.Sed v0.0.0-20240405174034-bb8ed5da0fd0
github.com/stateful/godotenv v0.0.0-20240309032207-c7bc0b812915
github.com/vektah/gqlparser/v2 v2.5.16
github.com/xo/dburl v0.23.2
github.com/yuin/goldmark v1.7.4
go.uber.org/dig v1.17.1
go.uber.org/multierr v1.11.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
github.com/xo/dburl v0.23.2 h1:Fl88cvayrgE56JA/sqhNMLljCW/b7RmG1mMkKMZUFgA=
github.com/xo/dburl v0.23.2/go.mod h1:uazlaAQxj4gkshhfuuYyvwCBouOmNnG2aDxTCFZpmL4=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/stateful/runme/v3/internal/runner/client"
"github.com/stateful/runme/v3/internal/tui"
"github.com/stateful/runme/v3/internal/tui/prompt"
"github.com/stateful/runme/v3/internal/version"
runnerv1 "github.com/stateful/runme/v3/pkg/api/gen/proto/go/runme/runner/v1"
"github.com/stateful/runme/v3/pkg/document"
"github.com/stateful/runme/v3/pkg/document/identity"
Expand Down Expand Up @@ -187,7 +188,9 @@ func getLogger(devMode bool, aiLogs bool) (*zap.Logger, error) {
// Record the caller of the log message
newLogger = newLogger.WithOptions(zap.AddCaller())

newLogger.Info("Logger initialized", zap.Bool("devMode", devMode), zap.Bool("aiLogs", aiLogs), zap.String("aiLogFile", aiLogFile))
versionInfo := version.BaseVersionInfo()

newLogger.Info("Logger initialized", zap.String("versionInfo", versionInfo), zap.Bool("devMode", devMode), zap.Bool("aiLogs", aiLogs), zap.String("aiLogFile", aiLogFile))
return newLogger, nil
}

Expand Down
17 changes: 17 additions & 0 deletions internal/command/exec_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package command

import "context"

type runnerContextKey struct{}

var ExecutionInfoKey = &runnerContextKey{}

type ExecutionInfo struct {
RunID string
KnownName string
KnownID string
}

func ContextWithExecutionInfo(ctx context.Context, execInfo *ExecutionInfo) context.Context {
return context.WithValue(ctx, ExecutionInfoKey, execInfo)
}
Loading

0 comments on commit c7ed2e7

Please sign in to comment.