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
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: go build ./...
- run: go test ./... -v -race -count=1
- run: go vet ./...

wfctl-strict-contracts:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Validate strict plugin contracts
run: go run github.com/GoCodeAlone/workflow/cmd/wfctl@v0.20.1 plugin validate --file plugin.json --strict-contracts
35 changes: 35 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2

before:
hooks:
- go mod tidy
- "sed -i.bak 's/\"version\": \".*\"/\"version\": \"{{ .Version }}\"/' plugin.json && rm -f plugin.json.bak"

builds:
- id: workflow-plugin-eventbus
main: ./cmd/workflow-plugin-eventbus
binary: workflow-plugin-eventbus
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ldflags:
- -s -w -X main.version={{.Version}}

archives:
- formats: [tar.gz]
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
files:
- plugin.json
- LICENSE

checksum:
name_template: "checksums.txt"

changelog:
sort: asc
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.PHONY: proto-gen build test vet

# proto-gen regenerates gen/eventbus.pb.go from proto/eventbus.proto.
# Requires: protoc v7.34.1 and protoc-gen-go v1.36.11
# go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.11
# WARNING: running with a different protoc/protoc-gen-go version will produce
# a different gen/eventbus.pb.go — commit only if intentionally upgrading.
proto-gen:
protoc \
--proto_path=proto \
--go_out=gen \
--go_opt=paths=source_relative \
proto/eventbus.proto

build:
GOWORK=off go build ./...

test:
GOWORK=off go test ./... -v -race -count=1

vet:
GOWORK=off go vet ./...
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# workflow-plugin-eventbus

**Status: pre-pilot scaffold** — Provider implementations are in progress (BMW E2E fulfillment pilot, PR 5).

A [workflow](https://github.com/GoCodeAlone/workflow) external plugin that provisions durable event-bus clusters as IaC and exposes typed pipeline steps for publish/consume operations.

## Providers

| Provider | Deploy targets |
|---|---|
| `nats` | DO App Platform, AWS ECS/EKS, Kubernetes StatefulSet |
| `kafka` | DO Managed Kafka, AWS MSK, Kubernetes (Strimzi) |
| `kinesis` | AWS (Kinesis Data Streams) |

## Usage

### Declare a cluster

```yaml
modules:
- name: my-events
type: infra.eventbus
config:
provider: nats
deploy_target: digitalocean.app_platform
version: "2.10"
replicas: 2
jetstream:
enabled: true
max_storage_bytes: 53687091200 # 50 GB
```

### Declare streams and consumers

```yaml
- name: my-stream
type: infra.eventbus.stream
config:
name: MY_EVENTS
subjects: ["events.>"]
retention_policy: RETENTION_POLICY_LIMITS
max_bytes: 10737418240 # 10 GB

- name: my-consumer
type: infra.eventbus.consumer
config:
stream_name: MY_EVENTS
name: my-handler
filter_subject: "events.>"
ack_policy: ACK_POLICY_EXPLICIT
max_deliver: 5
```

### Publish from a pipeline step

```yaml
steps:
- name: publish
type: step.eventbus.publish
config:
subject: events.created
payload: '{{ toJson .input }}'
```

### Subscribe trigger

```yaml
my-handler:
trigger:
type: trigger.eventbus.subscribe
config:
stream_name: MY_EVENTS
name: my-handler
filter_subject: "events.>"
ack_policy: ACK_POLICY_EXPLICIT
steps:
- name: ack
type: step.eventbus.ack
config:
ack_token: '{{ .nats.message.ack_token }}'
```

## Development

```sh
# Regenerate proto bindings after editing proto/eventbus.proto
make proto-gen

# Build
make build

# Test
make test
```

## Planned providers

- `nats` — NATS JetStream (in progress)
- `kafka` — stub (in progress)
- `kinesis` — stub (in progress)
14 changes: 14 additions & 0 deletions cmd/workflow-plugin-eventbus/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Command workflow-plugin-eventbus is a workflow engine external plugin that
// provisions durable event-bus clusters (NATS / Kafka / Kinesis) as IaC and
// exposes typed pipeline steps for publish / consume operations.
//
// Status: pre-pilot scaffold — provider implementations are in progress.
package main

// version is stamped at release time via goreleaser ldflags (-X main.version=<tag>).
var version = "dev"

func main() {
// TODO(Task 17): wire sdk.Serve(plugin.New()) once Provider interface is implemented.
panic("workflow-plugin-eventbus: provider implementation pending — scaffold only; see github.com/GoCodeAlone/workflow-plugin-eventbus")
}
Loading