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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: ">=1.21"
go-version: ">=1.24"
- run: make test
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- run: make docker-image
12 changes: 6 additions & 6 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: ">=1.21"
go-version: ">=1.24"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v8
with:
version: v1.54
version: v2.5
args: "--timeout=30m"
- run: make megalint
- run: make lint
19 changes: 19 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
version: "2"
linters:
default: standard
disable:
- errcheck
- staticcheck
formatters:
# Enable specific formatter.
# Default: [] (uses standard Go formatting)
enable:
- gci
- gofmt
- gofumpt
- goimports
- golines
run:
timeout: 30m
concurrency: 4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.4-bullseye AS builder
FROM golang:1.25-trixie AS builder

WORKDIR /build

Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Q = $(if $(filter 1,$V),,@)
M = $(shell printf "\033[34;1mEvent Provenance Registry ▶\033[0m")

.PHONY: all
all: megalint test $(BINARY) $(BINARY)-arm64 $(BINARY)-darwin $(BINARY)-darwin-arm64 ## Build all the binary types
all: lint test $(BINARY) $(BINARY)-arm64 $(BINARY)-darwin $(BINARY)-darwin-arm64 ## Build all the binary types

.PHONY: linux
linux: test $(BINARY) ## build linux binary
Expand Down Expand Up @@ -76,9 +76,13 @@ install-darwin-arm64: darwin-arm64 ;$(info $(M) installing epr-server arm64...)
list-updates: ;$(info $(M) listing available go library updates...) @ ## List available go library updates
$Q go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all 2> /dev/null

.PHONY: megalint
megalint: ; $(info $(M) running golangci-lint...) @ ## Runs golangci-lint with a lot of switches
$Q golangci-lint run --config ./golangci-megalint-config.yaml
.PHONY: lint
lint: ; $(info $(M) running golangci-lint...) @ ## Runs golangci-lint with a lot of switches
$Q golangci-lint run --config .golangci.yaml

.PHONY: fmt
fmt: ; $(info $(M) running golangci-lint fmt...) @ ## Runs golangci-lint fmt ./...
$Q golangci-lint fmt --config .golangci.yaml ./...

