You can use Shipyard's CircleCI orb to run jobs on ephemeral environments which were automatically deployed by Shipyard, authenticating into them via a bypass token. The orb connects with Shipyard during a workflow, fetching necessary environment variables in order to run e2e tests where authentication via OAuth is normally required.
How to use
In your CircleCI config, usually located in
.circleci/, you can use the Shipyard's Orb as per the following example:
- Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
- Add the orbs stanza below your version, invoking the orb:
- Use shipyard elements in your existing workflows and jobs.
- Opt-in to use of uncertified orbs on your organization’s Security settings page
Collect the bypass token and URL for an authenticated ephemeral environment attached to this PR in order to run e2e tests on it. Please make sure that your SHIPYARD_API_TOKEN is included as an environment variable.
npm run test
name: Run the e2e tests on the ephemeral environment
fetch-shipyard-env job can be configured using the following parameters:
|Input name||Description||Required||Default Value||Type|
|api-token||Shipyard API token used to fetch necessary environment variables from Shipyard.||no||SHIPYARD_API_TOKEN||env_var_name|
|exit-if-not-pull-request||# of minutes to wait for Shipyard environment before timing out||no||60||integer|
|timeout-minutes||Gracefully exit CircleCI job if this job is not for a pull request||no||false||boolean|
|app-name 1||Filter the environments by name of the application on the Shipyard app||no||string|
On successful run, the following environment variables are set, which can then be passed on to other actions in the same workflow.
|SHIPYARD_ENVIRONMENT_ID||ID of the ephemeral environment|
|SHIPYARD_ENVIRONMENT_URL||URL of the ephemeral environment|
|SHIPYARD_BYPASS_TOKEN 1||Token to bypass authentication|
1 Available in v3.5.1+