This buildkite plugin can be used to deploy code to Cloud Functions
See the plugin tester for testing examples and usage, and the Buildkite docs on writing plugins to understand everything in this repo.
If the version number is not provided then the most recent version of the plugin will be used. Do not use version number as main or any branch name.
steps:
- plugins:
- wayfair-incubator/cloud-functions#v0.2.0:
gcp_project: "gcp-us-project"
gcp_region: "us-central1"
cloud_function_name: "function-1"
cloud_function_directory: "directory/function-code"The name of the GCP project you want to deploy to.
Example: gcp-us-project
GCP region where the cloud function is hosted.
Example: us-central1
Name of the cloud function in GCP.
Example: function-1
The directory in your repository where you are storing the code files for the cloud function.
Example: directory/function-code
This plugin expects GCP_SERVICE_ACCOUNT is placed as an environment variable. Make sure to store it securely!
env:
gcp_service_account: '{"email": ""}'This project uses modern Python tooling for fast, efficient development:
- Python 3.13+: Latest stable Python versions (3.13 and 3.14 supported)
- uv: Fast Python package installer (10-100x faster than pip)
- Ruff: Unified linter and formatter (10-100x faster than black/flake8/isort)
- Docker: Consistent development environment
- Docker and Docker Compose (v2 recommended:
docker composeor legacy v1:docker-compose) - Python 3.13 or 3.14 (for local development without Docker)
- uv (optional, for local development)
# Build the development container (Python 3.13)
docker-compose build
# Or build Python 3.14 container (when Python 3.14 is released)
docker-compose build devbox-py314
# Run all tests and linting
docker-compose run --rm py-test
# Format code automatically
docker-compose run --rm ruff-format
# Run linter with auto-fix
docker-compose run --rm ruff-lintWhen Python 3.14 is officially released, you can test your code against it:
# Build Python 3.14 container
docker-compose build devbox-py314
# Run tests in Python 3.14
docker-compose run --rm devbox-py314 pytest
# Open interactive shell with Python 3.14
docker-compose run --rm devbox-py314# Run all tests with coverage
docker-compose run --rm py-test
# Run tests with formatting (formats code before running tests)
docker-compose run --rm py-test --format-code
# Run tests locally (requires Python 3.13 and dependencies)
pytest --cov plugin_scripts tests --cov-report html# Format code with Ruff
docker-compose run --rm ruff-format
# Check formatting (without modifying files)
docker-compose run --rm ruff-format-check
# Run linter and auto-fix issues
docker-compose run --rm ruff-lint
# Run linter in check mode (no fixes)
docker-compose run --rm ruff-check
# Run type checking with mypy
docker-compose run --rm mypy# Lock requirements (creates requirements.lock file)
docker-compose run --rm lock-requirements
# Install dependencies locally with uv (fast!)
uv pip install --system -r requirements.txt -r requirements-test.txt
# Install dependencies locally with pip
pip install -r requirements.txt -r requirements-test.txt# Start an interactive shell in the container
docker-compose run --rm devbox
# Inside the container, you can:
# - Run pytest
# - Run ruff check/format
# - Run mypy
# - Debug codeIf you prefer to develop without Docker:
# Install uv (https://github.com/astral-sh/uv)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv pip install -r requirements.txt -r requirements-test.txt
# Run tests
pytest --cov plugin_scripts tests --cov-report html
# Format code
ruff format plugin_scripts tests
# Lint code
ruff check --fix plugin_scripts tests
# Type check
mypy plugin_scripts testscloud-functions-buildkite-plugin/
├── plugin_scripts/ # Main plugin code
│ ├── __init__.py
│ ├── deploy.py # Deployment logic
│ └── pipeline_exceptions.py # Custom exceptions
├── tests/ # Test suite
│ ├── __init__.py
│ ├── test_deploy.py
│ └── test_pipeline_exceptions.py
├── docker/ # Docker configuration
│ ├── devbox.dockerfile
│ ├── run_tests.sh # Test runner script
│ └── lock_requirements.sh # Dependency locking script
├── hooks/ # Buildkite plugin hooks
│ └── command # Main plugin command
├── pyproject.toml # All tool configurations
├── requirements.txt # Production dependencies
├── requirements-test.txt # Development dependencies
└── docker-compose.yaml # Docker services
All tool configurations are centralized in pyproject.toml:
- Ruff: Linting and formatting rules
- MyPy: Type checking configuration
- Pytest: Test runner configuration
- Coverage: Code coverage settings
See pyproject.toml for detailed configuration options.
See the Contributing Guide for additional information.
To execute tests locally (requires that docker and Docker Compose are installed):
docker compose run --rm py-test
# Or with legacy v1: docker-compose run --rm py-testThis project uses Ruff for linting and formatting. Ruff is configured to:
- Enforce PEP 8 style guidelines
- Sort imports (replacing isort)
- Check for common bugs and security issues (replacing bandit)
- Enforce modern Python patterns (pyupgrade)
- Use pathlib for file operations
To format your code before committing:
docker-compose run --rm ruff-format
docker-compose run --rm ruff-lintThis project uses MyPy for static type checking. Run type checks with:
docker-compose run --rm mypyThis release includes major modernization improvements:
- ⚡ 10-100x faster dependency installation with uv
- ⚡ 10-100x faster linting and formatting with Ruff
- 🐍 Python 3.13 & 3.14 support (upgraded from 3.10)
- 🔒 Security improvements: Better error handling and logging
- 📦 Latest dependencies: All packages updated to latest versions
- 🧪 Enhanced test coverage: 17+ new test cases with branch coverage
- 🎯 Better error messages: Custom exceptions with detailed information
- 📝 Comprehensive documentation: Full docstrings and type hints
See CHANGELOG.md for complete details.
For users, no changes required - the plugin API is unchanged. Simply update your version reference.
For developers:
- Rebuild Docker containers:
docker-compose build - All old linting tools (black, isort, flake8, bandit) have been replaced with Ruff
- Configuration moved from multiple files to
pyproject.toml
See the CHANGELOG.md for detailed migration instructions.
This plugin was originally written by Jash Parekh for Wayfair.