.PHONY: test
test: ; $(info $(M) running tests...) @ ## Runs go test ./...
Expand Down
3 changes: 2 additions & 1 deletion cli/cmd/event/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func NewSearchCmd() *cobra.Command {
searchCmd.Flags().String("package", "", "Package of the event")
searchCmd.Flags().String("success", "", "Success of the event")
searchCmd.Flags().String("event-receiver-id", "", "Event receiver id of the event")
searchCmd.Flags().String("fields", "id name version release platform_id package success", "Space delimited list of fields, or 'all' for all user fields")
searchCmd.Flags().
String("fields", "id name version release platform_id package success", "Space delimited list of fields, or 'all' for all user fields")
searchCmd.Flags().String("jsonpath", "", "JSONPath expression to apply to output")
searchCmd.Flags().String("url", "http://localhost:8042", "EPR base url")
searchCmd.Flags().Bool("dry-run", false, "do a dry run of the command")
Expand Down
8 changes: 6 additions & 2 deletions cli/cmd/group/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ func runSearchEventReceiverGroup(_ *cobra.Command, _ []string) error {
params["type"] = typeStr
}

fields, err := common.ProcessSearchFields(viper.GetStringSlice("fields"), &storage.EventReceiverGroup{})
fields, err := common.ProcessSearchFields(
viper.GetStringSlice("fields"),
&storage.EventReceiverGroup{},
)
if err != nil {
return err
}
Expand Down Expand Up @@ -101,7 +104,8 @@ func NewSearchCmd() *cobra.Command {
searchCmd.Flags().String("name", "", "Name of the Event Receiver Group")
searchCmd.Flags().String("version", "", "Version of the Event Receiver Group")
searchCmd.Flags().String("type", "", "Type of the Event Receiver Group")
searchCmd.Flags().String("fields", "id name version type", "Space delimited list of fields, or 'all' for all user fields")
searchCmd.Flags().
String("fields", "id name version type", "Space delimited list of fields, or 'all' for all user fields")
searchCmd.Flags().String("jsonpath", "", "JSONPath expression to apply to output")
searchCmd.Flags().String("url", "http://localhost:8042", "EPR base url")
searchCmd.Flags().Bool("dry-run", false, "do a dry run of the command")
Expand Down
8 changes: 6 additions & 2 deletions cli/cmd/receiver/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ func runEventReceiverSearch(_ *cobra.Command, _ []string) error {
params["type"] = typeStr
}

fields, err := common.ProcessSearchFields(viper.GetStringSlice("fields"), &storage.EventReceiver{})
fields, err := common.ProcessSearchFields(
viper.GetStringSlice("fields"),
&storage.EventReceiver{},
)
if err != nil {
return err
}
Expand Down Expand Up @@ -100,7 +103,8 @@ func NewSearchCmd() *cobra.Command {
searchCmd.Flags().String("name", "", "Name of the event receiver")
searchCmd.Flags().String("version", "", "Version of the event receiver")
searchCmd.Flags().String("type", "", "Type of the event receiver")
searchCmd.Flags().String("fields", "id name version type", "Space delimited list of fields, or 'all' for all user fields")
searchCmd.Flags().
String("fields", "id name version type", "Space delimited list of fields, or 'all' for all user fields")
searchCmd.Flags().String("jsonpath", "", "JSONPath expression to apply to output")
searchCmd.Flags().String("url", "http://localhost:8042", "EPR base url")
searchCmd.Flags().Bool("dry-run", false, "do a dry run of the command")
Expand Down
3 changes: 2 additions & 1 deletion cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func init() {

rootCmd.Flags().String("url", "http://localhost:8042", "EPR base url")

rootCmd.Flags().StringVar(&cfgFile, "config", "", "config file (default is $XDG_CONFIG_HOME/epr/epr.yaml)")
rootCmd.Flags().
StringVar(&cfgFile, "config", "", "config file (default is $XDG_CONFIG_HOME/epr/epr.yaml)")
rootCmd.Flags().Bool("debug", false, "Enable debugging statements")
}
10 changes: 8 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ func run(_ *cobra.Command, _ []string) error {
return nil
})

slog.Info(fmt.Sprintf("connect to http://%s/api/v1/graphql for GraphQL playground", cfg.Server.GetSrvAddr()))
slog.Info(
fmt.Sprintf(
"connect to http://%s/api/v1/graphql for GraphQL playground",
cfg.Server.GetSrvAddr(),
),
)

return errGroup.Wait()
}
Expand Down Expand Up @@ -265,7 +270,8 @@ func init() {
rootCmd.Flags().String("db", "postgres://localhost:5432", "database connection string")
rootCmd.Flags().String("tls-cert", "", "Path to the cert for the server")
rootCmd.Flags().String("tls-key", "", "Path to the server key")
rootCmd.Flags().StringVar(&cfgFile, "config", "", "config file (default is $XDG_CONFIG_HOME/epr/epr.yaml)")
rootCmd.Flags().
StringVar(&cfgFile, "config", "", "config file (default is $XDG_CONFIG_HOME/epr/epr.yaml)")
rootCmd.Flags().Bool("json-logging", false, "Format log messages as JSON.")
rootCmd.Flags().Bool("debug", false, "Enable debugging statements")
}
83 changes: 40 additions & 43 deletions docker-compose.services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ name: server-dependencies
volumes:
postgres-data: null
redpanda-data: null
networks:
redpanda_network:
driver: bridge
services:
postgres:
image: "postgres:16"
Expand All @@ -12,6 +15,8 @@ services:
- "postgres-data:/var/lib/postgresql/data"
environment:
POSTGRES_HOST_AUTH_METHOD: trust
PGTZ: "America/New_York"
TZ: "America/New_York"
ports:
- "5432:5432"
healthcheck:
Expand All @@ -21,68 +26,60 @@ services:
interval: 5s
timeout: 5s
retries: 5
redpanda:
image: "docker.redpanda.com/redpandadata/redpanda:v23.2.17"
restart: unless-stopped
redpanda-0:
command:
- redpanda
- start
- "--kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092"
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092
# Address the broker advertises to clients that connect to the Kafka API.
# Use the internal addresses to connect to the Redpanda brokers'
# from inside the same Docker network.
# Use the external addresses to connect to the Redpanda brokers'
# from outside the Docker network.
- "--advertise-kafka-addr internal://redpanda:9092,external://localhost:19092"
- "--pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18082"
- --advertise-kafka-addr internal://redpanda-0:9092,external://localhost:19092
- --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18082
# Address the broker advertises to clients that connect to the HTTP Proxy.
- "--advertise-pandaproxy-addr internal://redpanda:8082,external://localhost:18082"
- "--schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18081"
# Redpanda brokers use the RPC API to communicate with eachother internally.
- "--rpc-addr redpanda:33145"
- "--advertise-rpc-addr redpanda:33145"
# Tells Seastar (the framework Redpanda uses under the hood) to use 1 core on the system.
- "--smp 1"
# The amount of memory to make available to Redpanda.
- "--memory 1G"
- --advertise-pandaproxy-addr internal://redpanda-0:8082,external://localhost:18082
- --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18081
# Redpanda brokers use the RPC API to communicate with each other internally.
- --rpc-addr redpanda-0:33145
- --advertise-rpc-addr redpanda-0:33145
# Mode dev-container uses well-known configuration properties for development in containers.
- "--mode dev-container"
# Set logging level
- "--default-log-level=warn"
- --mode dev-container
# Tells Seastar (the framework Redpanda uses under the hood) to use 1 core on the system.
- --smp 1
- --default-log-level=info
image: docker.redpanda.com/redpandadata/redpanda:${REDPANDA_VERSION:-latest}
container_name: redpanda-0
volumes:
- "redpanda-data:/var/lib/redpanda/data"
- redpanda-data:/var/lib/redpanda/data
networks:
- redpanda_network
ports:
- "18081:18081"
- "18082:18082"
- "19092:19092"
- "19644:9644"
healthcheck:
test:
- CMD
- curl
- "http://localhost:9644/v1/status/ready"
interval: 5s
timeout: 5s
retries: 5
redpanda-console:
image: "docker.redpanda.com/redpandadata/console:v2.3.8"
restart: unless-stopped
- 18081:18081
- 18082:18082
- 19092:19092
- 19644:9644
console:
container_name: redpanda-console
image: docker.redpanda.com/redpandadata/console:${REDPANDA_CONSOLE_VERSION:-latest}
networks:
- redpanda_network
entrypoint: /bin/sh
command: "-c \"echo \\\"$$CONSOLE_CONFIG_FILE\\\" > /tmp/config.yml; /app/console\""
command: -c 'echo "$$CONSOLE_CONFIG_FILE" > /tmp/config.yml; /app/console'
environment:
CONFIG_FILEPATH: /tmp/config.yml
CONSOLE_CONFIG_FILE: |

kafka:
brokers: ["redpanda:9092"]
schemaRegistry:
enabled: true
urls: ["http://redpanda:8081"]
brokers: ["redpanda-0:9092"]
schemaRegistry:
enabled: true
urls: ["http://redpanda-0:8081"]
redpanda:
adminApi:
enabled: true
urls: ["http://redpanda:9644"]
urls: ["http://redpanda-0:9644"]
ports:
- "8080:8080"
- 8080:8080
depends_on:
- redpanda
- redpanda-0
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ services:
depends_on:
postgres:
condition: service_healthy
redpanda:
redpanda-0:
condition: service_healthy
1 change: 1 addition & 0 deletions docs/how-to/start-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ mutation {
description: "a fake event receiver group"
event_receiver_ids: ["01HKNDR10NVBA8V7G0V3C15JA6"]
type: "test"
enabled: true
}
)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/watcher/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go 1.21.0
require github.com/sassoftware/event-provenance-registry v0.0.0-20230901192240-3d330b648418

