Skip to content

Commit 54b8c35

Browse files
committed
feat: allow nameless executables
1 parent 9c8b710 commit 54b8c35

File tree

22 files changed

+136
-104
lines changed

22 files changed

+136
-104
lines changed

.github/workflows/analyze.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Set up Go
2424
uses: actions/setup-go@v5
2525
with:
26-
go-version: "^1.23"
26+
go-version: "^1.24"
2727
- name: Install Go Tools
2828
run: |
2929
go install go.uber.org/mock/mockgen@v0.4.0
@@ -50,7 +50,7 @@ jobs:
5050
- name: Set up Go
5151
uses: actions/setup-go@v5
5252
with:
53-
go-version: "^1.23"
53+
go-version: "^1.24"
5454
- name: golangci-lint
5555
uses: golangci/golangci-lint-action@v6
5656
with:

.github/workflows/codeql.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up Go
2323
uses: actions/setup-go@v5
2424
with:
25-
go-version: "^1.23"
25+
go-version: "^1.24"
2626
- name: Initialize CodeQL
2727
uses: github/codeql-action/init@v3
2828
with:

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Set up Go
2828
uses: actions/setup-go@v5
2929
with:
30-
go-version: "^1.23"
30+
go-version: "^1.24"
3131
- name: Generate docs
3232
run: |
3333
go run ./tools/docsgen/.
@@ -52,7 +52,7 @@ jobs:
5252
- name: Set up Go
5353
uses: actions/setup-go@v5
5454
with:
55-
go-version: "^1.23"
55+
go-version: "^1.24"
5656
- name: Set up QEMU
5757
uses: docker/setup-qemu-action@v3
5858
- name: Login to GitHub Container Registry

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up Go
2525
uses: actions/setup-go@v5
2626
with:
27-
go-version: "^1.23"
27+
go-version: "^1.24"
2828
- name: Run Tests with Retries
2929
uses: nick-invision/retry@v3
3030
with:

.golangci.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ linters-settings:
1717
enable-all: true
1818
disable:
1919
- fieldalignment # too strict
20-
tenv:
21-
all: true
2220

2321
linters:
2422
disable-all: true
@@ -61,7 +59,7 @@ linters:
6159
- predeclared # finds code that shadows one of Go's predeclared identifiers
6260
- reassign # checks that package variables are not reassigned
6361
- stylecheck # is a replacement for golint
64-
- tenv # detects using os.Setenv instead of t.Setenv since Go1.17
62+
- usetesting # detects when some calls can be replaced by methods from the testing package
6563
- testableexamples # checks if examples are testable (have an expected output)
6664
- testpackage # makes you use a separate _test package
6765
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23.4-bookworm
1+
FROM golang:1.24.1-bookworm
22

33
ENV DISABLE_FLOW_INTERACTIVE="true"
44

cmd/internal/exec.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func RegisterExecCmd(ctx *context.Context, rootCmd *cobra.Command) {
4040
io.TypesDocsURL("flowfile", "ExecutableRef"),
4141
execExamples,
4242
),
43-
Args: cobra.MinimumNArgs(1),
43+
Args: cobra.ArbitraryArgs,
4444
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
4545
execList, err := ctx.ExecutableCache.GetExecutableList(ctx.Logger)
4646
if err != nil {
@@ -82,8 +82,14 @@ func execFunc(ctx *context.Context, cmd *cobra.Command, verb executable.Verb, ar
8282
logger.FatalErr(err)
8383
}
8484

85-
idArg := args[0]
86-
ref := context.ExpandRef(ctx, executable.NewRef(idArg, verb))
85+
var ref executable.Ref
86+
if len(args) == 0 {
87+
ref = context.ExpandRef(ctx, executable.NewRef("", verb))
88+
} else {
89+
idArg := args[0]
90+
ref = context.ExpandRef(ctx, executable.NewRef(idArg, verb))
91+
}
92+
8793
e, err := ctx.ExecutableCache.GetExecutableByRef(logger, ref)
8894
if err != nil && errors.Is(cache.NewExecutableNotFoundError(ref.String()), err) {
8995
logger.Debugf("Executable %s not found in cache, syncing cache", ref)
@@ -108,7 +114,10 @@ func execFunc(ctx *context.Context, cmd *cobra.Command, verb executable.Verb, ar
108114
))
109115
}
110116

