Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Add Go Client CI #1

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Go Client CI
on:
push:
branches: main
pull_request: { }
workflow_dispatch: { }
jobs:
go-client:
name: Go client tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- name: Build Go
shell: bash
id: build-go
working-directory: cmd/zbctl
run: ./build.sh
- name: Run Go tests
working-directory: .
run: go test -mod=vendor -v ./...
go-lint:
name: Go linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
# fixed to avoid triggering false positive; see https://github.com/golangci/golangci-lint-action/issues/535
version: v1.55.2
# caching issues, see: https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052190775
skip-pkg-cache: true
skip-build-cache: true
working-directory: .
go-apidiff:
if: github.event_name == 'pull_request'
name: Go Backwards Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- uses: joelanford/go-apidiff@main
29 changes: 2 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,23 @@
# Zeebe Go Client

> [!WARNING]
> The Zeebe Go Client will be officially deprecated with 8.6 release as part of our efforts to streamline the Camunda 8 API experience. This client will not get released with Camunda 8.6, thus no longer receive new features and will be transitioned to a community-maintained status.

### Why This Change?

The decision to deprecate the Go Client aligns with our broader API strategy and resource allocation priorities. The Go Client has seen limited adoption. Moving forward, we are focusing our efforts on the Camunda 8 REST API, which offers a unified, more widely-supported approach for interacting with Zeebe and other Camunda services.

### What Does This Mean for Users?

* No New Features or Updates: Starting with Camunda 8.6, the Go Client will no longer receive new features, updates, or official support from Camunda.
* The official Go client and zbctl will only remain available and maintained for supported minor versions up to Camunda 8.5.
* Community Maintenance: The Go Client will be moved to [Camunda Community Hub](https://github.com/camunda-community-hub) and can be maintained by the community. We encourage contributions from users who wish to continue using and improving this client.
* Transition to REST API: We recommend users transition to the Camunda 8 REST API for all future development. The REST API provides comprehensive functionality and is supported by tools such as cURL, Postman, and OpenAPI.

### Future Considerations

We value feedback from our community. Based on user input, we may explore developing a new client for the Camunda 8 REST API, based on a different technology that aligns with our strategic goals and internal expertise.
For more information on the deprecation and our API strategy, please refer to the official [Camunda blog](https://camunda.com/blog/).
The Zeebe Go client is a Go wrapper implementation around the GRPC (https://github.com/grpc/grpc) generated Zeebe client. It makes it possible to communicate with Zeebe Broker via the GRPC protocol, see the [Zeebe documentation](https://docs.zeebe.io/) for more information about the Zeebe project.

# Development

If we had a gateway-protocol change we need to make sure that we regenerate the protobuf file, which is used by the go client.
In order to do this please follow [this guide](../../gateway-protocol-impl/README.md).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No helper guide anymore for this? Can we still link that somehow?

It's certainly quite useful to have. I think I used it from time to time and still needed support with it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is not setup yet to generate the protocol stub, this will be handled separately see Phase 1 of camunda/camunda#21817

It's also not crucial now as there are no changes planned to the GRPC protocol going forward.


## Testing

### gRPC Mock

To regenerate the gateway mock `internal/mock_pb/mock_gateway.go` run [`mockgen`](https://github.com/golang/mock#installation) from the root of this module (`clients/go`):
To regenerate the gateway mock `internal/mock_pb/mock_gateway.go` run [`mockgen`](https://github.com/golang/mock#installation) from the root of this project:

```
mockgen -source=pkg/pb/gateway.pb.go GatewayClient,Gateway_ActivateJobsClient > internal/mock_pb/mock_gateway.go
```

### Integration tests

To run the integration tests, a Docker image for Zeebe must be built with the tag 'current-test'.
To do that you can run the following command from the root of this repository:

```
megglos marked this conversation as resolved.
Show resolved Hide resolved
docker build --build-arg DIST=build -t camunda/zeebe:current-test .
```

To add new zbctl tests, you must generate a golden file with the expected output of the command you are testing. The tests ignore numbers so you can leave any keys or timestamps in your golden file, even though these will most likely be different from test command's output. However, non-numeric variables are not ignored. For instance, the help menu contains:

```
Expand Down
2 changes: 1 addition & 1 deletion cmd/zbctl/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func TestZbctlWithInsecureGateway(t *testing.T) {
&integrationTestSuite{
ContainerSuite: &containersuite.ContainerSuite{
WaitTime: time.Second,
ContainerImage: "camunda/zeebe:current-test",
ContainerImage: "camunda/zeebe:8.6.0-alpha5",
Env: map[string]string{
"ZEEBE_BROKER_GATEWAY_LONGPOLLING_ENABLED": "false",
},
Expand Down
23 changes: 1 addition & 22 deletions internal/containersuite/containerSuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/camunda/camunda/clients/go/v8/internal/utils"
"github.com/camunda/camunda/clients/go/v8/pkg/pb"
"github.com/camunda/camunda/clients/go/v8/pkg/zbc"
"github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
"github.com/stretchr/testify/suite"
"github.com/testcontainers/testcontainers-go"
Expand Down Expand Up @@ -206,6 +205,7 @@ func (s *ContainerSuite) SetupSuite() {
"ZEEBE_BROKER_NETWORK_HOST": "0.0.0.0",
"ZEEBE_BROKER_NETWORK_ADVERTISEDHOST": "0.0.0.0",
},
AlwaysPullImage: true,
megglos marked this conversation as resolved.
Show resolved Hide resolved
},
Started: true,
}
Expand All @@ -216,10 +216,6 @@ func (s *ContainerSuite) SetupSuite() {
}

ctx := context.Background()
err = validateImageExists(ctx, s.ContainerImage)
megglos marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
s.T().Fatal(err)
}

s.container, err = testcontainers.GenericContainer(ctx, req)
if err != nil {
Expand Down Expand Up @@ -258,20 +254,3 @@ func (s *ContainerSuite) TearDownSuite() {
s.T().Fatal(err)
}
}

func validateImageExists(ctx context.Context, image string) error {
dockerClient, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
return fmt.Errorf("failed creating docker client: %w", err)
}

_, _, err = dockerClient.ImageInspectWithRaw(ctx, image)
if err != nil {
if client.IsErrNotFound(err) {
return fmt.Errorf("a Docker image containing Zeebe must be built and named '%s'", image)
}

return err
}
return nil
}
2 changes: 1 addition & 1 deletion test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/stretchr/testify/suite"
)

const dockerImageName = "camunda/zeebe:current-test"
const dockerImageName = "camunda/zeebe:8.6.0-alpha5"

type integrationTestSuite struct {
*containersuite.ContainerSuite
Expand Down