Skip to content

Contributing

Bob Vawter edited this page Jun 12, 2023 · 16 revisions

Actions

Binaries

The Binaries workflow runs go build at the top of the repository and uploads it to a GCP storage bucket. Links to this storage bucket are in Installing.

Docker

The Docker workflow uploads linux/amd64 and linux/arm64 images to DockerHub using the CRL-organization account.

Firestore Emulator

The Firestore emulator workflow builds a local copy of the Google Firestore Emulator for use by integration tests.

Golang

The Golang workflow runs code-quality and go test.

Markdown

The Markdown workflow runs a basic linter for any changes to *.md files.

Status

The Status workflow is a meta-workflow that creates status entries on commits when other workflows are run. These status objects are used as a roll-up of matrix-workflows for branch-protection rules.

PR workflow

The automated test workflows depend upon having a repository secret containing a CockroachDB enterprise license key, so it's necessary for authors to create their PRs on the cdc-sink repository itself. At present, there's no way to allow this secret to be borrowed by PR's created in forks.

The cdc-sink repository uses the GitHub merge queue, where the master branch protection rule references the meta-workflow status objects. It currently requires that the Golang and Binaries workflows complete successfully.

Workflow Status Bypass

Should it be necessary to manually create a meta-workflow status because (e.g. a PR doesn't make changes to trigger the workflow), execute the following:

# The {owner}/{repo} are substituted by the gh command itself.
# You'll need to update the SHA and name of the Workflow.
gh api repos/{owner}/{repo}/statuses/<<SHA>> -f state=success -f context='Workflow <<XYZZY>>'

Recipes

Refresh generated code

go generate ./...

Pre-commit commands

These are checked by the code-quality build step. You'll want to run them before creating a PR.

# Standardize formatting
go run github.com/cockroachdb/crlfmt -ignore _gen.go .

# Lints
go run golang.org/x/lint/golint -set_exit_status ./...
go run honnef.co/go/tools/cmd/staticcheck -checks all ./...

Wire

cdc-sink makes use of Wire for compile-time dependency injection. Wire, unlike some other DI implementations, only manages singleton instances and is pretty much free of any "magic". Wire is useful for cdc-sink because we have several different modes of operation that don't need all services all of the time. It also eliminates the need to manually plumb new service instances all the way through the code-base.

Clone this wiki locally