Travis-CI:部署不同的分支到不同的服务器
Travis-CI: deploy different branches to different servers
目前,我正在尝试结合 Travis-CI.
使用 github 存储库为持续集成设置一个概念项目
My.travis.yml 看起来像这样
language: java
jdk:
- oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
branches:
only:
- master
- develop
deploy:
provider: cloudfoundry
api: https://api.eu-gb.bluemix.net
username: j.cuppen@acuity.nl
password:
secure: [key]
organization: 'Acuity\ Stagiairs'
space: 'stage\ job'
on:
repo: JasonLighthunter/GradleTest
branch: develop
我的 manifest.yml 看起来像这样:
---
applications:
- name: gradleweb
memory: 512M
host: gradleTest
path: build/libs/GradleTest.war
目前,当我推动开发时,它会构建并部署到 gradleTest.eu-gb.mybluemix.net
我想弄清楚的是我如何配置 travis,以便在推送 master 时将其部署到,比方说:gradleProd.eu-gb.mybluemix.net
提前致谢
您可以为每个部署指定 manifest
文件。将您的 .travis.yml
更改为:
deploy:
- provider: cloudfoundry
edge: true
username: ${CF_USERNAME}
password: ${CF_PASSWORD}
organization: ${CF_ORGANIZATION}
space: ${CF_SPACE}
api: https://api.ng.bluemix.net/
manifest: manifest.master.yml
on:
branch: master
- provider: cloudfoundry
edge: true
username: ${CF_USERNAME}
password: ${CF_PASSWORD}
organization: ${CF_ORGANIZATION}
space: ${CF_SPACE}
api: https://api.ng.bluemix.net/
manifest: manifest.develop.yml
on:
branch: develop
在这种情况下,您可以添加两个文件:manifest.develop.yml
和 manifest.master.yml
目前,我正在尝试结合 Travis-CI.
使用 github 存储库为持续集成设置一个概念项目My.travis.yml 看起来像这样
language: java
jdk:
- oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
branches:
only:
- master
- develop
deploy:
provider: cloudfoundry
api: https://api.eu-gb.bluemix.net
username: j.cuppen@acuity.nl
password:
secure: [key]
organization: 'Acuity\ Stagiairs'
space: 'stage\ job'
on:
repo: JasonLighthunter/GradleTest
branch: develop
我的 manifest.yml 看起来像这样:
---
applications:
- name: gradleweb
memory: 512M
host: gradleTest
path: build/libs/GradleTest.war
目前,当我推动开发时,它会构建并部署到 gradleTest.eu-gb.mybluemix.net
我想弄清楚的是我如何配置 travis,以便在推送 master 时将其部署到,比方说:gradleProd.eu-gb.mybluemix.net
提前致谢
您可以为每个部署指定 manifest
文件。将您的 .travis.yml
更改为:
deploy:
- provider: cloudfoundry
edge: true
username: ${CF_USERNAME}
password: ${CF_PASSWORD}
organization: ${CF_ORGANIZATION}
space: ${CF_SPACE}
api: https://api.ng.bluemix.net/
manifest: manifest.master.yml
on:
branch: master
- provider: cloudfoundry
edge: true
username: ${CF_USERNAME}
password: ${CF_PASSWORD}
organization: ${CF_ORGANIZATION}
space: ${CF_SPACE}
api: https://api.ng.bluemix.net/
manifest: manifest.develop.yml
on:
branch: develop
在这种情况下,您可以添加两个文件:manifest.develop.yml
和 manifest.master.yml