Skip to content

Commit

Permalink
Allow env vars to be set in pre-steps (#40)
Browse files Browse the repository at this point in the history
* Switch to build-tools-ci:6.x

* wrap in /build-tools-ci/scripts/set-environment in a param

* Update @orb.yml

* adding set_env_vars to readme
  • Loading branch information
stevector authored May 21, 2020
1 parent b54d3a6 commit 1d4a2b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Jobs from CircleCI Orbs can take parameters (variables) that alter the behavior
| `env_create_max_time` | string | `"10m"` | no | The maximum amount of time to wait for Pantheon environment creation (terminus -n build:env:create). This parameter maps to CircleCI's native `no_output_timeout` option." |
| `terminus_clone_env` | string | `"live"` | no | The source environment from which the database and uploaded files are cloned. |
| `directory_to_push` | string | `"."` | no | The directory within the repository to push to Pantheon. Use this setting if you have a more complex repo structure that puts your Pantheon root in a deeper directory. For instance, if you are using a monorepo to manage a backend CMS on Pantheon and a decoupled frontend deployed elsewhere, set this param to the name of the directory that holds your `pantheon.yml` file. |
| `set_env_vars` | boolean | `true` | no | Should this job run a script to set env vars like TERMINUS_ENV? Set to false if you set variables in 'pre-steps' |

## Assumptions and Intended Audience

Expand Down
15 changes: 11 additions & 4 deletions src/@orb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ display:
jobs:
push:
docker:
- image: quay.io/pantheon-public/build-tools-ci:5.x
- image: quay.io/pantheon-public/build-tools-ci:6.x
working_directory: ~/sitedir
environment:
TZ: "/usr/share/zoneinfo/America/Los_Angeles"
Expand All @@ -24,6 +24,10 @@ jobs:
description: "Should this job checkout your repository as the first step? Set to false if you are calling 'checkout' in 'pre-steps'"
default: true
type: boolean
set_env_vars:
description: "Should this job run a script to set env vars like TERMINUS_ENV? Set to false if you set variables in 'pre-steps'"
default: true
type: boolean
env_create_max_time:
description: "The maximum amount of time to wait for Pantheon environment creation (terminus -n build:env:create). This parameter maps to CircleCI's native 'no_output_timeout' option."
default: "10m"
Expand All @@ -49,9 +53,12 @@ jobs:
# will be the Multidev environment pr-$CI_PULL_REQUEST
# In all other cases a new Pantheon multidev will be created specifically
# for this build number, ci-$CIRCLE_BUILD_NUM.
- run:
name: Derive additional environment variables
command: /build-tools-ci/scripts/set-environment
- when:
condition: <<parameters.set_env_vars>>
steps:
- run:
name: Derive additional environment variables
command: /build-tools-ci/scripts/set-environment

# Later commands require being signed in to Pantheon.
- run:
Expand Down

0 comments on commit 1d4a2b5

Please sign in to comment.