Skip to content

Latest commit

 

History

History
163 lines (103 loc) · 3.73 KB

DEVELOPER.md

File metadata and controls

163 lines (103 loc) · 3.73 KB

DEVELOPER.md

Before you begin

  1. Make sure you've setup your databases.

  2. Install the latest version of Go.

  3. Locate and download dependencies:

    go get
    go mod tidy

Developing Toolbox

Run Toolbox from local source

  1. Open a local connection to your database by starting the Cloud SQL Auth Proxy.

  2. You should already have a tools.yaml created with your sources and tools configurations.

  3. You can specify flags for the Toolbox server. Execute the following to list the possible CLI flags:

    go run . --help
  4. To run the server, execute the following (with any flags, if applicable):

    go run .

    The server will listen on port 5000 (by default).

  5. Test endpoint using the following:

    curl http://127.0.0.1:5000

Run tests locally

  1. Run lint with the following:

    golangci-lint run --fix
  2. Run all tests with the following:

    go test -race -v ./...

Compile the app locally

Compile Toolbox binary

  1. Run build to compile binary:

    go build -o toolbox
  2. You can specify flags for the Toolbox server. Execute the following to list the possible CLI flags:

    ./toolbox --help
  3. To run the binary, execute the following (with any flags, if applicable):

    ./toolbox

    The server will listen on port 5000 (by default).

  4. Test endpoint using the following:

    curl http://127.0.0.1:5000

Compile Toolbox container images

  1. Run build to compile container image:

    docker build -t toolbox:dev .
  2. Execute the following to view image:

    docker images
  3. Run container image with Docker:

    docker run -d toolbox:dev

Developing Toolbox SDKs

Please refer to the SDK developer guide

CI/CD Details

Cloud Build is used to run tests against Google Cloud resources in test project.

Releasing

There are two types of release for Toolbox, including a versioned release and continuous release.

  • Versioned release: Official supported distributions with the latest tag. The release process for versioned release is in versioned.release.cloudbuild.yaml.
  • Continuous release: Used for early testing features between official supported releases and end-to-end testings.

Supported OS and Architecture binaries

The following OS and computer architecture is supported within the binary releases.

  • linux/amd64
  • darwin/arm64
  • darwin/amd64
  • windows/amd64

Supported container images

The following base container images is supported within the container image releases.

  • distroless

Automated tests

Integration and unit tests are automatically triggered via CloudBuild during each PR creation.

Trigger Setup

Create a Cloud Build trigger via the UI or gcloud with the following specs:

  • Event: Pull request
  • Region:
    • global - for default worker pools
  • Source:
    • Generation: 1st gen
    • Repo: googleapis/genai-toolbox (GitHub App)
    • Base branch: ^main$
  • Comment control: Required except for owners and collaborators
  • Filters: add directory filter
  • Config: Cloud Build configuration file
    • Location: Repository (add path to file)
  • Service account: set for demo service to enable ID token creation to use to authenticated services

Trigger

To run Cloud Build tests on GitHub from external contributors, ie RenovateBot, comment: /gcbrun.