mirror of
https://github.com/SAP/jenkins-library.git
synced 2026-06-19 22:58:55 +02:00
Merge branch 'master' into pr/changeDocumentIdInCommonPipelineEnv
This commit is contained in:
+15
-6
@@ -5,6 +5,9 @@ language: groovy
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
env:
|
||||
global:
|
||||
MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
@@ -16,16 +19,22 @@ jobs:
|
||||
include:
|
||||
- stage: Tests
|
||||
name: Unit Tests
|
||||
script: mvn clean test --batch-mode
|
||||
after_success: mvn -DrepoToken=$COVERALLS_REPO_TOKEN org.jacoco:jacoco-maven-plugin:report org.eluder.coveralls:coveralls-maven-plugin:report
|
||||
|
||||
- stage: Docs
|
||||
name: Build
|
||||
before_script:
|
||||
- curl -L --output cc-test-reporter https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
|
||||
- chmod +x ./cc-test-reporter
|
||||
- ./cc-test-reporter before-build
|
||||
script: mvn package --batch-mode
|
||||
after_script:
|
||||
- JACOCO_SOURCE_PATH="src vars test" ./cc-test-reporter format-coverage target/site/jacoco/jacoco.xml --input-type jacoco
|
||||
- ./cc-test-reporter upload-coverage
|
||||
- mvn -DrepoToken=$COVERALLS_REPO_TOKEN org.eluder.coveralls:coveralls-maven-plugin:report
|
||||
- name: Docs Build
|
||||
if: type = pull_request
|
||||
install: docker pull squidfunk/mkdocs-material:3.0.4
|
||||
script: docker run --rm -it -v ${TRAVIS_BUILD_DIR}:/docs -w /docs/documentation squidfunk/mkdocs-material:3.0.4 build --clean --verbose --strict
|
||||
|
||||
- name: Deploy
|
||||
- stage: Docs
|
||||
name: Deploy
|
||||
if: repo = "SAP/jenkins-library" AND branch = master AND NOT type = pull_request
|
||||
install:
|
||||
- docker pull squidfunk/mkdocs-material:3.0.4
|
||||
|
||||
@@ -4,6 +4,23 @@ boolean insideWorkTree() {
|
||||
return sh(returnStatus: true, script: 'git rev-parse --is-inside-work-tree 1>/dev/null 2>&1') == 0
|
||||
}
|
||||
|
||||
boolean isWorkTreeDirty() {
|
||||
|
||||
if(!insideWorkTree()) error 'Method \'isWorkTreeClean\' called outside a git work tree.'
|
||||
|
||||
def gitCmd = 'git diff --quiet HEAD'
|
||||
def rc = sh(returnStatus: true, script: gitCmd)
|
||||
|
||||
// from git man page:
|
||||
// "it exits with 1 if there were differences and 0 means no differences"
|
||||
//
|
||||
// in case of general git trouble, e.g. outside work tree this is indicated by
|
||||
// a return code higher than 1.
|
||||
if(rc == 0) return false
|
||||
else if (rc == 1) return true
|
||||
else error "git command '${gitCmd}' return with code '${rc}'. This indicates general trouble with git."
|
||||
}
|
||||
|
||||
String getGitCommitIdOrNull() {
|
||||
if ( insideWorkTree() ) {
|
||||
return getGitCommitId()
|
||||
|
||||
@@ -25,7 +25,7 @@ class StepTestTemplateTest extends BasePipelineTest {
|
||||
|
||||
@Test
|
||||
void testStepTestTemplate() throws Exception {
|
||||
jsr.step.call()
|
||||
jsr.step.stepTestTemplate()
|
||||
// asserts
|
||||
assertTrue(true)
|
||||
assertJobStatusSuccess()
|
||||
|
||||
@@ -34,8 +34,8 @@ class ArtifactSetVersionTest extends BasePiperTest {
|
||||
Map dockerParameters
|
||||
|
||||
def GitUtils gitUtils = new GitUtils() {
|
||||
boolean insideWorkTree() {
|
||||
return true
|
||||
boolean isWorkTreeDirty() {
|
||||
return false
|
||||
}
|
||||
|
||||
String getGitCommitIdOrNull() {
|
||||
|
||||
@@ -43,7 +43,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishWithDefaultSettings() throws Exception {
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.checksPublishResults(script: nullScript)
|
||||
|
||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||
// ensure nothing else is published
|
||||
@@ -56,7 +56,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishForJavaWithDefaultSettings() throws Exception {
|
||||
jsr.step.call(script: nullScript, pmd: true, cpd: true, findbugs: true, checkstyle: true)
|
||||
jsr.step.checksPublishResults(script: nullScript, pmd: true, cpd: true, findbugs: true, checkstyle: true)
|
||||
|
||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
|
||||
@@ -74,7 +74,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishForJavaScriptWithDefaultSettings() throws Exception {
|
||||
jsr.step.call(script: nullScript, eslint: true)
|
||||
jsr.step.checksPublishResults(script: nullScript, eslint: true)
|
||||
|
||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||
assertTrue("WarningsPublisher options not set", publisherStepOptions['WarningsPublisher'] != null)
|
||||
@@ -92,7 +92,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishForPythonWithDefaultSettings() throws Exception {
|
||||
jsr.step.call(script: nullScript, pylint: true)
|
||||
jsr.step.checksPublishResults(script: nullScript, pylint: true)
|
||||
|
||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||
assertTrue("WarningsPublisher options not set", publisherStepOptions['WarningsPublisher'] != null)
|
||||
@@ -111,7 +111,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishNothing() throws Exception {
|
||||
jsr.step.call(script: nullScript, aggregation: false)
|
||||
jsr.step.checksPublishResults(script: nullScript, aggregation: false)
|
||||
|
||||
// ensure nothing is published
|
||||
assertTrue("AnalysisPublisher options not empty", publisherStepOptions['AnalysisPublisher'] == null)
|
||||
@@ -124,7 +124,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishNothingExplicitFalse() throws Exception {
|
||||
jsr.step.call(script: nullScript, pmd: false)
|
||||
jsr.step.checksPublishResults(script: nullScript, pmd: false)
|
||||
|
||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||
// ensure nothing else is published
|
||||
@@ -137,7 +137,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishNothingImplicitTrue() throws Exception {
|
||||
jsr.step.call(script: nullScript, pmd: [:])
|
||||
jsr.step.checksPublishResults(script: nullScript, pmd: [:])
|
||||
|
||||
// ensure pmd is not published
|
||||
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
|
||||
@@ -145,7 +145,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishNothingExplicitActiveFalse() throws Exception {
|
||||
jsr.step.call(script: nullScript, pmd: [active: false])
|
||||
jsr.step.checksPublishResults(script: nullScript, pmd: [active: false])
|
||||
|
||||
// ensure pmd is not published
|
||||
assertTrue("PmdPublisher options not empty", publisherStepOptions['PmdPublisher'] == null)
|
||||
@@ -154,7 +154,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
@Test
|
||||
void testPublishWithChangedStepDefaultSettings() throws Exception {
|
||||
// pmd has been set to active: true in step configuration
|
||||
jsr.step.call(script: [commonPipelineEnvironment: [
|
||||
jsr.step.checksPublishResults(script: [commonPipelineEnvironment: [
|
||||
configuration: [steps: [checksPublishResults: [pmd: [active: true]]]]
|
||||
]])
|
||||
|
||||
@@ -169,7 +169,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishWithCustomPattern() throws Exception {
|
||||
jsr.step.call(script: nullScript, eslint: [pattern: 'my-fancy-file.ext'], pmd: [pattern: 'this-is-not-a-patter.xml'])
|
||||
jsr.step.checksPublishResults(script: nullScript, eslint: [pattern: 'my-fancy-file.ext'], pmd: [pattern: 'this-is-not-a-patter.xml'])
|
||||
|
||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
|
||||
@@ -186,7 +186,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishWithArchive() throws Exception {
|
||||
jsr.step.call(script: nullScript, archive: true, eslint: true, pmd: true, cpd: true, findbugs: true, checkstyle: true)
|
||||
jsr.step.checksPublishResults(script: nullScript, archive: true, eslint: true, pmd: true, cpd: true, findbugs: true, checkstyle: true)
|
||||
|
||||
assertTrue("ArchivePatterns number not correct", archiveStepPatterns.size() == 5)
|
||||
assertTrue("ArchivePatterns contains no PMD pattern", archiveStepPatterns.contains('**/target/pmd.xml'))
|
||||
@@ -198,7 +198,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishWithPartialArchive() throws Exception {
|
||||
jsr.step.call(script: nullScript, archive: true, eslint: [archive: false], pmd: true, cpd: true, findbugs: true, checkstyle: true)
|
||||
jsr.step.checksPublishResults(script: nullScript, archive: true, eslint: [archive: false], pmd: true, cpd: true, findbugs: true, checkstyle: true)
|
||||
|
||||
assertTrue("ArchivePatterns number not correct", archiveStepPatterns.size() == 4)
|
||||
assertTrue("ArchivePatterns contains no PMD pattern", archiveStepPatterns.contains('**/target/pmd.xml'))
|
||||
@@ -211,7 +211,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishWithDefaultThresholds() throws Exception {
|
||||
jsr.step.call(script: nullScript, pmd: true)
|
||||
jsr.step.checksPublishResults(script: nullScript, pmd: true)
|
||||
|
||||
assertTrue("AnalysisPublisher options not set",
|
||||
publisherStepOptions['AnalysisPublisher'] != null)
|
||||
@@ -245,7 +245,7 @@ class ChecksPublishResultsTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void testPublishWithThresholds() throws Exception {
|
||||
jsr.step.call(script: nullScript, aggregation: [thresholds: [fail: [high: '10']]], pmd: true)
|
||||
jsr.step.checksPublishResults(script: nullScript, aggregation: [thresholds: [fail: [high: '10']]], pmd: true)
|
||||
|
||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
|
||||
|
||||
@@ -125,7 +125,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
|
||||
assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper'))
|
||||
assertThat(jedr.dockerParams.dockerEnvVars, hasEntry('STATUS_CODE', "${200}"))
|
||||
assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"')))
|
||||
assertThat(jscr.shell, hasItem(containsString('cf push "testAppName" -f "test.yml"')))
|
||||
assertThat(jscr.shell, hasItem(containsString("cf push testAppName -f 'test.yml'")))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -174,7 +174,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
|
||||
assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper'))
|
||||
assertThat(jedr.dockerParams.dockerEnvVars, hasEntry('STATUS_CODE', "${200}"))
|
||||
assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"')))
|
||||
assertThat(jscr.shell, hasItem(containsString('cf push "testAppName" -f "test.yml"')))
|
||||
assertThat(jscr.shell, hasItem(containsString("cf push testAppName -f 'test.yml'")))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -197,7 +197,7 @@ class CloudFoundryDeployTest extends BasePiperTest {
|
||||
])
|
||||
// asserts
|
||||
assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"')))
|
||||
assertThat(jscr.shell, hasItem(containsString('cf push -f "test.yml"')))
|
||||
assertThat(jscr.shell, hasItem(containsString("cf push -f 'test.yml'")))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -222,6 +222,53 @@ class CloudFoundryDeployTest extends BasePiperTest {
|
||||
])
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCfNativeBlueGreen() {
|
||||
|
||||
jryr.registerYaml('test.yml', "applications: [[]]")
|
||||
|
||||
jsr.step.cloudFoundryDeploy([
|
||||
script: nullScript,
|
||||
juStabUtils: utils,
|
||||
deployTool: 'cf_native',
|
||||
deployType: 'blue-green',
|
||||
cfOrg: 'testOrg',
|
||||
cfSpace: 'testSpace',
|
||||
cfCredentialsId: 'test_cfCredentialsId',
|
||||
cfAppName: 'testAppName',
|
||||
cfManifest: 'test.yml'
|
||||
])
|
||||
|
||||
assertThat(jedr.dockerParams, hasEntry('dockerImage', 's4sdk/docker-cf-cli'))
|
||||
assertThat(jedr.dockerParams, hasEntry('dockerWorkspace', '/home/piper'))
|
||||
|
||||
assertThat(jscr.shell, hasItem(containsString('cf login -u "test_cf" -p \'********\' -a https://api.cf.eu10.hana.ondemand.com -o "testOrg" -s "testSpace"')))
|
||||
assertThat(jscr.shell, hasItem(containsString("cf blue-green-deploy testAppName --delete-old-apps -f 'test.yml'")))
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testCfNativeWithoutAppNameBlueGreen() {
|
||||
|
||||
helper.registerAllowedMethod('fileExists', [String.class], { s -> return true })
|
||||
jryr.registerYaml('test.yml', "applications: [[]]")
|
||||
|
||||
thrown.expect(hudson.AbortException)
|
||||
thrown.expectMessage('[cloudFoundryDeploy] ERROR: Blue-green plugin requires app name to be passed (see https://github.com/bluemixgaragelondon/cf-blue-green-deploy/issues/27)')
|
||||
|
||||
jsr.step.cloudFoundryDeploy([
|
||||
script: nullScript,
|
||||
juStabUtils: utils,
|
||||
deployTool: 'cf_native',
|
||||
deployType: 'blue-green',
|
||||
cfOrg: 'testOrg',
|
||||
cfSpace: 'testSpace',
|
||||
cfCredentialsId: 'test_cfCredentialsId',
|
||||
cfManifest: 'test.yml'
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testMta() {
|
||||
jsr.step.cloudFoundryDeploy([
|
||||
|
||||
@@ -24,7 +24,7 @@ class DurationMeasureTest extends BasePiperTest {
|
||||
@Test
|
||||
void testDurationMeasurement() throws Exception {
|
||||
def bodyExecuted = false
|
||||
jsr.step.call(script: nullScript, measurementName: 'test') {
|
||||
jsr.step.durationMeasure(script: nullScript, measurementName: 'test') {
|
||||
bodyExecuted = true
|
||||
}
|
||||
assertTrue(nullScript.commonPipelineEnvironment.getPipelineMeasurement('test') != null)
|
||||
|
||||
@@ -55,7 +55,7 @@ class InfluxWriteDataTest extends BasePiperTest {
|
||||
void testInfluxWriteDataWithDefault() throws Exception {
|
||||
|
||||
nullScript.commonPipelineEnvironment.setArtifactVersion('1.2.3')
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.influxWriteData(script: nullScript)
|
||||
|
||||
assertTrue(loggingRule.log.contains('Artifact version: 1.2.3'))
|
||||
|
||||
@@ -74,7 +74,7 @@ class InfluxWriteDataTest extends BasePiperTest {
|
||||
void testInfluxWriteDataNoInflux() throws Exception {
|
||||
|
||||
nullScript.commonPipelineEnvironment.setArtifactVersion('1.2.3')
|
||||
jsr.step.call(script: nullScript, influxServer: '')
|
||||
jsr.step.influxWriteData(script: nullScript, influxServer: '')
|
||||
|
||||
assertEquals(0, stepMap.size())
|
||||
|
||||
@@ -87,7 +87,7 @@ class InfluxWriteDataTest extends BasePiperTest {
|
||||
@Test
|
||||
void testInfluxWriteDataNoArtifactVersion() throws Exception {
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.influxWriteData(script: nullScript)
|
||||
|
||||
assertEquals(0, stepMap.size())
|
||||
assertEquals(0, fileMap.size())
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void environmentPathTest() {
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
|
||||
|
||||
assert jscr.shell.find { c -> c.contains('PATH=./node_modules/.bin:/usr/bin')}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void sedTest() {
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
|
||||
|
||||
assert jscr.shell.find { c -> c =~ /sed -ie "s\/\\\$\{timestamp\}\/`date \+%Y%m%d%H%M%S`\/g" "mta.yaml"$/}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void mtarFilePathFromCommonPipelineEnviromentTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.mtaBuild(script: nullScript,
|
||||
buildTarget: 'NEO')
|
||||
|
||||
def mtarFilePath = nullScript.commonPipelineEnvironment.getMtarFilePath()
|
||||
@@ -79,7 +79,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void mtaJarLocationAsParameterTest() {
|
||||
|
||||
jsr.step.call(script: nullScript, mtaJarLocation: '/mylocation/mta/mta.jar', buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, mtaJarLocation: '/mylocation/mta/mta.jar', buildTarget: 'NEO')
|
||||
|
||||
assert jscr.shell.find { c -> c.contains('-jar /mylocation/mta/mta.jar --mtar')}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
jryr.registerYaml('mta.yaml', { throw new FileNotFoundException() })
|
||||
thrown.expect(FileNotFoundException)
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
jryr.registerYaml('mta.yaml', badMtaYaml())
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
jryr.registerYaml('mta.yaml', noIdMtaYaml() )
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithEnvVars(m) })
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
|
||||
|
||||
assert jscr.shell.find { c -> c.contains("-jar /env/mta/mta.jar --mtar")}
|
||||
assert jlr.log.contains("SAP Multitarget Application Archive Builder file '/env/mta/mta.jar' retrieved from environment.")
|
||||
@@ -140,7 +140,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[mtaBuild:[mtaJarLocation: '/config/mta/mta.jar']]]
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.mtaBuild(script: nullScript,
|
||||
buildTarget: 'NEO')
|
||||
|
||||
assert jscr.shell.find(){ c -> c.contains("-jar /config/mta/mta.jar --mtar")}
|
||||
@@ -152,7 +152,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void mtaJarLocationFromDefaultStepConfigurationTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.mtaBuild(script: nullScript,
|
||||
buildTarget: 'NEO')
|
||||
|
||||
assert jscr.shell.find(){ c -> c.contains("-jar mta.jar --mtar")}
|
||||
@@ -164,7 +164,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void buildTargetFromParametersTest() {
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO')
|
||||
|
||||
assert jscr.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[mtaBuild:[buildTarget: 'NEO']]]
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.mtaBuild(script: nullScript)
|
||||
|
||||
assert jscr.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void canConfigureDockerImage() {
|
||||
|
||||
jsr.step.call(script: nullScript, dockerImage: 'mta-docker-image:latest')
|
||||
jsr.step.mtaBuild(script: nullScript, dockerImage: 'mta-docker-image:latest')
|
||||
|
||||
assert 'mta-docker-image:latest' == jder.dockerParams.dockerImage
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void canConfigureDockerOptions() {
|
||||
|
||||
jsr.step.call(script: nullScript, dockerOptions: 'something')
|
||||
jsr.step.mtaBuild(script: nullScript, dockerOptions: 'something')
|
||||
|
||||
assert 'something' == jder.dockerParams.dockerOptions
|
||||
}
|
||||
@@ -201,7 +201,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.defaultConfiguration = [steps:[mtaBuild:[buildTarget: 'NEO']]]
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.mtaBuild(script: nullScript)
|
||||
|
||||
assert jscr.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void extensionFromParametersTest() {
|
||||
|
||||
jsr.step.call(script: nullScript, buildTarget: 'NEO', extension: 'param_extension')
|
||||
jsr.step.mtaBuild(script: nullScript, buildTarget: 'NEO', extension: 'param_extension')
|
||||
|
||||
assert jscr.shell.find { c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=param_extension build')}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[mtaBuild:[buildTarget: 'NEO', extension: 'config_extension']]]
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.mtaBuild(script: nullScript)
|
||||
|
||||
assert jscr.shell.find(){ c -> c.contains('java -jar mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO --extension=config_extension build')}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'trialuser123')
|
||||
nullScript.commonPipelineEnvironment.configuration = [:]
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName,
|
||||
neoCredentialsId: 'myCredentialsId'
|
||||
)
|
||||
@@ -103,7 +103,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void straightForwardTestConfigViaConfiguration() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName,
|
||||
neoCredentialsId: 'myCredentialsId'
|
||||
)
|
||||
@@ -127,7 +127,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[neoDeploy: [host: 'configuration-frwk.deploy.host.com',
|
||||
account: 'configurationFrwkUser123']]]
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName,
|
||||
neoCredentialsId: 'myCredentialsId'
|
||||
)
|
||||
@@ -145,7 +145,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void archivePathFromCPETest() {
|
||||
nullScript.commonPipelineEnvironment.setMtarFilePath('archive.mtar')
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.neoDeploy(script: nullScript)
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||
@@ -155,7 +155,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void archivePathFromParamsHasHigherPrecedenceThanCPETest() {
|
||||
nullScript.commonPipelineEnvironment.setMtarFilePath('archive2.mtar')
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: "archive.mtar")
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
@@ -169,7 +169,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
thrown.expect(CredentialNotFoundException)
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName,
|
||||
neoCredentialsId: 'badCredentialsId'
|
||||
)
|
||||
@@ -179,7 +179,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void credentialsIdNotProvidedTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName
|
||||
)
|
||||
|
||||
@@ -199,7 +199,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithPath(m) })
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName
|
||||
)
|
||||
|
||||
@@ -214,7 +214,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersionWithPath(m) })
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName,
|
||||
neoCredentialsId: 'myCredentialsId',
|
||||
neoHome: '/param/neo'
|
||||
@@ -229,7 +229,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void neoHomeFromEnvironmentTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName
|
||||
)
|
||||
|
||||
@@ -246,7 +246,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[neoDeploy: [host: 'test.deploy.host.com', account: 'trialuser123', neoHome: '/config/neo']]]
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName
|
||||
)
|
||||
|
||||
@@ -262,7 +262,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage('Archive path not configured (parameter "archivePath").')
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.neoDeploy(script: nullScript)
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(AbortException)
|
||||
thrown.expectMessage('Archive cannot be found')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: 'wrongArchiveName')
|
||||
}
|
||||
|
||||
@@ -285,13 +285,13 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [:]
|
||||
|
||||
jsr.step.call(script: nullScript, archivePath: archiveName)
|
||||
jsr.step.neoDeploy(script: nullScript, archivePath: archiveName)
|
||||
}
|
||||
|
||||
@Test
|
||||
void mtaDeployModeTest() {
|
||||
|
||||
jsr.step.call(script: nullScript, archivePath: archiveName, deployMode: 'mta')
|
||||
jsr.step.neoDeploy(script: nullScript, archivePath: archiveName, deployMode: 'mta')
|
||||
|
||||
Assert.assertThat(jscr.shell,
|
||||
new CommandLineMatcher().hasProlog("#!/bin/bash \"/opt/neo/tools/neo.sh\" deploy-mta")
|
||||
@@ -307,7 +307,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void warFileParamsDeployModeTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
applicationName: 'testApp',
|
||||
runtime: 'neo-javaee6-wp',
|
||||
runtimeVersion: '2.125',
|
||||
@@ -333,7 +333,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void warFileParamsDeployModeRollingUpdateTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
deployMode: 'warParams',
|
||||
applicationName: 'testApp',
|
||||
@@ -358,7 +358,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void warPropertiesFileDeployModeTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
deployMode: 'warPropertiesFile',
|
||||
propertiesFile: propertiesFileName,
|
||||
@@ -379,7 +379,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
@Test
|
||||
void warPropertiesFileDeployModeRollingUpdateTest() {
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
deployMode: 'warPropertiesFile',
|
||||
propertiesFile: propertiesFileName,
|
||||
@@ -403,7 +403,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR applicationName')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
deployMode: 'warParams',
|
||||
runtime: 'neo-javaee6-wp',
|
||||
@@ -417,7 +417,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtime')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
applicationName: 'testApp',
|
||||
deployMode: 'warParams',
|
||||
@@ -430,7 +430,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage('ERROR - NO VALUE AVAILABLE FOR runtimeVersion')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
applicationName: 'testApp',
|
||||
deployMode: 'warParams',
|
||||
@@ -443,7 +443,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage("[neoDeploy] Invalid deployMode = 'illegalMode'. Valid 'deployMode' values are: [mta, warParams, warPropertiesFile]")
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
deployMode: 'illegalMode',
|
||||
applicationName: 'testApp',
|
||||
@@ -459,7 +459,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage("[neoDeploy] Invalid vmSize = 'illegalVM'. Valid 'vmSize' values are: [lite, pro, prem, prem-plus].")
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
deployMode: 'warParams',
|
||||
applicationName: 'testApp',
|
||||
@@ -475,7 +475,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage("[neoDeploy] Invalid warAction = 'illegalWARAction'. Valid 'warAction' values are: [deploy, rolling-update].")
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: warArchiveName,
|
||||
deployMode: 'warParams',
|
||||
applicationName: 'testApp',
|
||||
@@ -490,7 +490,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName,
|
||||
deployHost: "my.deploy.host.com"
|
||||
)
|
||||
@@ -503,7 +503,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
|
||||
nullScript.commonPipelineEnvironment.setConfigProperty('CI_DEPLOY_ACCOUNT', 'configPropsUser123')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.neoDeploy(script: nullScript,
|
||||
archivePath: archiveName,
|
||||
host: "my.deploy.host.com",
|
||||
deployAccount: "myAccount"
|
||||
@@ -600,7 +600,7 @@ class NeoDeployTest extends BasePiperTest {
|
||||
this.opts.add(new MapEntry(key, value))
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
CommandLineMatcher hasArgument(String arg) {
|
||||
this.args.add(arg)
|
||||
return this
|
||||
|
||||
@@ -44,7 +44,7 @@ class PipelineExecuteTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void straightForwardTest() {
|
||||
jsr.step.call(repoUrl: "https://test.com/myRepo.git")
|
||||
jsr.step.pipelineExecute(repoUrl: "https://test.com/myRepo.git")
|
||||
assert load == "Jenkinsfile"
|
||||
assert checkoutParameters.branch == 'master'
|
||||
assert checkoutParameters.repoUrl == "https://test.com/myRepo.git"
|
||||
@@ -55,7 +55,7 @@ class PipelineExecuteTest extends BasePiperTest {
|
||||
|
||||
@Test
|
||||
void parameterizeTest() {
|
||||
jsr.step.call(repoUrl: "https://test.com/anotherRepo.git",
|
||||
jsr.step.pipelineExecute(repoUrl: "https://test.com/anotherRepo.git",
|
||||
branch: 'feature',
|
||||
path: 'path/to/Jenkinsfile',
|
||||
credentialsId: 'abcd1234')
|
||||
@@ -73,6 +73,6 @@ class PipelineExecuteTest extends BasePiperTest {
|
||||
thrown.expect(Exception)
|
||||
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR repoUrl")
|
||||
|
||||
jsr.step.call()
|
||||
jsr.step.pipelineExecute()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class PipelineStashFilesAfterBuildTest extends BasePiperTest {
|
||||
searchTerm ->
|
||||
return false
|
||||
})
|
||||
jsr.step.call(
|
||||
jsr.step.pipelineStashFilesAfterBuild(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
)
|
||||
@@ -42,7 +42,7 @@ class PipelineStashFilesAfterBuildTest extends BasePiperTest {
|
||||
searchTerm ->
|
||||
return true
|
||||
})
|
||||
jsr.step.call(
|
||||
jsr.step.pipelineStashFilesAfterBuild(
|
||||
script: nullScript,
|
||||
juStabUtils: utils,
|
||||
runCheckmarx: true
|
||||
@@ -59,7 +59,7 @@ class PipelineStashFilesAfterBuildTest extends BasePiperTest {
|
||||
searchTerm ->
|
||||
return true
|
||||
})
|
||||
jsr.step.call(
|
||||
jsr.step.pipelineStashFilesAfterBuild(
|
||||
script: [commonPipelineEnvironment: [configuration: [steps: [executeCheckmarxScan: [checkmarxProject: 'TestProject']]]]],
|
||||
juStabUtils: utils,
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ class PipelineStashFilesBeforeBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void testStashBeforeBuildNoOpa() {
|
||||
|
||||
jsr.step.call(script: nullScript, juStabUtils: utils)
|
||||
jsr.step.pipelineStashFilesBeforeBuild(script: nullScript, juStabUtils: utils)
|
||||
|
||||
// asserts
|
||||
assertEquals('mkdir -p gitmetadata', jscr.shell[0])
|
||||
@@ -44,7 +44,7 @@ class PipelineStashFilesBeforeBuildTest extends BasePiperTest {
|
||||
@Test
|
||||
void testStashBeforeBuildOpa() {
|
||||
|
||||
jsr.step.call(script: nullScript, juStabUtils: utils, runOpaTests: true)
|
||||
jsr.step.pipelineStashFilesBeforeBuild(script: nullScript, juStabUtils: utils, runOpaTests: true)
|
||||
|
||||
// asserts
|
||||
assertThat(jlr.log, containsString('Stash content: buildDescriptor'))
|
||||
|
||||
@@ -43,7 +43,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
@Test
|
||||
public void testDefaultPipelineEnvironmentOnly() {
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.prepareDefaultValues(script: nullScript)
|
||||
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().size() == 1
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().default == 'config'
|
||||
@@ -55,7 +55,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
def instance = DefaultValueCache.createInstance([key:'value'])
|
||||
|
||||
// existing instance is dropped in case a custom config is provided.
|
||||
jsr.step.call(script: nullScript, customDefaults: 'custom.yml')
|
||||
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: 'custom.yml')
|
||||
|
||||
// this check is for checking we have another instance
|
||||
assert ! instance.is(DefaultValueCache.getInstance())
|
||||
@@ -72,7 +72,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
|
||||
def instance = DefaultValueCache.createInstance([key:'value'])
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.prepareDefaultValues(script: nullScript)
|
||||
|
||||
assert instance.is(DefaultValueCache.getInstance())
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().size() == 1
|
||||
@@ -86,13 +86,13 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
thrown.expect(hudson.AbortException.class)
|
||||
thrown.expectMessage('No such library resource not_found could be found')
|
||||
|
||||
jsr.step.call(script: nullScript, customDefaults: 'not_found')
|
||||
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: 'not_found')
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultPipelineEnvironmentWithCustomConfigReferencedAsString() {
|
||||
|
||||
jsr.step.call(script: nullScript, customDefaults: 'custom.yml')
|
||||
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: 'custom.yml')
|
||||
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().size() == 2
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().default == 'config'
|
||||
@@ -102,7 +102,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
@Test
|
||||
public void testDefaultPipelineEnvironmentWithCustomConfigReferencedAsList() {
|
||||
|
||||
jsr.step.call(script: nullScript, customDefaults: ['custom.yml'])
|
||||
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: ['custom.yml'])
|
||||
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().size() == 2
|
||||
assert DefaultValueCache.getInstance().getDefaultValues().default == 'config'
|
||||
@@ -112,7 +112,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
@Test
|
||||
public void testAssertNoLogMessageInCaseOfNoAdditionalConfigFiles() {
|
||||
|
||||
jsr.step.call(script: nullScript)
|
||||
jsr.step.prepareDefaultValues(script: nullScript)
|
||||
|
||||
assert ! jlr.log.contains("Loading configuration file 'default_pipeline_environment.yml'")
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class PrepareDefaultValuesTest extends BasePiperTest {
|
||||
@Test
|
||||
public void testAssertLogMessageInCaseOfMoreThanOneConfigFile() {
|
||||
|
||||
jsr.step.call(script: nullScript, customDefaults: ['custom.yml'])
|
||||
jsr.step.prepareDefaultValues(script: nullScript, customDefaults: ['custom.yml'])
|
||||
|
||||
assert jlr.log.contains("Loading configuration file 'default_pipeline_environment.yml'")
|
||||
assert jlr.log.contains("Loading configuration file 'custom.yml'")
|
||||
|
||||
@@ -55,7 +55,7 @@ class SetupCommonPipelineEnvironmentTest extends BasePiperTest {
|
||||
return path.endsWith('.pipeline/config.yml')
|
||||
})
|
||||
|
||||
jsr.step.call(script: nullScript, utils: getSWAMockedUtils())
|
||||
jsr.step.setupCommonPipelineEnvironment(script: nullScript, utils: getSWAMockedUtils())
|
||||
|
||||
assertEquals(Boolean.FALSE.toString(), swaOldConfigUsed)
|
||||
assertEquals('.pipeline/config.yml', usedConfigFile)
|
||||
@@ -71,7 +71,7 @@ class SetupCommonPipelineEnvironmentTest extends BasePiperTest {
|
||||
return path.endsWith('.pipeline/config.properties')
|
||||
})
|
||||
|
||||
jsr.step.call(script: nullScript, utils: getSWAMockedUtils())
|
||||
jsr.step.setupCommonPipelineEnvironment(script: nullScript, utils: getSWAMockedUtils())
|
||||
|
||||
assertEquals(Boolean.TRUE.toString(), swaOldConfigUsed)
|
||||
assertEquals('.pipeline/config.properties', usedConfigFile)
|
||||
|
||||
@@ -35,7 +35,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("The parameter 'home' can not be null or empty.")
|
||||
|
||||
jsr.step.call(tool: 'java')
|
||||
jsr.step.toolValidate(tool: 'java')
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -44,7 +44,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("The parameter 'home' can not be null or empty.")
|
||||
|
||||
jsr.step.call(tool: 'java', home: '')
|
||||
jsr.step.toolValidate(tool: 'java', home: '')
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -55,7 +55,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("The parameter 'tool' can not be null or empty.")
|
||||
|
||||
jsr.step.call(tool: null, home: home)
|
||||
jsr.step.toolValidate(tool: null, home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -66,7 +66,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("The parameter 'tool' can not be null or empty.")
|
||||
|
||||
jsr.step.call(tool: '', home: home)
|
||||
jsr.step.toolValidate(tool: '', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -77,7 +77,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
thrown.expect(AbortException)
|
||||
thrown.expectMessage("The tool 'test' is not supported.")
|
||||
|
||||
jsr.step.call(tool: 'test', home: home)
|
||||
jsr.step.toolValidate(tool: 'test', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,7 +88,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'java', home: home)
|
||||
jsr.step.toolValidate(tool: 'java', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -99,7 +99,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'mta', home: home)
|
||||
jsr.step.toolValidate(tool: 'mta', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,7 +110,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'neo', home: home)
|
||||
jsr.step.toolValidate(tool: 'neo', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -121,7 +121,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getNoVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'cm', home: home)
|
||||
jsr.step.toolValidate(tool: 'cm', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -132,7 +132,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getIncompatibleVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'java', home: home)
|
||||
jsr.step.toolValidate(tool: 'java', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -143,7 +143,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getIncompatibleVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'mta', home: home)
|
||||
jsr.step.toolValidate(tool: 'mta', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -155,7 +155,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getIncompatibleVersion(m) })
|
||||
binding.setVariable('tool', 'cm')
|
||||
|
||||
jsr.step.call(tool: 'cm', home: home)
|
||||
jsr.step.toolValidate(tool: 'cm', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -163,7 +163,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'java', home: home)
|
||||
jsr.step.toolValidate(tool: 'java', home: home)
|
||||
|
||||
assert jlr.log.contains('Verifying Java version 1.8.0 or compatible version.')
|
||||
assert jlr.log.contains('Java version 1.8.0 is installed.')
|
||||
@@ -174,7 +174,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'mta', home: home)
|
||||
jsr.step.toolValidate(tool: 'mta', home: home)
|
||||
|
||||
assert jlr.log.contains('Verifying SAP Multitarget Application Archive Builder version 1.0.6 or compatible version.')
|
||||
assert jlr.log.contains('SAP Multitarget Application Archive Builder version 1.0.6 is installed.')
|
||||
@@ -185,7 +185,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'neo', home: home)
|
||||
jsr.step.toolValidate(tool: 'neo', home: home)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -193,7 +193,7 @@ class ToolValidateTest extends BasePiperTest {
|
||||
|
||||
helper.registerAllowedMethod('sh', [Map], { Map m -> getVersion(m) })
|
||||
|
||||
jsr.step.call(tool: 'cm', home: home)
|
||||
jsr.step.toolValidate(tool: 'cm', home: home)
|
||||
|
||||
assert jlr.log.contains('Verifying Change Management Command Line Interface version 0.0.1 or compatible version.')
|
||||
assert jlr.log.contains('Change Management Command Line Interface version 0.0.1 is installed.')
|
||||
|
||||
@@ -69,7 +69,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript, developmentSystemId: '001', cmUtils: cm)
|
||||
jsr.step.transportRequestCreate(script: nullScript, developmentSystemId: '001', cmUtils: cm)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -78,7 +78,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR developmentSystemId")
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001')
|
||||
jsr.step.transportRequestCreate(script: nullScript, changeDocumentId: '001')
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -101,7 +101,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
thrown.expect(AbortException)
|
||||
thrown.expectMessage("Exception message.")
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
|
||||
jsr.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -127,7 +127,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
def transportId = jsr.step.call(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
|
||||
def transportId = jsr.step.transportRequestCreate(script: nullScript, changeDocumentId: '001', developmentSystemId: '001', cmUtils: cm)
|
||||
|
||||
assert transportId == '001'
|
||||
assert result == [changeId: '001',
|
||||
@@ -166,7 +166,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
def transportId = jsr.step.call(script: nullScript,
|
||||
def transportId = jsr.step.transportRequestCreate(script: nullScript,
|
||||
transportType: 'W',
|
||||
targetSystem: 'XYZ',
|
||||
description: 'desc',
|
||||
@@ -191,7 +191,7 @@ public class TransportRequestCreateTest extends BasePiperTest {
|
||||
|
||||
jlr.expect('[INFO] Change management integration intentionally switched off.')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestCreate(script: nullScript,
|
||||
changeManagement: [type: 'NONE'])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("Change document id not provided (parameter: 'changeDocumentId' or via commit history).")
|
||||
|
||||
jsr.step.call(script: nullScript, transportRequestId: '001', cmUtils: cm)
|
||||
jsr.step.transportRequestRelease(script: nullScript, transportRequestId: '001', cmUtils: cm)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -80,7 +80,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("Transport request id not provided (parameter: 'transportRequestId' or via commit history).")
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001', cmUtils: cm)
|
||||
jsr.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', cmUtils: cm)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -102,7 +102,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001', transportRequestId: '001', cmUtils: cm)
|
||||
jsr.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '001', cmUtils: cm)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -130,7 +130,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001', transportRequestId: '002', cmUtils: cm)
|
||||
jsr.step.transportRequestRelease(script: nullScript, changeDocumentId: '001', transportRequestId: '002', cmUtils: cm)
|
||||
|
||||
assert receivedParams == [type: BackendType.SOLMAN,
|
||||
changeId: '001',
|
||||
@@ -145,7 +145,7 @@ public class TransportRequestReleaseTest extends BasePiperTest {
|
||||
|
||||
jlr.expect('[INFO] Change management integration intentionally switched off.')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestRelease(script: nullScript,
|
||||
changeManagement: [type: 'NONE'])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript, transportRequestId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
|
||||
jsr.step.transportRequestUploadFile(script: nullScript, transportRequestId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -93,7 +93,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("Transport request id not provided (parameter: 'transportRequestId' or via commit history).")
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
|
||||
jsr.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', applicationId: 'app', filePath: '/path', cmUtils: cm)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -106,7 +106,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR applicationId")
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001', transportRequestId: '001', filePath: '/path')
|
||||
jsr.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', filePath: '/path')
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -115,7 +115,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
thrown.expect(IllegalArgumentException)
|
||||
thrown.expectMessage("ERROR - NO VALUE AVAILABLE FOR filePath")
|
||||
|
||||
jsr.step.call(script: nullScript, changeDocumentId: '001', transportRequestId: '001', applicationId: 'app')
|
||||
jsr.step.transportRequestUploadFile(script: nullScript, changeDocumentId: '001', transportRequestId: '001', applicationId: 'app')
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -137,7 +137,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
thrown.expect(AbortException)
|
||||
thrown.expectMessage("Exception message")
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
changeDocumentId: '001',
|
||||
transportRequestId: '001',
|
||||
applicationId: 'app',
|
||||
@@ -172,7 +172,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
changeManagement: [type: 'CTS'],
|
||||
transportRequestId: '002',
|
||||
filePath: '/path',
|
||||
@@ -218,7 +218,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
changeDocumentId: '001',
|
||||
transportRequestId: '002',
|
||||
applicationId: 'app',
|
||||
@@ -289,7 +289,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
changeDocumentId: '001',
|
||||
transportRequestId: '002',
|
||||
applicationId: 'app',
|
||||
@@ -319,7 +319,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
changeDocumentId: '001',
|
||||
transportRequestId: '002',
|
||||
applicationId: 'app',
|
||||
@@ -347,7 +347,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
}
|
||||
}
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
changeDocumentId: '001',
|
||||
transportRequestId: '001',
|
||||
applicationId: 'app',
|
||||
@@ -361,7 +361,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
thrown.expectMessage('Invalid backend type: \'DUMMY\'. Valid values: [SOLMAN, CTS, NONE]. ' +
|
||||
'Configuration: \'changeManagement/type\'.')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
applicationId: 'app',
|
||||
filePath: '/path',
|
||||
changeManagement: [type: 'DUMMY'])
|
||||
@@ -373,7 +373,7 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
||||
|
||||
jlr.expect('[INFO] Change management integration intentionally switched off.')
|
||||
|
||||
jsr.step.call(script: nullScript,
|
||||
jsr.step.transportRequestUploadFile(script: nullScript,
|
||||
changeManagement: [type: 'NONE'])
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.sap.piper
|
||||
|
||||
import hudson.AbortException
|
||||
import static org.hamcrest.Matchers.equalTo
|
||||
import static org.hamcrest.Matchers.hasEntry
|
||||
import static org.hamcrest.Matchers.hasItem
|
||||
import static org.hamcrest.Matchers.is
|
||||
import static org.hamcrest.Matchers.notNullValue
|
||||
import static org.hamcrest.Matchers.startsWith
|
||||
@@ -59,6 +59,36 @@ class GitUtilsTest extends BasePiperTest {
|
||||
assertFalse(gitUtils.insideWorkTree())
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWorkTreeDirty() {
|
||||
jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0)
|
||||
jscr.setReturnValue('git diff --quiet HEAD', 0)
|
||||
assertFalse(gitUtils.isWorkTreeDirty())
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWorkTreeDirtyOutsideWorktree() {
|
||||
thrown.expect(AbortException)
|
||||
thrown.expectMessage('Method \'isWorkTreeClean\' called outside a git work tree.')
|
||||
jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 1)
|
||||
gitUtils.isWorkTreeDirty()
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWorkTreeNotDirty() {
|
||||
jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0)
|
||||
jscr.setReturnValue('git diff --quiet HEAD', 1)
|
||||
assertTrue(gitUtils.isWorkTreeDirty())
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWorkTreeDirtyGeneralGitTrouble() {
|
||||
thrown.expect(AbortException)
|
||||
thrown.expectMessage('git command \'git diff --quiet HEAD\' return with code \'129\'. This indicates general trouble with git.')
|
||||
jscr.setReturnValue('git rev-parse --is-inside-work-tree 1>/dev/null 2>&1', 0)
|
||||
jscr.setReturnValue('git diff --quiet HEAD', 129) // e.g. when called outside work tree
|
||||
gitUtils.isWorkTreeDirty()
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetGitCommitId() {
|
||||
@@ -105,7 +135,7 @@ class GitUtilsTest extends BasePiperTest {
|
||||
String[] log = gitUtils.extractLogLines('xyz')
|
||||
assertNotNull(log)
|
||||
assertThat(log.size(),is(equalTo(0)))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testHandleTestRepository() {
|
||||
@@ -125,5 +155,5 @@ class GitUtilsTest extends BasePiperTest {
|
||||
assertThat(gitMap, hasEntry('branch', config.gitBranch))
|
||||
assertThat(stashName, startsWith('testContent-'))
|
||||
assertThat(result, startsWith('testContent-'))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,7 @@ void call(Map parameters = [:], Closure body = null) {
|
||||
|
||||
def gitUtils = parameters.juStabGitUtils ?: new GitUtils()
|
||||
|
||||
if (gitUtils.insideWorkTree()) {
|
||||
if (sh(returnStatus: true, script: 'git diff --quiet HEAD') != 0)
|
||||
if (gitUtils.isWorkTreeDirty()) {
|
||||
error "[${STEP_NAME}] Files in the workspace have been changed previously - aborting ${STEP_NAME}"
|
||||
}
|
||||
if (script == null)
|
||||
|
||||
@@ -126,6 +126,9 @@ def deployCfNative (config) {
|
||||
|
||||
// check if appName is available
|
||||
if (config.cloudFoundry.appName == null || config.cloudFoundry.appName == '') {
|
||||
if (config.deployType == 'blue-green') {
|
||||
error "[${STEP_NAME}] ERROR: Blue-green plugin requires app name to be passed (see https://github.com/bluemixgaragelondon/cf-blue-green-deploy/issues/27)"
|
||||
}
|
||||
if (fileExists(config.cloudFoundry.manifest)) {
|
||||
def manifest = readYaml file: config.cloudFoundry.manifest
|
||||
if (!manifest || !manifest.applications || !manifest.applications[0].name)
|
||||
@@ -141,11 +144,7 @@ def deployCfNative (config) {
|
||||
export HOME=${config.dockerWorkspace}
|
||||
cf login -u \"${username}\" -p '${password}' -a ${config.cloudFoundry.apiEndpoint} -o \"${config.cloudFoundry.org}\" -s \"${config.cloudFoundry.space}\"
|
||||
cf plugins
|
||||
cf ${deployCommand} ${config.cloudFoundry.appName?"\"${config.cloudFoundry.appName}\"":''} -f \"${config.cloudFoundry.manifest}\" ${config.smokeTest}"""
|
||||
def retVal = sh script: "cf app \"${config.cloudFoundry.appName}-old\"", returnStatus: true
|
||||
if (retVal == 0) {
|
||||
sh "cf delete \"${config.cloudFoundry.appName}-old\" -r -f"
|
||||
}
|
||||
cf ${deployCommand} ${config.cloudFoundry.appName?:''} ${config.deployType == 'blue-green'?'--delete-old-apps':''} -f '${config.cloudFoundry.manifest}' ${config.smokeTest}"""
|
||||
sh "cf logout"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void call(Map parameters = [:]) {
|
||||
.mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
|
||||
.mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, STEP_CONFIG_KEYS)
|
||||
.mixin([
|
||||
artifactVersion: commonPipelineEnvironment.getArtifactVersion()
|
||||
artifactVersion: script.commonPipelineEnvironment.getArtifactVersion()
|
||||
])
|
||||
.mixin(parameters, PARAMETER_KEYS)
|
||||
.use()
|
||||
|
||||
Reference in New Issue
Block a user