mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
deployToCloudFoundry - patch mta blue-green deployment (#457)
mta deploy plugin has flag: ` --no-confirm` which is described as _"Do not require confirmation for deleting the previously deployed MTA apps"_ This flag is essentials for performing fully automated blue-green deployments.
This commit is contained in:
parent
6224d2aece
commit
27c3891685
@ -32,7 +32,7 @@ Deployment can be done
|
||||
| keepOldInstance | no | false | true, false |
|
||||
| dockerImage | no | s4sdk/docker-cf-cli | |
|
||||
| dockerWorkspace | no | /home/piper | |
|
||||
| mtaDeployParameters | | -f | |
|
||||
| mtaDeployParameters | | for _deployType:standard_ `-f`<br />for _deployType:blue-green_ `-f --no-confirm` | |
|
||||
| mtaExtensionDescriptor | no | '' | |
|
||||
| mtaPath | no | '' | |
|
||||
| smokeTestScript | no | blueGreenCheckScript.sh (provided by library). <br />Can be overwritten using config property 'smokeTestScript' | |
|
||||
|
@ -16,6 +16,7 @@ import util.JenkinsWriteFileRule
|
||||
import util.JenkinsReadYamlRule
|
||||
import util.Rules
|
||||
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder
|
||||
import static org.junit.Assert.assertThat
|
||||
|
||||
import static org.hamcrest.Matchers.hasItem
|
||||
@ -398,6 +399,24 @@ class CloudFoundryDeployTest extends BasePiperTest {
|
||||
assertThat(jscr.shell, hasItem(containsString('cf logout')))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMtaBlueGreen() {
|
||||
|
||||
jsr.step.cloudFoundryDeploy([
|
||||
script: nullScript,
|
||||
juStabUtils: utils,
|
||||
jenkinsUtilsStub: new JenkinsUtilsMock(),
|
||||
cfOrg: 'testOrg',
|
||||
cfSpace: 'testSpace',
|
||||
cfCredentialsId: 'test_cfCredentialsId',
|
||||
deployTool: 'mtaDeployPlugin',
|
||||
deployType: 'blue-green',
|
||||
mtaPath: 'target/test.mtar'
|
||||
])
|
||||
|
||||
assertThat(jscr.shell, hasItem(stringContainsInOrder(["cf login -u test_cf", 'cf bg-deploy', '-f', '--no-confirm'])))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInfluxReporting() {
|
||||
jryr.registerYaml('test.yml', "applications: [[name: 'manifestAppName']]")
|
||||
|
@ -209,8 +209,12 @@ def deployMta (config) {
|
||||
if (!config.mtaExtensionDescriptor.isEmpty() && !config.mtaExtensionDescriptor.startsWith('-e ')) config.mtaExtensionDescriptor = "-e ${config.mtaExtensionDescriptor}"
|
||||
|
||||
def deployCommand = 'deploy'
|
||||
if (config.deployType == 'blue-green')
|
||||
if (config.deployType == 'blue-green') {
|
||||
deployCommand = 'bg-deploy'
|
||||
if (config.mtaDeployParameters.indexOf('--no-confirm') < 0) {
|
||||
config.mtaDeployParameters += ' --no-confirm'
|
||||
}
|
||||
}
|
||||
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: config.cloudFoundry.credentialsId,
|
||||
|
Loading…
Reference in New Issue
Block a user