OpenShift Deployment
This page documents deployments using the dpl v2. Please see our blog post for details. You can check previous dpl v1 documentation here.
Travis CI can automatically deploy to OpenShift after a successful build.
For a minimal configuration, add the following to your .travis.yml
:
deploy:
provider: openshift
server: <server>
token: <encrypted token>
project: <project>
edge: true # opt in to dpl v2
Status #
Support for deployments to OpenShift is stable.
Known options #
Use the following options to further configure the deployment.
server |
OpenShift server — required, type: string |
token |
OpenShift token — required, secret, type: string |
project |
OpenShift project — required, type: string |
app |
OpenShift application — type: string, default: repo name |
Shared options #
cleanup |
Clean up build artifacts from the Git working directory before the deployment — type: boolean |
run |
Commands to execute after the deployment finished successfully — type: string or array of strings |
Environment variables #
All options can be given as environment variables if prefixed with OPENSHIFT_
.
For example, token
can be given as OPENSHIFT_TOKEN=<token>
.
Securing secrets #
Secret option values should be given as either encrypted strings in your build
configuration (.travis.yml
file) or environment variables in your repository
settings.
Environment variables can be set on the settings page of your repository, or
using travis env set
:
travis env set OPENSHIFT_TOKEN <token>
In order to encrypt option values when adding them to your .travis.yml
file
use travis encrypt
:
travis encrypt <token>
Or use --add
to directly add it to your .travis.yml
file. Note that this command has to be run in your repository’s root directory:
travis encrypt --add deploy.token <token>
Specifying the application name #
By default, your repository name will be used as the application name.
You can set a different application name using the app
option:
deploy:
provider: openshift
# ⋮
app: <app_name>
Deploying branches to different projects #
In order to choose projects based on the current branch use separate deploy configurations:
deploy:
- provider: openshift
# ⋮
project: <project-1>
on:
branch: master
- provider: openshift
# ⋮
project: <project-2>
on:
branch: staging
Or using YAML references:
deploy:
- &deploy
provider: openshift
# ⋮
project: <project-1>
on:
branch: master
- <<: *deploy
project: <project-2>
on:
branch: staging
Pull Requests #
Note that pull request builds skip the deployment step altogether.