Trigger complex builds with environment variables

Wercker is a Docker-Native CI/CD Automation platform for Kubernetes & Microservice Deployments

Benno van den berg
Benno van den berg
July 30, 2015

Currently it is possible to trigger builds using our REST API. This allows users to trigger a build for a specific commit, or branch. Today we are enabling users to add environment variables while triggering a build. This will allow for more dynamic use cases.

 

It is already possible to add environment variables as part of the application, or as part of the deploy target. This is the same for each build, and for each deploy to the same deploytarget.

Now you can also add or override environment variables while triggering a deploy through the REST API. Any environment variables with unique keys will be added to the build, while environment variables with the non-unique keys will override previous environment variables.

To override an environment variables, add the property envVars to the payload while triggering a build through the REST API. This property contains objects which only contains a key and a value property. Let’s look at an example payload:

{
  "applicationId": "53c39972053977b43e2632c9",
  "envVars": [{
    "key": "TEST_ENV_VAR",
    "value": "New value"
  }]
}

This will trigger a new build for the default branch of an application. This build will have access to the $TEST_ENV_VAR environment variable, besides the application environment variables.

Currently it is only possible to add text environment variables, and these cannot be hidden/protected. If you want to override an SSH key environment variable, then you need to add either _PUBLIC or _PRIVATE to the environment variable.

Read more about adding environment variables when triggering builds on our Dev Center.

Earn some stickers!

Let us know about the applications you build with wercker. Don’t forget to tweet out a screenshot of your first green build with #wercker and we’ll send you some @wercker stickers.

Follow us on twitter as well to stay in the loop.

 

Topics: Product, Containers