drone-gke
is an open source project started by a handful of developers at The New York Times and open to the entire open source community.
We really appreciate your help!
When filing an issue, make sure to answer these five questions:
- What version of Go are you using (
go version
)? - What version of Drone are you using?
- What operating system and processor architecture are you using?
- What did you do?
- What did you expect to see?
- What did you see instead?
Feel free to open issues asking general questions along with feature requests.
Pull requests are very welcome! Before submitting changes, please follow these guidelines:
- Check the open issues and pull requests for existing discussions.
- Open an issue to discuss a new feature.
- Write tests.
- Make sure code follows the 'Go Code Review Comments'.
- Open a Pull Request.
Unless otherwise noted, drone-gke
is distributed under the Apache 2.0-style license found in the LICENSE file.
The git workflow follows GitFlow.
New features should be based on the main
branch.
# run tests for required core dependencies
make check
Go Modules is used to manage dependencies.
make drone-gke
make test-coverage
Using a custom repo name:
docker_repo_name=alice make docker-image
Using a custom tag:
docker_tag=alpha make docker-image
⚠️ By default,make docker-push
will attempt to push tonytimes/drone-gke
Push existing image to custom repo using custom tag:
docker_repo_name=alice docker_tag=alpha make docker-push
⚠️ Valid GCP service account credentials are required. See "Creating test service account credentials" for more details.
Configuring TOKEN
If you created test service account credentials using "Creating test service account credentials", those credentials will be used by default.
If using service account credentials that you created manually:
# replace with correct path
export TOKEN="$(cat /path/to/keyfile.json)"
If you have an existing gcloud
configuration for container/cluster
, compute/zone
, or compute/region
, those values will be used by default.
Otherwise manually configure the following using appropriate values:
export PLUGIN_CLUSTER=dev
export PLUGIN_ZONE=us-east1-b
# -- or --
export PLUGIN_REGION=us-east1
By default, PLUGIN_NAMESPACE
will be set to drone-gke-test
.
If you'd like to use the namespace currently configured with kubectl
:
export PLUGIN_NAMESPACE=$(kubectl config view --minify --output 'jsonpath={..namespace}')
Otherwise manually configure a different namespace value:
export PLUGIN_NAMESPACE=my-test-ns
⚠️ AssumesTOKEN
and any cluster related parameters have already been set / exported within the current terminal session
Using sample configurations within local-example
:
# `dry-run` and `verbose` are both enabled by default
make run
# disable via the respective `PLUGIN_*` environment variables
PLUGIN_DRY_RUN=0 PLUGIN_VERBOSE=0 make run
Using custom configurations with default files:
# Deploy manifest templates in my-custom-configs
# my-custom-configs
# ├── .kube.sec.yml
# ├── .kube.yml
# └── vars.json
export CONFIG_HOME=$(pwd)/my-custom-configs
make run
Using custom configurations with custom files:
# Deploy manifest templates in my-super-custom-configs
# my-super-custom-configs
# ├── app.yml
# ├── custom-vars.json
# └── secrets.yml
export CONFIG_HOME=$(pwd)/my-super-custom-configs
export PLUGIN_SECRET_TEMPLATE=${CONFIG_HOME}/secrets.yml
export PLUGIN_TEMPLATE=${CONFIG_HOME}/app.yml
export PLUGIN_VARS="$(cat ${CONFIG_HOME}/custom-vars.json)"
make run
Using custom kubectl version:
export PLUGIN_KUBECTL_VERSION=1.14
make run
If you've built the docker image using a custom repo or tag:
export docker_repo_name=alice
export docker_tag=alpha
make run
To print the commands that would be executed, without actually executing them:
make run -n
make e2e
is an alias for:
make drone-gke
make test-coverage
make docker-image
make test-resources
make run
Build and test the drone-gke
binary, build a drone-gke
docker image tagged using a custom repo name, and run that docker image against a custom test cluster:
export docker_repo_name=alice
export PLUGIN_CLUSTER=my-test-cluster
make e2e
⚠️ By default,make release
will attempt to push tonytimes/drone-gke
make release
is an alias for:
make drone-gke
make test-coverage
make docker-image
make docker-push
Build, test, and push new image using custom repo, tag values:
export docker_repo_name=alice
export docker_tag=alpha
make release
⚠️ The following requires access to an active GCP project, a GCP user account with sufficient privileges, properly configuredgcloud
, andterraform
executables. Please review "Creating and managing service accounts" and the Terraform "Google Cloud Platform Provider" documentation before continuing.
Verify gcloud
configuration:
# the current / active GCP project will be the owner of your test service account resources
gcloud config list
Run following to verify the test resources that will be created / configured:
make terraform/test.tfplan
Run the following to create / configure the test resources:
make test-resources
Once you've finished testing, don't forget to delete these test resources:
make destroy-test-resources