Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ default:
command -v goimports || go install golang.org/x/tools/cmd/goimports@latest
goimports -w .
go vet ./...
go run golang.org/x/tools/cmd/deadcode@latest ./...
go test -cover ./...
go install .
# docs
Expand All @@ -14,4 +15,4 @@ default:

.PHONY: release
release:
./release
./release
15 changes: 15 additions & 0 deletions docs/reference/workflow-defs-workflow-properties-port.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# port Schema

```txt
https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/port
```



| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
| :------------------ | :--------- | :------------- | :---------------------- | :---------------- | :-------------------- | :------------------ | :------------------------------------------------------------------------------ |
| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [workflow.schema.json\*](../../out/workflow.schema.json "open original schema") |

## port Type

`integer` ([port](workflow-defs-workflow-properties-port.md))
19 changes: 19 additions & 0 deletions docs/reference/workflow-defs-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,32 @@ https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow

| Property | Type | Required | Nullable | Defined by |
| :-------------------------------------------------------------- | :-------- | :------- | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [port](#port) | `integer` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-port.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/port") |
| [terminationGracePeriodSeconds](#terminationgraceperiodseconds) | `integer` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-terminationgraceperiodseconds.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/terminationGracePeriodSeconds") |
| [tasks](#tasks) | `object` | Optional | cannot be null | [Untitled schema](workflow-defs-tasks.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/tasks") |
| [volumes](#volumes) | `array` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-volumes.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/volumes") |
| [semaphores](#semaphores) | `object` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-semaphores.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/semaphores") |
| [env](#env) | `object` | Optional | cannot be null | [Untitled schema](workflow-defs-envvars.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/env") |
| [envfile](#envfile) | `array` | Optional | cannot be null | [Untitled schema](workflow-defs-envfile.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/envfile") |

## port



`port`

* is optional

* Type: `integer` ([port](workflow-defs-workflow-properties-port.md))

* cannot be null

* defined in: [Untitled schema](workflow-defs-workflow-properties-port.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/port")

### port Type

`integer` ([port](workflow-defs-workflow-properties-port.md))

## terminationGracePeriodSeconds


Expand Down
19 changes: 19 additions & 0 deletions docs/reference/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -1056,13 +1056,32 @@ Reference this group by using

| Property | Type | Required | Nullable | Defined by |
| :-------------------------------------------------------------- | :-------- | :------- | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [port](#port-2) | `integer` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-port.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/port") |
| [terminationGracePeriodSeconds](#terminationgraceperiodseconds) | `integer` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-terminationgraceperiodseconds.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/terminationGracePeriodSeconds") |
| [tasks](#tasks) | `object` | Optional | cannot be null | [Untitled schema](workflow-defs-tasks.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/tasks") |
| [volumes](#volumes) | `array` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-volumes.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/volumes") |
| [semaphores](#semaphores) | `object` | Optional | cannot be null | [Untitled schema](workflow-defs-workflow-properties-semaphores.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/semaphores") |
| [env](#env-1) | `object` | Optional | cannot be null | [Untitled schema](workflow-defs-envvars.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/env") |
| [envfile](#envfile-1) | `array` | Optional | cannot be null | [Untitled schema](workflow-defs-envfile.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/envfile") |

### port



`port`

* is optional

* Type: `integer` ([port](workflow-defs-workflow-properties-port.md))

* cannot be null

* defined in: [Untitled schema](workflow-defs-workflow-properties-port.md "https://github.com/kitproj/kit/internal/types/workflow#/$defs/Workflow/properties/port")

#### port Type

`integer` ([port](workflow-defs-workflow-properties-port.md))

### terminationGracePeriodSeconds


Expand Down
2 changes: 2 additions & 0 deletions internal/types/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import "time"

// Task is a unit of work that should be run.
type Spec struct {
// Port is the port that should be used for the user interface.
Port *uint16 `json:"port,omitempty"`
// TerminationGracePeriodSeconds is the grace period for terminating the workflow.
TerminationGracePeriodSeconds *int32 `json:"terminationGracePeriodSeconds,omitempty"`
// Tasks is a list of tasks that should be run.
Expand Down
7 changes: 0 additions & 7 deletions internal/types/writer_func.go

This file was deleted.

13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ func main() {
printVersion := false
configFile := ""
tasksToSkip := ""
port := 0
port := -1 // -1 means unspecified, 0 means disabled, >0 means specified
openBrowser := false
rewrite := false

flag.BoolVar(&help, "h", false, "print help and exit")
flag.BoolVar(&printVersion, "v", false, "print version and exit")
flag.StringVar(&configFile, "f", "tasks.yaml", "config file (default tasks.yaml)")
flag.StringVar(&tasksToSkip, "s", "", "tasks to skip (comma separated)")
flag.IntVar(&port, "p", 3000, "port to start UI on (default 3000, zero disables)")
flag.IntVar(&port, "p", port, "port to start UI on (default 3000, zero disables)")
flag.BoolVar(&openBrowser, "b", false, "open the UI in the browser (default false)")
flag.BoolVar(&rewrite, "w", false, "rewrite the config file")
flag.Parse()
Expand Down Expand Up @@ -75,6 +75,15 @@ func main() {
return os.WriteFile(configFile, out, 0644)
}

// if wf.Port is specified, use that, unless the user has specified a port on the command line
if port == -1 {
if wf.Port != nil {
port = int(*wf.Port)
} else {
port = 3000 // default port
}
}

// split the tasks on comma, but don't end up with a single entry of ""
split := strings.Split(tasksToSkip, ",")
if len(split) == 1 && split[0] == "" {
Expand Down
4 changes: 4 additions & 0 deletions schema/workflow.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@
},
"Workflow": {
"properties": {
"port": {
"type": "integer",
"title": "port"
},
"terminationGracePeriodSeconds": {
"type": "integer",
"title": "terminationGracePeriodSeconds"
Expand Down
45 changes: 23 additions & 22 deletions tasks.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
port: 3001
tasks:
build-app:
command:
- go
- build
- -v
- .
- go
- build
- -v
- .
watch:
- main.go
- main.go
workingDir: demo/go
group: app
error:
Expand All @@ -23,25 +24,25 @@ tasks:
stalledTimeout: 5s
run-app:
command:
- ./demo/go/go
- ./demo/go/go
dependencies:
- build-app
- build-app
env:
PORT: "9090"
ports:
- "9090"
- "9090"
group: app
run-container:
image: httpd
log: baz.log
ports:
- 80:10080
- 80:10080
readinessProbe: http://localhost:10080?failureThreshold=20&initialDelay=3s&period=5s&successThreshold=1
run-k8s:
manifests:
- testdata
- testdata
ports:
- 80:8080
- 80:8080
script:
sh: |
set -eu
Expand All @@ -55,18 +56,18 @@ tasks:
type: Service
skipped:
targets:
- go.mod
- go.mod
up:
dependencies:
- run-app
- script
- run-container
- run-k8s
- service
- logs
- skipped
- run-app
- script
- run-container
- run-k8s
- service
- logs
- skipped
terminationGracePeriodSeconds: 3
volumes:
- hostPath:
path: .
name: work
- hostPath:
path: .
name: work