Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Dockerfile
README.markdown
cloudbuild.yaml
entrypoint.bash
test.env
test.txt

README.markdown

envsubst cloud builder

envsubst cloud builder

This builder can be used to pre-process files for environment variables using envsubst.

Building this builder

To build this builder, run the following command in this directory.

$ gcloud builds submit --config=cloudbuild.yaml

Using this builder

Assuming you have the file planetary-message.txt you wish to pre-process in your build:

This is a text message from planet ${PLANET}.

Use the following step to do it:

- id: preprocess-resources
  name: gcr.io/${PROJECT_ID}/envsubst
  env: ["PLANET=Mars"]
  args: ["message.txt"]

This builder can also accept wildcards! Lets say you have another file called info.txt:

The planet ${PLANET} is the next one on the solar system!

You can pass a wildcard, like so:

- id: preprocess-resources
  name: gcr.io/${PROJECT_ID}/envsubst
  env: ["PLANET=Mars"]
  args: ["*.txt"]

This builder can also read environment variables from a .env file. Let's assume you have another file called test.env:

PLANET=Mars

You can instruct the builder to use this file to get environment variables from, like so:

- id: preprocess-resources
  name: gcr.io/${PROJECT_ID}/envsubst
  args: ["-e", "test.env", "*.txt"]
You can’t perform that action at this time.