The CloudCaptain Gradle plugin lets you execute the various commands directly from your Gradle build.
The CloudCaptain Gradle plugin is available from the Gradle Plugin portal.
You can start using it by adding the following to your build.gradle
:
plugins { id "com.boxfuse.client" version "1.33.0.1460" } boxfuse { user='your-boxfuse-client-user' secret='your-boxfuse-client-secret' }
You can find your credentials on the downloads tab in the CloudCaptain Console.
Alternatively credentials can also be passed in via the BOXFUSE_USER
and BOXFUSE_SECRET
environment variables.
CloudCaptain is opinionated, favors convention over configuration and comes with sensible defaults.
You can override these defaults by either configuring the plugin, adding Gradle properties or passing in System properties.
You can also either specify an external config file or place a boxfuse.conf
file in either the current directory or under .boxfuse in your home directory.
Higher items on the list override lower ones:
configfile
BOXFUSE_USER
and BOXFUSE_SECRET
environment variablesSetting a property to an empty string with unset that property.
Note: Config files with <env> are environment-specific, for example boxfuse-prod.conf
By default the CloudCaptain plugin is configured via the CloudCaptain extension (com.boxfuse.client.gradle.CloudCaptainExtension
) like this:
boxfuse { app='hello' healthcheckPath='/health' }
In some build scripts however you may want to use different values for different tasks. In that case you can define additional instances of the tasks and configure them individually like this:
task boxfuseRunProd (type: com.boxfuse.client.gradle.task.RunTask) { env='prod' }
Or you can if you prefer, you can also define multiple instances of the extension:
extensions.create('boxfuseProd', com.boxfuse.client.gradle.CloudCaptainExtension) boxfuseProd { env='prod' } task boxfuseRunProd (type: com.boxfuse.client.gradle.task.RunTask) { extension=boxfuseProd }
Tip: Check out our blog post on how to set up integration tests using the CloudCaptain Gradle plugin
Besides configuring credentials through one of the configuration mechanisms described above,
you can also pass in your CloudCaptain credentials by setting the BOXFUSE_USER
and
BOXFUSE_SECRET
environment variables.
If your network requires you to use a proxy to connect to the outside world, you have two options.
You can either configure Gradle to use a proxy. The CloudCaptain Gradle plugin will then automatically pick up those settings and use them.
Or you can tell CloudCaptain directly to use a proxy (this will take precedence over any proxies configured in Gradle as described above):
boxfuse { proxy='https://myuser:mypwd@myproxyhost:1234' }
This can also be defined directly on individual tasks using the proxy
attribute or through the Gradle/System property boxfuse.proxy
.
CloudCaptain always communicates via TLS (SSL). If your corporate network modifies the certificate chain to inspect traffic,
you can tell CloudCaptain not to verify TLS certificate chains via the insecure
property:
boxfuse { insecure=true }
This can also be defined through any other configuration means described above.
CloudCaptain handles networking on VirtualBox differently based on the version.
By default, on VirtualBox 5.1 and above, CloudCaptain creates a separate VirtualBox NAT Network. On VirtualBox 5.0 CloudCaptain uses regular VirtualBox NAT instead.
VirtualBox 5.1+ users also have the possibility to force CloudCaptain to use regular VirtualBox NAT instead of the NAT Network
by explicitly setting the virtualbox.natnetwork
CloudCaptain configuration property to false
.