GCBL runs Google Cloud Build locally, allowing easier debugging, execution of builds on your own hardware, and integration into local build and test workflows.
This Google Cloud Build Local fork is maintained by volunteers, so may not always maintain 100% parity with Google's Cloud Build service. Stability and compatibility are our primary goals. If you'd like to contribute, please feel free to put something together and submit a merge request!
As of 2023, the original repository from Google has been archived. This fork is an attempt to keep the project alive, at least, in some form close to the original, and maybe improve on it a bit.
Note
Cloud Build Local works without Google Cloud!
You can create pipelines as you see fit, locally, and yes, offline!
Check out the §New Features below regarding the --no-cloud argument.
See our example node.js GCP function in the samples/ directory which includes an example pipeline.
Tip
See also: Google Cloud Build File Schema
GCBL maintains parity with syntax and format, so you can leverage the official documentation to construct your
deployment pipelines (*.yaml files).
- Added support for loading
.envfile secrets forsecretEnvreplacements.
This will convert only the matchingsecretEnvinto a correspondingenvwith a value.
To use this, just add the--env=<envfilepath>argument withenvfilepathas the path to the.envfile.
This is not supported in the cloud, and only works for GCBL. Which means the cloud will simply treat a secretEnv as intended :) - No contributor agreements. Just code!
- Added support for skipping cloud token gathering and metadata with argument
--no-cloud. This let's you run cloud-build-local without an activegcloudauthentication token (which requires a GCP account).
- You'll need to make sure your system has docker installed.
- Grab the latest release or build from source or install with 'go install github.com/chriseaton/cloud-build-local' .
- Install into your system. Here's an easy way to do it:
unzip <release>.zip sudo chown root: ./cloud-build-local sudo chmod u+x,g+x,o+x ./cloud-build-local sudo mv ./cloud-build-local /usr/bin/ - Get started using GCBL!
To run a local build you should make sure you've got credentials to GCP if using any resources (gcloud auth login),
then specify a false dryrun, the config, and the source code/content directory path. If you don't have a Google
Cloud login, then use the --no-cloud argument.
./cloud-build-local \
--dryrun=false \
--config=path/to/cloudbuild.yaml \
--env=/path/to/.env \
/path/to/appTo build GCBL from source, and run tests, you need a working Go environment. You should also install gcloud and Docker.
This binary has only been tested to work on Linux operating systems. Windows and Mac are currently unsupported, though community contributions are welcome in this area.
go mod vendor
go getgo build -o cloud-build-local github.com/chriseaton/cloud-build-localOptionally, create a system-wide link to the built executable:
sudo ln -s "$(pwd)/cloud-build-local" /usr/bin/cloud-build-localIf you'd like to run the manual test build...
- Create a
tests/.envfile with a secret replacement value:HELLO_BUILD=my secret env variable replacement - Run the test locally:
./cloud-build-local --dryrun=false --config=./tests/cloudbuild.yaml --env=./tests/.env ./tests/src
Other tests (legacy):
go test $(go list github.com/chriseaton/cloud-build-local/... | grep -v vendor)