require (
github.com/Shopify/sarama v1.38.1 // indirect
github.com/IBM/sarama v1.38.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/eapache/go-resiliency v1.3.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 // indirect
Expand Down
4 changes: 2 additions & 2 deletions docs/how-to/watcher/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Shopify/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A=
github.com/Shopify/sarama v1.38.1/go.mod h1:iwv9a67Ha8VNa+TifujYoWGxWnu2kNVAQdSdZ4X2o5g=
github.com/IBM/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A=
github.com/IBM/sarama v1.38.1/go.mod h1:iwv9a67Ha8VNa+TifujYoWGxWnu2kNVAQdSdZ4X2o5g=
github.com/Shopify/toxiproxy/v2 v2.5.0 h1:i4LPT+qrSlKNtQf5QliVjdP08GyAH8+BUIc9gT0eahc=
github.com/Shopify/toxiproxy/v2 v2.5.0/go.mod h1:yhM2epWtAmel9CB8r2+L+PCmhH6yH2pITaPAo7jxJl0=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ listed in the table of contents.

## Sections

| Name | Description |
| -------------------------------------- | ------------------------------------------------------------------ |
| [Quickstart](./quickstart/README.md) | Quickstart for the Event Provenance Registry (EPR) Service |
| [The Watcher](./watcher/README.md) | Create a watcher for the Event Provenance Registry (EPR) Service |
| [CDEvents](./cdevents/README.md) | Integrate CDEvents into the Event Provenance Registry (EPR) |
| [CycloneDX SBOM](./sboms/README.md) | Integrate CycloneDX SBOMs into the Event Provenance Registry (EPR) |
| Name | Description |
| ------------------------------------ | ------------------------------------------------------------------ |
| [Quickstart](./quickstart/README.md) | Quickstart for the Event Provenance Registry (EPR) Service |
| [The Watcher](./watcher/README.md) | Create a watcher for the Event Provenance Registry (EPR) Service |
| [CDEvents](./cdevents/README.md) | Integrate CDEvents into the Event Provenance Registry (EPR) |
| [CycloneDX SBOM](./sboms/README.md) | Integrate CycloneDX SBOMs into the Event Provenance Registry (EPR) |
Loading