This is the official command line client for Cloud Foundry. cf v6.0.0 is the current supported release.
- Debian 32 bit
- Debian 64 bit
- Redhat 32 bit
- Redhat 64 bit
- Mac OS X 64 bit
- Windows 32 bit
- Windows 64 bit
- Linux 32 bit binary
- Linux 64 bit binary
- Mac OS X 64 bit binary
- Windows 32 bit binary
- Windows 64 bit binary
Edge binaries are published to our Amazon S3 bucket with each new commit that passes CI. These binaries are not intended for wider use, but for developers to test new features and fixes as they are completed:
- Linux 64 bit binary
- Linux 32 bit binary
- Mac OS X 64 bit binary
- Windows 64 bit binary
- Windows 32 bit binary
You can follow our development progress on Pivotal Tracker.
- Install Go
- Clone (Forking beforehand for development).
- Run
git submodule update --init --recursive
- Run
./bin/build
- The binary will be built into the
./out
directory.
Optionally, you can use bin/run
to compile and run the executable in one step.
- Write a test.
- Run
bin/test
and watch the test fail. - Make the test pass.
- Submit a pull request.
If you want to run the benchmark tests
./bin/go test -bench . -benchmem cf/...
The app (in src/cf/app/app.go
) declares the list of available commands. Help and flags are defined there.
It will instantiate a command, and run it using the runner (in src/cf/commands/runner.go
).
A command has requirements, and a run function. Requirements are used as filters before running the command.
If any of them fails, the command will not run (see src/cf/requirements
for examples of requirements).
When the command is run, it communicates with api using repositories (they are in src/cf/api
).
Repositories are injected into the command, so tests can inject a fake.
Repositories communicate with the api endpoints through a Gateway (see src/cf/net
).
Repositories return a Domain Object and an ApiResponse object.
Domain objects are data structures related to Cloud Foundry (see src/cf/domain
).
ApiResponse objects convey a variety of important error conditions (see src/cf/net/api_status
).
Command dependencies are managed by the commands factory. The app uses the command factory (in src/cf/commands/factory.go
)
to instantiate them, this allows not sharing the knowledge of their dependencies with the app itself.
As for repositories, we use the repository locator to handle their dependencies. You can find it in src/cf/api/repository_locator.go
.
Create Space is a good example of command. Its tests include checking arguments, having requirements, and the actual command itself.
You will find it in src/cf/commands/space/create_space.go
.
Resources that include several commands have been broken out into their own sub-package using the Resource name. An example of this convention is the Space resource and package.
In addition, command file and methods naming follows a CRUD like convention. For example, the Space resource includes commands such a CreateSpace, ListSpaces, etc.
Although not ideal, we use the name "Repository" for API related operations as opposed to "Service". Repository was chosen to avoid confusion with Service domain objects (i.e. creating Services and Service Instances within Cloud Foundry).
By convention, Repository methods return a Domain object and an ApiResponse. Domain objects are used in both Commands and Repositories to model Cloud Foundry data. ApiResponse objects are used to communicate application errors, runtime errors, whether the resource was found, etc. This convention provides a consistent method signature across repositories.