111-
execArgs := args[1:]
117+
execArgs := make([]string, 0)
118+
if len(args) >= 2 {
119+
execArgs = args[1:]
120+
}
112121
envMap, err := argUtils.ProcessArgs(e, execArgs, nil)
113122
if err != nil {
114123
logger.FatalErr(err)
@@ -369,6 +378,14 @@ Flag arguments are specified with the format 'flag=value' and positional argumen
369378
`
370379
execExamples = `
371380
#### Examples
381+
**Execute a nameless flow in the current workspace with the 'install' verb**
382+
383+
flow install
384+
385+
**Execute a nameless flow in the 'ws' workspace with the 'test' verb**
386+
387+
flow test ws
388+
372389
**Execute the 'build' flow in the current workspace and namespace**
373390
374391
flow exec build

cmd/internal/library.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ func libraryFunc(ctx *context.Context, cmd *cobra.Command, _ []string) {
4646
wsFilter := flags.ValueFor[string](ctx, cmd, *flags.FilterWorkspaceFlag, false)
4747
if wsFilter == "." {
4848
wsFilter = ctx.Config.CurrentWorkspace
49+
} else if wsFilter == executable.WildcardWorkspace {
50+
wsFilter = ""
4951
}
5052

5153
nsFilter := flags.ValueFor[string](ctx, cmd, *flags.FilterNamespaceFlag, false)
@@ -55,7 +57,7 @@ func libraryFunc(ctx *context.Context, cmd *cobra.Command, _ []string) {
5557
logger.PlainTextWarn("cannot use both --all and --namespace flags, ignoring --namespace")
5658
fallthrough
5759
case allNs:
58-
nsFilter = "*"
60+
nsFilter = executable.WildcardNamespace
5961
case nsFilter == ".":
6062
nsFilter = ctx.Config.CurrentNamespace
6163
}
@@ -122,7 +124,7 @@ func glanceLibraryCmd(ctx *context.Context, cmd *cobra.Command, _ []string) {
122124
logger.PlainTextWarn("cannot use both --all and --namespace flags, ignoring --namespace")
123125
fallthrough
124126
case allNs:
125-
nsFilter = "*"
127+
nsFilter = executable.WildcardNamespace
126128
case nsFilter == ".":
127129
nsFilter = ctx.Config.CurrentNamespace
128130
}
@@ -188,7 +190,7 @@ func viewLibraryFunc(ctx *context.Context, cmd *cobra.Command, args []string) {
188190
logger.FatalErr(err)
189191
}
190192
id := args[1]
191-
ws, ns, name := executable.ParseExecutableID(id)
193+
ws, ns, name := executable.MustParseExecutableID(id)
192194
if ws == "" {
193195
ws = ctx.CurrentWorkspace.AssignedName()
194196
}

development.flow

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
visibility: private
33
tags: [development]
44
executables:
5-
- verb: run
6-
name: checks
7-
aliases: [precommit, pc, ci, validate]
5+
- verb: validate
86
description: |
97
Run the repository validation checks. This includes linting, tests, and code generation.
108
Validate should be run before committing changes.

docs/cli/flow_exec.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ See https://flowexec.io/#/types/flowfile#ExecutableVerb for more information on
1616

1717

1818
#### Examples
19+
**Execute a nameless flow in the current workspace with the 'install' verb**
20+
21+
flow install
22+
23+
**Execute a nameless flow in the 'ws' workspace with the 'test' verb**
24+
25+
flow test ws
26+
1927
**Execute the 'build' flow in the current workspace and namespace**
2028

2129
flow exec build

0 commit comments

Comments
 (0)